@each1024/pi-mini-mode 1.3.5 → 1.3.6
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/extensions/footer-status.ts +42 -84
- package/package.json +1 -1
|
@@ -1008,44 +1008,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
1008
1008
|
return { render: () => [], invalidate() {} };
|
|
1009
1009
|
});
|
|
1010
1010
|
};
|
|
1011
|
-
pi.registerCommand("pi-mini-mode-prompts", {
|
|
1012
|
-
description: "Expand or collapse a user prompt in fullscreen minimal output",
|
|
1013
|
-
handler: async (_args, ctx) => {
|
|
1014
|
-
if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
|
|
1015
|
-
if (ctx.hasUI) ctx.ui.notify("Prompt folding requires fullscreen minimal output.", "info");
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
const view = promptView;
|
|
1019
|
-
const choices = view.promptChoices();
|
|
1020
|
-
if (!choices.length) { ctx.ui.notify("No user prompts exceed four lines at this width.", "info"); return; }
|
|
1021
|
-
const labels = choices.map(choice => `${choice.index + 1}. ${choice.label} · ${preview(choice.question)}`);
|
|
1022
|
-
const selected = await ctx.ui.select("User prompts · Enter to toggle · Esc to cancel", labels);
|
|
1023
|
-
const choice = choices[labels.indexOf(selected ?? "")];
|
|
1024
|
-
if (choice && promptView === view) {
|
|
1025
|
-
view.togglePrompt(choice.index, choice.question);
|
|
1026
|
-
refreshMinimalOutput();
|
|
1027
|
-
}
|
|
1028
|
-
},
|
|
1029
|
-
});
|
|
1030
|
-
pi.registerCommand("pi-mini-mode-tools", {
|
|
1031
|
-
description: "Expand or collapse a tool's saved text or thinking in fullscreen minimal output",
|
|
1032
|
-
handler: async (_args, ctx) => {
|
|
1033
|
-
if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
|
|
1034
|
-
if (ctx.hasUI) ctx.ui.notify("Tool folding requires fullscreen minimal output.", "info");
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
const view = promptView;
|
|
1038
|
-
const choices = view.toolChoices();
|
|
1039
|
-
if (!choices.length) { ctx.ui.notify("No visible tool calls. Ctrl+O shows older calls.", "info"); return; }
|
|
1040
|
-
const labels = choices.map((choice, index) => `${index + 1}. ${choice.expanded ? "收起" : "展开"} · ${preview(choice.title)}`);
|
|
1041
|
-
const selected = await ctx.ui.select("Tool results · Enter to toggle · Esc to cancel", labels);
|
|
1042
|
-
const choice = choices[labels.indexOf(selected ?? "")];
|
|
1043
|
-
if (choice && promptView === view) {
|
|
1044
|
-
view.toggleTool(choice.id);
|
|
1045
|
-
refreshMinimalOutput();
|
|
1046
|
-
}
|
|
1047
|
-
},
|
|
1048
|
-
});
|
|
1049
1011
|
// All factories run before session_start; retain startup broadcasts until the footer mounts.
|
|
1050
1012
|
const unsubscribeMcpStatus = pi.events.on("pi-mcp-adapter/status/v1", (value: unknown) => {
|
|
1051
1013
|
const count = enabledMcpServerCount(value);
|
|
@@ -1114,29 +1076,24 @@ export default function (pi: ExtensionAPI) {
|
|
|
1114
1076
|
value: (text: string, selected: boolean) =>
|
|
1115
1077
|
selected ? theme.bg("selectedBg", theme.fg("accent", theme.bold(text))) : theme.fg("muted", text),
|
|
1116
1078
|
};
|
|
1117
|
-
const lensItems = () => settingsItems(settings).filter((item) => item.id !== "pi-mini-mode-minimal-show" && !isCollapsedReplyChildSetting(item.id));
|
|
1118
1079
|
const minimalItems = () => settingsItems(settings).filter((item) => isCollapsedReplyChildSetting(item.id));
|
|
1119
1080
|
const collapseItem: SettingItem = {
|
|
1120
1081
|
id: "pi-mini-mode-minimal-show", label: COPY.enableMinimal, description: COPY.enableMinimalDescription,
|
|
1121
1082
|
currentValue: settings["pi-mini-mode-minimal-show"] ? "on" : "off", values: ["on", "off"],
|
|
1122
1083
|
};
|
|
1123
1084
|
const minimalGroup: SettingItem = { id: "minimal", label: COPY.minimal, currentValue: "›" };
|
|
1085
|
+
const separator: SettingItem = { id: "settings-separator", label: "────────────", currentValue: "" };
|
|
1124
1086
|
const applyCollapseState = () => {
|
|
1125
1087
|
const enabled = settings["pi-mini-mode-minimal-show"];
|
|
1126
1088
|
collapseItem.currentValue = enabled ? "on" : "off";
|
|
1127
1089
|
minimalGroup.currentValue = enabled ? "›" : "off";
|
|
1128
1090
|
minimalGroup.description = enabled ? undefined : COPY.minimalLocked;
|
|
1129
|
-
if (enabled) {
|
|
1130
|
-
|
|
1131
|
-
} else {
|
|
1132
|
-
delete minimalGroup.submenu;
|
|
1133
|
-
}
|
|
1091
|
+
if (enabled) minimalGroup.submenu = (_value, back) => new SettingsList(minimalItems(), 8, settingsTheme, onChange, () => back(), { enableSearch: true });
|
|
1092
|
+
else delete minimalGroup.submenu;
|
|
1134
1093
|
};
|
|
1135
1094
|
applyCollapseState();
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
];
|
|
1139
|
-
const settingsList = new SettingsList(groups, 12, settingsTheme, onChange, () => done(undefined), { enableSearch: true });
|
|
1095
|
+
const smallItems = settingsItems(settings).filter((item) => item.id !== "pi-mini-mode-minimal-show" && !isCollapsedReplyChildSetting(item.id));
|
|
1096
|
+
const settingsList = new SettingsList([collapseItem, minimalGroup, separator, ...smallItems], 14, settingsTheme, onChange, () => done(undefined), { enableSearch: true });
|
|
1140
1097
|
container.addChild(settingsList);
|
|
1141
1098
|
return {
|
|
1142
1099
|
render: (width: number) => {
|
|
@@ -1156,40 +1113,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
1156
1113
|
});
|
|
1157
1114
|
};
|
|
1158
1115
|
|
|
1159
|
-
pi.registerCommand("pi-mini-mode-settings", {
|
|
1160
|
-
description: "Configure Pi Mini Mode settings",
|
|
1161
|
-
handler: async (_args, ctx) => openSettings(ctx),
|
|
1162
|
-
});
|
|
1163
|
-
pi.registerCommand("pi-mini-mode-history", {
|
|
1164
|
-
description: "View collapsed process entries for a conversation turn",
|
|
1165
|
-
handler: async (_args, ctx) => {
|
|
1166
|
-
if (ctx.mode !== "tui" || minimalTurns.length === 0) return;
|
|
1167
|
-
const labels = minimalTurns.map((turn, index) => `${index + 1}. ${preview(turn.question)}`);
|
|
1168
|
-
const selected = await ctx.ui.select("Select process entry (keep collapsed view)", labels);
|
|
1169
|
-
const index = selected === undefined ? -1 : labels.indexOf(selected);
|
|
1170
|
-
if (index < 0) return;
|
|
1171
|
-
const snapshot = [...minimalTurns[index].process];
|
|
1172
|
-
await ctx.ui.custom((tui, theme, _keys, done) => {
|
|
1173
|
-
let offset = 0;
|
|
1174
|
-
return {
|
|
1175
|
-
invalidate() {},
|
|
1176
|
-
render(width: number) {
|
|
1177
|
-
const page = snapshot.slice(offset, offset + 5);
|
|
1178
|
-
return [
|
|
1179
|
-
truncateToWidth(theme.fg("accent", `Process ${offset + 1}–${Math.min(offset + 5, snapshot.length)} / ${snapshot.length} · ↑↓ Browse · Esc Close`), width),
|
|
1180
|
-
...page.flatMap((line) => new Markdown(line, 0, 0, minimalMarkdownTheme(getMarkdownTheme()), undefined, { transform: diagramMarkdown }).render(Math.max(1, width))),
|
|
1181
|
-
];
|
|
1182
|
-
},
|
|
1183
|
-
handleInput(data: string) {
|
|
1184
|
-
if (data === "\u001b" || data === "q") done(undefined);
|
|
1185
|
-
else if (data === "\u001b[B" || data === "j") offset = Math.min(Math.max(0, snapshot.length - 5), offset + 1);
|
|
1186
|
-
else if (data === "\u001b[A" || data === "k") offset = Math.max(0, offset - 1);
|
|
1187
|
-
tui.requestRender();
|
|
1188
|
-
},
|
|
1189
|
-
};
|
|
1190
|
-
});
|
|
1191
|
-
},
|
|
1192
|
-
});
|
|
1193
1116
|
pi.registerCommand("pi-mini-mode-minimal", {
|
|
1194
1117
|
description: "Toggle collapsed replies (off keeps Pi's default conversation history)",
|
|
1195
1118
|
handler: async (args, ctx) => {
|
|
@@ -1210,13 +1133,48 @@ export default function (pi: ExtensionAPI) {
|
|
|
1210
1133
|
if (settings["pi-mini-mode-minimal-show"]) nativeOutput = false;
|
|
1211
1134
|
mountMinimalOutput(ctx);
|
|
1212
1135
|
await persistSettings(ctx);
|
|
1213
|
-
// The mount already explains unsupported layouts; do not contradict it
|
|
1214
|
-
// with a success notification when only the preference was saved.
|
|
1215
1136
|
if (settings["pi-mini-mode-minimal-show"] && !restoreTranscript) return;
|
|
1216
1137
|
ctx.ui.notify(`${COPY.minimalState}${settings["pi-mini-mode-minimal-show"] ? "on" : "off"}`, "info");
|
|
1217
1138
|
},
|
|
1218
1139
|
});
|
|
1219
1140
|
|
|
1141
|
+
pi.registerCommand("pi-mini-mode-prompts", {
|
|
1142
|
+
description: "Expand or collapse a user prompt in fullscreen minimal output",
|
|
1143
|
+
handler: async (_args, ctx) => {
|
|
1144
|
+
if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
|
|
1145
|
+
if (ctx.hasUI) ctx.ui.notify("Prompt folding requires fullscreen minimal output.", "info");
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
const view = promptView;
|
|
1149
|
+
const choices = view.promptChoices();
|
|
1150
|
+
if (!choices.length) { ctx.ui.notify("No user prompts exceed four lines at this width.", "info"); return; }
|
|
1151
|
+
const labels = choices.map(choice => `${choice.index + 1}. ${choice.label} · ${preview(choice.question)}`);
|
|
1152
|
+
const selected = await ctx.ui.select("User prompts · Enter to toggle · Esc to cancel", labels);
|
|
1153
|
+
const choice = choices[labels.indexOf(selected ?? "")];
|
|
1154
|
+
if (choice && promptView === view) { view.togglePrompt(choice.index, choice.question); refreshMinimalOutput(); }
|
|
1155
|
+
},
|
|
1156
|
+
});
|
|
1157
|
+
pi.registerCommand("pi-mini-mode-tools", {
|
|
1158
|
+
description: "Expand or collapse a tool's saved text or thinking in fullscreen minimal output",
|
|
1159
|
+
handler: async (_args, ctx) => {
|
|
1160
|
+
if (ctx.mode !== "tui" || !restoreTranscript || !promptView) {
|
|
1161
|
+
if (ctx.hasUI) ctx.ui.notify("Tool folding requires fullscreen minimal output.", "info");
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
const view = promptView;
|
|
1165
|
+
const choices = view.toolChoices();
|
|
1166
|
+
if (!choices.length) { ctx.ui.notify("No visible tool calls. Ctrl+O shows older calls.", "info"); return; }
|
|
1167
|
+
const labels = choices.map((choice, index) => `${index + 1}. ${choice.expanded ? "收起" : "展开"} · ${preview(choice.title)}`);
|
|
1168
|
+
const selected = await ctx.ui.select("Tool results · Enter to toggle · Esc to cancel", labels);
|
|
1169
|
+
const choice = choices[labels.indexOf(selected ?? "")];
|
|
1170
|
+
if (choice && promptView === view) { view.toggleTool(choice.id); refreshMinimalOutput(); }
|
|
1171
|
+
},
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
pi.registerCommand("pi-mini-mode-settings", {
|
|
1175
|
+
description: "Configure Pi Mini Mode settings",
|
|
1176
|
+
handler: async (_args, ctx) => openSettings(ctx),
|
|
1177
|
+
});
|
|
1220
1178
|
pi.on("session_start", async (_event, ctx) => {
|
|
1221
1179
|
const loaded = await loadSettings(configPath);
|
|
1222
1180
|
settings = loaded.settings;
|
package/package.json
CHANGED