@each1024/pi-mini-mode 2.0.6 → 2.0.7

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.
@@ -36,6 +36,7 @@ export interface MiniLensSettings {
36
36
  "pi-mini-mode-speed-show": boolean;
37
37
  "pi-mini-mode-speed-unit-show": boolean;
38
38
  "pi-mini-mode-minimal-show": boolean;
39
+ "pi-mini-mode-minimal-record-limit": number;
39
40
  "pi-mini-mode-input-enhancements": boolean;
40
41
  "pi-mini-mode-image-preview": "hover" | "inline";
41
42
  "pi-mini-mode-minimal-thinking-show": boolean;
@@ -65,6 +66,7 @@ export const DEFAULT_SETTINGS: Readonly<MiniLensSettings> = {
65
66
  "pi-mini-mode-speed-show": true,
66
67
  "pi-mini-mode-speed-unit-show": true,
67
68
  "pi-mini-mode-minimal-show": true,
69
+ "pi-mini-mode-minimal-record-limit": 6,
68
70
  "pi-mini-mode-input-enhancements": true,
69
71
  "pi-mini-mode-image-preview": "inline",
70
72
  "pi-mini-mode-minimal-thinking-show": true,
@@ -100,12 +102,18 @@ function isBoolean(value: unknown): value is boolean {
100
102
  return typeof value === "boolean";
101
103
  }
102
104
 
105
+ function isRecordLimit(value: unknown): value is number {
106
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
107
+ }
108
+
103
109
  export function parseSettings(value: unknown): MiniLensSettings {
104
110
  const candidate = value && typeof value === "object" ? value as Record<string, unknown> : {};
105
111
  const settings = { ...DEFAULT_SETTINGS };
106
112
  for (const id of SETTING_IDS) {
107
113
  if (id === "pi-mini-mode-image-preview") {
108
114
  if (candidate[id] === "hover" || candidate[id] === "inline") settings[id] = candidate[id];
115
+ } else if (id === "pi-mini-mode-minimal-record-limit") {
116
+ if (isRecordLimit(candidate[id])) settings[id] = candidate[id];
109
117
  } else if (isBoolean(candidate[id])) settings[id] = candidate[id];
110
118
  }
111
119
  if (Array.isArray(candidate.footerOrder)) {
@@ -119,7 +127,7 @@ export function parseSettings(value: unknown): MiniLensSettings {
119
127
  return settings;
120
128
  }
121
129
 
122
- /** True when saved JSON is missing a boolean key or a footer field, so defaults can be written back. */
130
+ /** True when saved JSON is missing a setting or a footer field, so defaults can be written back. */
123
131
  export function settingsNeedBackfill(raw: unknown, parsed: MiniLensSettings): boolean {
124
132
  if (!raw || typeof raw !== "object") return true;
125
133
  const candidate = raw as Record<string, unknown>;
@@ -495,7 +503,7 @@ export function isCollapsedReplyChildSetting(id: string): boolean {
495
503
 
496
504
  export function settingsItems(settings: MiniLensSettings): SettingItem[] {
497
505
  const values = ["on", "off"];
498
- const labels: Record<Exclude<keyof MiniLensSettings, "onboardingCompleted" | "footerOrder" | "pi-mini-mode-image-preview">, string> = {
506
+ const labels: Record<Exclude<keyof MiniLensSettings, "onboardingCompleted" | "footerOrder" | "pi-mini-mode-image-preview" | "pi-mini-mode-minimal-record-limit">, string> = {
499
507
  "pi-mini-mode-project-branch-show": "显示项目名称和分支(互斥)",
500
508
  "pi-mini-mode-branch-show": "仅显示分支(思考等级后,互斥)",
501
509
  "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-input-enhancements": COPY.inputEnhancements, "pi-mini-mode-minimal-thinking-show": COPY.showThinking, "pi-mini-mode-minimal-tools-show": COPY.tools, "pi-mini-mode-minimal-output-show": COPY.output, "pi-mini-mode-minimal-skills-show": COPY.skills, "pi-mini-mode-agent-usage-show": COPY.agentUsage, "pi-mini-mode-agent-shortcut-show": COPY.shortcut,
@@ -759,7 +767,7 @@ function visibleMinimalTurns(settings: MiniLensSettings, turns: MinimalTurn[]):
759
767
  });
760
768
  }
761
769
 
762
- 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, imageOptions?: { cwd(): string; requestRender(): void; write?(data: string): void }) {
770
+ 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, imageOptions?: { cwd(): string; requestRender(): void; write?(data: string): void }, getRecordLimit: () => number = () => DEFAULT_SETTINGS["pi-mini-mode-minimal-record-limit"]) {
763
771
  const placeholderText = (text: string) => imageOptions ? imagePlaceholders(text, imageOptions.cwd()) : text;
764
772
  const markdown = (text: string, width: number, process = false) => renderMinimalMarkdown(text, width, getMarkdownTheme(), theme.getBgAnsi?.("userMessageBg") ?? "",
765
773
  { color: (value) => theme.fg(process ? "muted" : "text", value) }, (source, available) => transformText(placeholderText(diagramMarkdown(source, available))));
@@ -778,7 +786,6 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
778
786
  const expandedTools = new Set<string>();
779
787
  const expandedThinking = new Set<string>();
780
788
  const thinkingPreviews = new Map<string, { text: string; width: number; rows: number; updatedAt: number }>();
781
- const PROCESS_PREVIEW_ROWS = 6;
782
789
  const agentModes = new Map<number, "all" | "preview" | "closed">();
783
790
  const runningTurns = new Set<number>();
784
791
  let pinnedToolId: string | undefined;
@@ -979,11 +986,10 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
979
986
  }
980
987
  const agentTurnControls: Array<{ runId: string; y: number; width: number; line: string }> = [];
981
988
  const agents = liveAgentView(turn.subAgents ?? [], theme, width, subAgentsExpanded(), true, agentDeadlines, Date.now(), expandedSubagents, agentTurnControls);
982
- if (agents.total && !entries.length) entries.push({ title: `SubAgent ${agents.done + agents.errors}/${agents.total}`, detail: "", state: agents.running ? "running" : agents.errors ? "error" : "done", id: `agents:${index}`, thinking: false, processIndex: -1, activeThinking: false });
983
989
  const active = !!turn.running || agents.running > 0 || entries.some(entry => entry.state === "running") || (turn.waitingTools?.length ?? 0) > 0;
984
990
  if (active) runningTurns.add(index);
985
991
  else if (runningTurns.delete(index)) {
986
- // Return to the six-row preview once; a later click can expand everything again.
992
+ // Return to the configured preview once; a later click can expand everything again.
987
993
  if (agentModes.get(index) === "all") {
988
994
  agentModes.set(index, "preview");
989
995
  expandedThinking.clear();
@@ -997,8 +1003,10 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
997
1003
  const expanded = mode === "all";
998
1004
  const busy = entries.some(entry => entry.state === "running") || (turn.waitingTools?.length ?? 0) > 0;
999
1005
  const working = turn.running && !busy && !turn.final;
1000
- // Six recent records stay visible while running and after completion.
1001
- const shown = mode === "closed" ? [] : expanded ? entries : entries.slice(-PROCESS_PREVIEW_ROWS);
1006
+ // Every child keeps its heading; process records share the remaining preview budget.
1007
+ const processLimit = Math.max(0, getRecordLimit() - agents.total);
1008
+ const shown = mode === "closed" ? [] : expanded ? entries : processLimit ? entries.slice(-processLimit) : [];
1009
+ const showWorking = working && (expanded || (!shown.length && !agents.total));
1002
1010
  const done = entries.filter(entry => entry.state === "done").length;
1003
1011
  // ponytail: two terminal text frames; use Pi's motion preference if it exposes one.
1004
1012
  const sparkle = active ? Math.floor(Date.now() / 360) % 2 ? "✧" : "✦" : "✦";
@@ -1015,9 +1023,9 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
1015
1023
  ? theme.fg("muted", "会话 ") + theme.bold(theme.fg("text", formatTokens(usage.totalTokens)))
1016
1024
  + theme.fg("muted", " · 缓存 ") + theme.bold(theme.fg("text", formatTokens(usage.cacheRead)))
1017
1025
  : "";
1018
- const recordCount = entries.filter(entry => !entry.title.startsWith("SubAgent ")).length || agents.total;
1026
+ const recordCount = entries.length + agents.total;
1019
1027
  const progressHeader = theme.fg(active ? "accent" : "muted", sparkle + " ") + theme.bold(theme.fg("text", "Agent")) + theme.fg("muted", recordCount ? ` · ${recordCount}` : "");
1020
- const showAgentRows = mode !== "closed" && expanded;
1028
+ const showAgentRows = agents.total > 0;
1021
1029
  const caret = theme.fg("muted", expanded ? " ▾" : " ▸");
1022
1030
  const elapsedHeader = turn.startedAt == null ? "" : theme.fg("muted", " · ") + theme.fg(active ? "success" : "muted", formatElapsed(turn.startedAt, turn.endedAt ?? Date.now()));
1023
1031
  const left = progressHeader + elapsedHeader + caret;
@@ -1050,7 +1058,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
1050
1058
  const keepStatus = entry.state === "running" || (open && entry.state === "error");
1051
1059
  const glyph = arrow ? (open ? "▼" : "▶") + (keepStatus ? ` ${status}` : "") : status;
1052
1060
  const glyphColor = entry.state === "error" ? "error" : entry.state === "running" || arrow ? "accent" : "muted";
1053
- const last = row === shown.length - 1 && !working && (!showAgentRows || !agents.rows.length);
1061
+ const last = row === shown.length - 1 && !showWorking && !agents.rows.length;
1054
1062
  const prefix = theme.fg(open ? "accent" : "dim", "│ ") + (entry.state === "running" || entry.state === "error" || arrow ? theme.fg(glyphColor, glyph) + " " : "") + summary;
1055
1063
  if (label === "Output") {
1056
1064
  // Wrapped output hangs under the body column and keeps the tree rail to the next sibling.
@@ -1108,7 +1116,7 @@ export function minimalOutputComponent(theme: ExtensionContext["ui"]["theme"], g
1108
1116
  }
1109
1117
  lines.push(...agents.rows);
1110
1118
  }
1111
- if (working && (expanded || !shown.length)) {
1119
+ if (showWorking) {
1112
1120
  const label = turn.awaitingResponse && !shown.length ? "Thinking" : "Working";
1113
1121
  const prefix = theme.fg("dim", "└─ ") + theme.fg("accent", `${runningGlyph()} `) + theme.fg("text", theme.bold(label)) + " ";
1114
1122
  lines.push(truncateToWidth(prefix + theme.fg("muted", turn.awaitingResponse ? "等待模型响应" : "等待下一步执行"), width, ""));
@@ -1260,7 +1268,7 @@ export default function (pi: ExtensionAPI) {
1260
1268
  cwd: () => ctx.cwd,
1261
1269
  requestRender: () => tui.requestRender(),
1262
1270
  write: data => tui.terminal.write(data),
1263
- });
1271
+ }, () => settings["pi-mini-mode-minimal-record-limit"]);
1264
1272
  const hintRemaining = (activeMinimalTurn?.shortcutHintUntil ?? 0) - Date.now();
1265
1273
  if (hintRemaining > 0) {
1266
1274
  shortcutTimer = setTimeout(() => tui.requestRender(), hintRemaining);
@@ -1432,6 +1440,8 @@ export default function (pi: ExtensionAPI) {
1432
1440
  || entry.some(id => typeof id !== "string" || !(FOOTER_FIELDS as readonly string[]).includes(id))) throw new TypeError("Invalid order");
1433
1441
  } else if (key === "pi-mini-mode-image-preview") {
1434
1442
  if (entry !== "hover" && entry !== "inline") throw new TypeError("Invalid preview mode");
1443
+ } else if (key === "pi-mini-mode-minimal-record-limit") {
1444
+ if (!isRecordLimit(entry)) throw new TypeError("Invalid record limit");
1435
1445
  } else if (!SETTING_IDS.includes(key as typeof SETTING_IDS[number]) || typeof entry !== "boolean") throw new TypeError("Invalid setting");
1436
1446
  }
1437
1447
  const next = parseSettings({ ...settings, ...input, onboardingCompleted: true });
package/lib/file-links.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
- import { dirname, isAbsolute, resolve } from "node:path";
3
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { Marked, getCapabilities, sliceByColumn, stripTerminalSequences, visibleWidth } from "@earendil-works/pi-tui";
6
6
 
@@ -23,6 +23,21 @@ export function localPath(path: string, cwd: string): string {
23
23
  return path.startsWith("~/") ? resolve(homedir(), path.slice(2)) : isAbsolute(path) ? path : resolve(cwd, path);
24
24
  }
25
25
 
26
+ /** Otty always underlines OSC 8; ordinary paths use its Cmd-only detection instead. */
27
+ function nativePathLinks(): boolean {
28
+ return process.env.TERM_PROGRAM?.toLowerCase() === "otty"
29
+ && !process.env.TMUX && !process.env.STY && !/^(tmux|screen)/i.test(process.env.TERM ?? "");
30
+ }
31
+
32
+ /** Short forms must remain real paths that Otty can resolve from the pane's cwd. */
33
+ function nativePathLabel(path: string, cwd: string): string {
34
+ const fromCwd = relative(cwd, path);
35
+ if (fromCwd && fromCwd !== ".." && !fromCwd.startsWith("../") && !isAbsolute(fromCwd)) return `./${fromCwd}`;
36
+ const fromHome = relative(homedir(), path);
37
+ if (fromHome && fromHome !== ".." && !fromHome.startsWith("../") && !isAbsolute(fromHome)) return `~/${fromHome}`;
38
+ return path;
39
+ }
40
+
26
41
  /** Opening/closing fences must stay intact; quoted paths inside them are not links. */
27
42
  function fenceRanges(text: string): Array<[number, number]> {
28
43
  const ranges: Array<[number, number]> = [];
@@ -67,14 +82,15 @@ export const fileLink = (text: string, path: string, underline = true) => `\x1b]
67
82
 
68
83
  /** Shorten only visible tool labels; OSC 8 targets retain the complete original path. */
69
84
  export function linkToolFiles(text: string, cwd: string, compact: boolean): string {
70
- const shorten = (label: string) => compact ? label
85
+ const native = nativePathLinks();
86
+ const shorten = (label: string) => compact && !native ? label
71
87
  .replace(/\/var\/folders\/[^\s]*\/otty-paste\//g, "…/otty-paste/")
72
88
  .replace(/node_modules\/@earendil-works\//g, "…/") : label;
73
89
  const hyperlinks = inputCapabilities().hyperlinks;
74
90
  // Image chips already carry a complete target; never shorten or relink it.
75
91
  return text.split(/(\x1b\]8;[^\x07]*\x07[\s\S]*?\x1b\]8;;\x07)/g).map((part, index) => {
76
92
  if (index % 2) return part;
77
- if (!hyperlinks) return shorten(part);
93
+ if (!hyperlinks && !native) return shorten(part);
78
94
  // A path tool's entire argument can contain spaces or punctuation without quotes.
79
95
  const matches = part && !/[\x00-\x1f\x7f]/.test(part) && existsSync(localPath(part, cwd))
80
96
  ? [{ path: part, start: 0, end: part.length }] : filePaths(part);
@@ -82,8 +98,9 @@ export function linkToolFiles(text: string, cwd: string, compact: boolean): stri
82
98
  for (const match of matches) {
83
99
  const path = localPath(match.path, cwd);
84
100
  result += shorten(part.slice(offset, match.start));
85
- const label = shorten(part.slice(match.start, match.end));
86
- result += existsSync(path) ? fileLink(label, path, false) : label;
101
+ const exists = existsSync(path);
102
+ const label = native && compact && exists ? nativePathLabel(path, cwd) : shorten(part.slice(match.start, match.end));
103
+ result += exists && !native ? fileLink(label, path, false) : label;
87
104
  offset = match.end;
88
105
  }
89
106
  return result + shorten(part.slice(offset));
@@ -93,6 +110,7 @@ export function linkToolFiles(text: string, cwd: string, compact: boolean): stri
93
110
  /** Display-only: normalize local targets without changing persisted messages or remote URLs. */
94
111
  export function linkMessageFiles(text: string, cwd: string): string {
95
112
  if (!inputCapabilities().hyperlinks) return text;
113
+ const native = nativePathLinks();
96
114
  let imageNumber = 0;
97
115
  return text.split(/(\x1b\]8;[^\x07]*(?:\x07)[\s\S]*?\x1b\]8;;\x07|\[[^\]\n]*\]\([^\n]*?\))/g).map((part, index) => {
98
116
  if (index % 2) {
@@ -108,7 +126,9 @@ export function linkMessageFiles(text: string, cwd: string): string {
108
126
  for (const match of matches.reverse()) {
109
127
  const path = localPath(match.path, cwd);
110
128
  if (!existsSync(path)) continue;
111
- part = part.slice(0, match.start) + fileLink(match.image ? ` #${match.number}` : match.path, path, !match.image) + part.slice(match.end);
129
+ const label = native && !match.image ? part.slice(match.start, match.end)
130
+ : fileLink(match.image ? ` #${match.number}` : match.path, path, !match.image);
131
+ part = part.slice(0, match.start) + label + part.slice(match.end);
112
132
  }
113
133
  return part;
114
134
  }).join("");
package/lib/settings.html CHANGED
@@ -7,6 +7,7 @@
7
7
  *{box-sizing:border-box}body{margin:0;background:var(--background);color:var(--foreground);font:var(--text-base)/1.5 ui-sans-serif,system-ui,sans-serif}main{max-width:1080px;margin:auto;padding:40px 24px 72px}header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}h1{font:italic 400 var(--text-lg)/1.05 "Didot","Bodoni 72","Iowan Old Style","Songti SC","STSong",serif;letter-spacing:.04em;margin:0}h2{font-size:var(--text-sm);font-weight:600;margin:0 0 12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}nav{display:flex;gap:8px;align-items:center}.hint{margin:12px 0 0;color:var(--accent);font-weight:600}section{margin:28px 0}button{font:inherit;color:inherit;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:8px 12px;cursor:pointer}button:disabled{opacity:.4;cursor:default}:focus-visible{outline:2px solid var(--ring);outline-offset:3px}#preview{position:relative;padding:16px 20px;background:var(--preview-bg);color:var(--preview-text);border:1px dashed var(--border);border-radius:var(--radius);font:var(--text-sm)/1.8 ui-monospace,monospace;display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;height:112px;overflow:auto}#preview button{flex:none;font:inherit;padding:4px 2px;border-color:transparent;background:transparent;color:var(--preview-muted);cursor:grab;white-space:nowrap}#preview button:focus-visible{border-color:var(--accent)}#preview button.over{border-left:2px solid var(--accent)}#preview button.preview-exit{opacity:0;pointer-events:none;transition:opacity 280ms ease-in;position:absolute}#preview .tone-accent{color:var(--preview-accent);font-weight:650}#preview .tone-text{color:var(--preview-text)}#preview .tone-warning{color:var(--preview-warning);font-weight:650}#preview .tone-success{color:var(--preview-success);font-weight:650}#preview .tone-error{color:var(--preview-error);font-weight:650}#preview .tone-muted{color:var(--preview-muted)}#preview #preview-context{flex:1 1 180px;display:flex;align-items:center;gap:8px;min-width:180px}.progress{flex:1;overflow:hidden;text-align:left;color:var(--preview-accent);min-width:0}.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:2px 6px}label{display:flex;align-items:center;gap:10px;padding:10px 0;cursor:pointer;-webkit-user-select:none;user-select:none}.grid label{border:1px solid transparent;border-radius:var(--radius);padding:10px}input{accent-color:var(--accent);width:18px;height:18px;flex-shrink:0}.dragging{opacity:.45}#statusbar{position:fixed;top:12px;right:12px;z-index:2;display:flex;align-items:center;gap:10px;max-width:min(520px,calc(100vw - 24px));padding:8px 12px;background:var(--surface);border:1px solid var(--accent);border-radius:var(--radius);box-shadow:0 6px 20px rgb(0 0 0/.12);color:var(--accent);font-size:var(--text-sm);opacity:0;transform:translateY(-6px);transition:opacity 150ms ease-out,transform 150ms ease-out;pointer-events:none}#statusbar.on{opacity:1;transform:none}#statusbar.error{border-color:var(--destructive);color:var(--destructive)}#statusbar #retry{pointer-events:auto}[hidden]{display:none!important}nav button[aria-pressed=true]{border-color:var(--accent);color:var(--accent)}.features{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:12px}.feature{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px}.feature-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.feature-head h3{margin:0;font-size:var(--text-base);font-weight:600}.feature-body{margin:10px 0 0;color:var(--muted);font-size:var(--text-sm);line-height:1.65}.feature-points{margin:10px 0 0;padding-left:1.15em;font-size:var(--text-sm);line-height:1.7}.feature-points li{margin:2px 0}.feature-points li::marker{color:var(--accent)}.feature-hint{margin:auto 0 0;padding-top:12px;color:var(--muted);font:var(--text-sm)/1.6 ui-monospace,monospace;overflow-wrap:anywhere}.feature-hint::before{content:'› ';color:var(--accent)}.preview-mode{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:14px 0 0;font-size:var(--text-sm)}.preview-mode select{font:inherit;color:var(--foreground);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:8px;min-height:44px}.preview-mode select:disabled{opacity:.5}.switch{display:flex;align-items:center;gap:8px;padding:0;font-size:var(--text-sm);color:var(--muted)}.notice{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;margin:20px 0 0;padding:14px 16px;background:var(--surface);border:1px solid var(--accent);border-left-width:4px;border-radius:var(--radius)}.notice strong{font-size:var(--text-sm)}.notice p{margin:6px 0 0;color:var(--muted);font-size:var(--text-sm);line-height:1.6;max-width:640px}.notice code{display:block;margin:0 0 8px;padding:8px 10px;background:var(--background);border:1px solid var(--border);border-radius:var(--radius);font:var(--text-sm)/1.5 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-width:520px;color:var(--foreground)}#preview{margin-top:12px;margin-bottom:20px}@media(max-width:450px){h1{font-size:2rem}main{padding:24px 16px}#statusbar{top:8px;right:8px;max-width:calc(100vw - 16px)}}@media(prefers-reduced-motion:reduce){#preview button.preview-exit{transition-duration:80ms}}@media(prefers-reduced-motion:reduce){#statusbar{transform:none;transition:opacity 80ms ease-out}}
8
8
  @media(hover:hover) and (pointer:fine){#preview button:hover,.grid label:hover,.feature:hover{border-color:var(--accent)}}
9
9
  #preview button.preview-highlight{border-color:var(--accent)}#preview button.preview-placeholder{border-style:dashed;opacity:1}
10
+ .preview-mode input[type=number]{font:inherit;color:var(--foreground);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:8px;width:6em;height:44px}.preview-mode input:disabled{opacity:.5}
10
11
 
11
12
  /* Editorial headings; controls and status data retain readable system fonts. */
12
13
  body{background:light-dark(#f6f3ed,#141614)}main{max-width:1160px;padding:32px 32px 88px}header{align-items:flex-start;border-bottom:1px solid var(--border);padding-bottom:36px}h1{font:italic 400 clamp(2.625rem,5vw,3.625rem)/1.06 "Didot","Bodoni 72","Songti SC","STSong",serif;letter-spacing:.02em}.subtitle{font:normal 1.625rem/1.4 "Didot","Bodoni 72","Songti SC","STSong",serif;color:var(--accent);margin:16px 0 0}h2{font:normal 2rem/1.25 "Didot","Bodoni 72","Songti SC","STSong",serif;letter-spacing:0;text-transform:none;color:var(--foreground);margin:0 0 16px}section{margin:0;padding-top:24px}.feature-head h3{font:normal 1.625rem/1.25 "Didot","Bodoni 72","Songti SC","STSong",serif}.feature{padding:20px}.feature:first-child{border-top:3px solid var(--accent)}.feature-body,.feature-points{line-height:1.7}#preview{background:var(--surface);border:1px solid var(--border);padding:16px 24px;height:80px;margin-bottom:12px}.grid label{min-height:44px}@media(max-width:760px){main{padding:20px 16px 64px}header{padding-bottom:20px}.features{grid-template-columns:1fr}h2{font-size:1.75rem}.subtitle{font-size:1.375rem}}
@@ -41,14 +42,16 @@ const I18N={
41
42
  fieldsHeading:{zh:'状态栏字段与预览',en:'Status bar items & preview'},
42
43
  optionsHeading:{zh:'状态栏样式',en:'Status bar style'},
43
44
  on:{zh:'开启',en:'On'},off:{zh:'关闭',en:'Off'},previewModeLabel:{zh:'图片预览方式',en:'Image preview mode'},previewHover:{zh:'光标浮窗',en:'Cursor popup'},previewInline:{zh:'内联卡片(多图排列)',en:'Inline cards (multiple images)'},previewModeHint:{zh:'卡片显示在输入框上方;终端不支持图片时显示占位。',en:'Cards appear above the editor; unsupported terminals show placeholders.'},
45
+ recordLimitLabel:{zh:'折叠时记录数',en:'Collapsed record limit'},
46
+ recordLimitHint:{zh:'默认 6 条。子代理始终显示,每个占一条;剩余额度显示最新执行记录。子代理超过上限时,仅显示全部子代理。',en:'Defaults to 6. Every subagent stays visible and uses one record; remaining slots show the latest execution records. When subagents exceed the limit, only their rows remain.'},
44
47
  featureList:{
45
48
  zh:[
46
- {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'极简输出',body:'把对话收成结论:思考、工具与技能汇成一棵按时间排序的可折叠过程树。',points:['长用户消息默认保留前四行,点击展开全文','子代理行可展开活动记录与输出','Ctrl+O 展开或收起过程树,新问题默认收起','最终 Markdown 流畅呈现,失败与中断明确标记']},
49
+ {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'极简输出',body:'把对话收成结论:思考、工具与技能汇成一棵按时间排序的可折叠过程树。',points:['长用户消息默认保留前四行,点击展开全文','子代理始终显示,可展开活动记录与输出','Ctrl+O 展开或收起过程树,新问题默认收起','最终 Markdown 流畅呈现,失败与中断明确标记']},
47
50
  {id:'input-enhancements',setting:'pi-mini-mode-input-enhancements',title:'输入增强',body:'让输入框和消息里的图片、技能与文件路径直接可用。',points:['光标移入图片路径即可预览,全屏编辑器同样支持','图片路径收纳为 [image1] 标签,提交时保留原图','空白后输入 / 就地搜索技能并插入光标处','点击图片标签或文件路径,用系统默认应用打开'],hint:'Ctrl+V 粘贴图片(Windows/WSL 使用 Alt+V)'},
48
51
  {id:'themes',title:'明暗主题',body:'主题让 Markdown、代码高亮、表格与 Mermaid 图表跟随明暗切换。',points:['用户消息使用主题用户背景色,与正文区分','不支持、不完整或过宽的图表保留源文本'],hint:'回到 Pi,输入 /settings → Theme,选择 cc-dark / cc-light'}
49
52
  ],
50
53
  en:[
51
- {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'Minimal transcript',body:'Turns the conversation into conclusions: thinking, tools and skills collapse into one chronological, foldable tree.',points:['Long user messages keep four lines; click to expand','Subagent rows expand to 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']},
54
+ {id:'minimal',setting:'pi-mini-mode-minimal-show',title:'Minimal transcript',body:'Turns the conversation into conclusions: thinking, tools and skills collapse into one chronological, foldable tree.',points:['Long user messages keep four lines; 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']},
52
55
  {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:['Preview an image as soon as the cursor enters its path, in fullscreen too','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','Click image labels or file paths to open them in the default app'],hint:'Ctrl+V pastes images (Windows/WSL: Alt+V)'},
53
56
  {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'}
54
57
  ]
@@ -204,6 +207,19 @@ function feature(item){
204
207
  const points=document.createElement('ul');points.className='feature-points';
205
208
  points.append(...item.points.map(point=>{const li=document.createElement('li');li.textContent=point;return li}));
206
209
  card.append(head,body,points);
210
+ if(item.id==='minimal'){
211
+ const label=document.createElement('label');label.className='preview-mode';label.htmlFor='pi-mini-mode-minimal-record-limit';
212
+ const text=document.createElement('span');text.textContent=t('recordLimitLabel');
213
+ const input=document.createElement('input');input.type='number';input.id=label.htmlFor;input.min='1';input.step='1';input.required=true;input.disabled=!state[item.setting];
214
+ input.value=String(state[input.id]??6);input.onchange=()=>{
215
+ const value=Number(input.value);
216
+ if(!input.checkValidity()||!Number.isSafeInteger(value)||value<1){input.value=String(state[input.id]??6);return}
217
+ state[input.id]=value;change();
218
+ };
219
+ label.append(text,input);card.append(label);
220
+ const hint=document.createElement('p');hint.className='feature-hint';hint.textContent=t('recordLimitHint');card.append(hint);
221
+ head.querySelector('input').addEventListener('change',()=>{input.disabled=!state[item.setting]});
222
+ }
207
223
  if(item.id==='input-enhancements'){
208
224
  const label=document.createElement('label');label.className='preview-mode';label.htmlFor='pi-mini-mode-image-preview';
209
225
  const text=document.createElement('span');text.textContent=t('previewModeLabel');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@each1024/pi-mini-mode",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
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": {