pi-cc-extensions 0.8.67 → 0.8.68
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.en.md +2 -2
- package/README.md +2 -2
- package/extensions/config/config.ts +7 -7
- package/extensions/config/panel.ts +10 -10
- package/extensions/feature/agent-summary/core.ts +2 -2
- package/extensions/feature/agent-summary/index.ts +1 -1
- package/extensions/feature/shell/flush-docked-bash.ts +36 -0
- package/extensions/index.ts +2 -0
- package/extensions/renderer/tool/names.ts +1 -1
- package/extensions/utils/patch-keys.ts +1 -0
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -62,13 +62,13 @@ Run `/reload` after installation.
|
|
|
62
62
|
"writeDiffCollapsedLines": 0, // write collapse lines; 0 = creation summary only
|
|
63
63
|
"diffWordWrap": true, // wrap long diff lines
|
|
64
64
|
"expandedPreviewMaxLines": 40, // max lines for expanded bodies
|
|
65
|
-
"
|
|
65
|
+
"inputClip": 100, // tool summary path/command clip length
|
|
66
66
|
|
|
67
67
|
// thinking
|
|
68
68
|
"useSummaryTitlesAsThinkingTitle": true, // use latest summary as thinking title
|
|
69
69
|
"previewLines": 3, // preview lines; 0 hides
|
|
70
70
|
"animationIntervalMs": 90, // title animation interval (ms)
|
|
71
|
-
"dimThinkingText": false,
|
|
71
|
+
"dimThinkingText": false, // dim thinking body text
|
|
72
72
|
|
|
73
73
|
// ui
|
|
74
74
|
"showStartupHeader": true, // startup header (logo + tips) toggle
|
package/README.md
CHANGED
|
@@ -62,13 +62,13 @@ pi install git:github.com/minuque/pi-cc-extensions
|
|
|
62
62
|
"writeDiffCollapsedLines": 0, // write 折叠行数,0 仅显示创建摘要
|
|
63
63
|
"diffWordWrap": true, // 长 diff 行换行
|
|
64
64
|
"expandedPreviewMaxLines": 40, // 展开正文最大行数
|
|
65
|
-
"
|
|
65
|
+
"inputClip": 100, // 工具摘要 path/command 折叠字符数
|
|
66
66
|
|
|
67
67
|
// thinking
|
|
68
68
|
"useSummaryTitlesAsThinkingTitle": true, // 用最新摘要作思考标题
|
|
69
69
|
"previewLines": 3, // 预览行数,0 隐藏
|
|
70
70
|
"animationIntervalMs": 90, // 标题动画间隔(毫秒)
|
|
71
|
-
"dimThinkingText": false,
|
|
71
|
+
"dimThinkingText": false, // thinking 正文用 dim 色
|
|
72
72
|
|
|
73
73
|
// ui
|
|
74
74
|
"showStartupHeader": true, // 启动头(logo + tips)开关
|
|
@@ -52,7 +52,7 @@ export type Config = {
|
|
|
52
52
|
writeDiffCollapsedLines: number;
|
|
53
53
|
diffWordWrap: boolean;
|
|
54
54
|
expandedPreviewMaxLines: number;
|
|
55
|
-
|
|
55
|
+
inputClip: number;
|
|
56
56
|
useSummaryTitlesAsThinkingTitle: boolean;
|
|
57
57
|
previewLines: number;
|
|
58
58
|
animationIntervalMs: number;
|
|
@@ -79,7 +79,7 @@ export const WRITE_DIFF_COLLAPSED_LINES_VALUES = ["0", "4", "8", "12", "24", "36
|
|
|
79
79
|
/** Presets for expanded body height — keep low options first so cycling stays TUI-friendly. */
|
|
80
80
|
export const EXPANDED_PREVIEW_MAX_LINES_VALUES = ["40", "60", "80", "120", "200", "500", "2000"];
|
|
81
81
|
/** 工具摘要里 path/command 等输入的折叠字符数。 */
|
|
82
|
-
export const
|
|
82
|
+
export const INPUT_CLIP_VALUES = ["40", "60", "80", "100", "120", "160"];
|
|
83
83
|
export const THINKING_PREVIEW_LINES_VALUES = ["0", "1", "3", "5", "10"];
|
|
84
84
|
export const THINKING_ANIMATION_INTERVAL_VALUES = ["40", "60", "90", "120", "180"];
|
|
85
85
|
/** fullscreen 滚轮步进行数预设。 */
|
|
@@ -107,7 +107,7 @@ export const DEFAULT_CONFIG: Config = {
|
|
|
107
107
|
writeDiffCollapsedLines: DEFAULT_TOOL_DISPLAY_CONFIG.writeDiffCollapsedLines,
|
|
108
108
|
diffWordWrap: DEFAULT_TOOL_DISPLAY_CONFIG.diffWordWrap,
|
|
109
109
|
expandedPreviewMaxLines: DEFAULT_TOOL_DISPLAY_CONFIG.expandedPreviewMaxLines,
|
|
110
|
-
|
|
110
|
+
inputClip: 100,
|
|
111
111
|
useSummaryTitlesAsThinkingTitle: true,
|
|
112
112
|
previewLines: 3,
|
|
113
113
|
animationIntervalMs: 90,
|
|
@@ -194,9 +194,9 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
194
194
|
10,
|
|
195
195
|
50_000,
|
|
196
196
|
),
|
|
197
|
-
|
|
198
|
-
source.toolInputNameLength,
|
|
199
|
-
DEFAULT_CONFIG.
|
|
197
|
+
inputClip: pickPositiveInt(
|
|
198
|
+
source.inputClip ?? source.toolInputNameLength,
|
|
199
|
+
DEFAULT_CONFIG.inputClip,
|
|
200
200
|
8,
|
|
201
201
|
500,
|
|
202
202
|
),
|
|
@@ -258,7 +258,7 @@ export function formatConfigStatus(source: Config = config): string {
|
|
|
258
258
|
`writeCollapsed=${source.writeDiffCollapsedLines}`,
|
|
259
259
|
`diffWordWrap=${source.diffWordWrap ? "on" : "off"}`,
|
|
260
260
|
`expandedMax=${source.expandedPreviewMaxLines}`,
|
|
261
|
-
`
|
|
261
|
+
`inputClip=${source.inputClip}`,
|
|
262
262
|
`thinkingTitle=${source.useSummaryTitlesAsThinkingTitle ? "summary" : "default"}`,
|
|
263
263
|
`thinkingPreview=${source.previewLines}`,
|
|
264
264
|
`thinkingAnimation=${source.animationIntervalMs}ms`,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
SCROLL_STEP_LINES_VALUES,
|
|
26
26
|
THINKING_ANIMATION_INTERVAL_VALUES,
|
|
27
27
|
THINKING_PREVIEW_LINES_VALUES,
|
|
28
|
-
|
|
28
|
+
INPUT_CLIP_VALUES,
|
|
29
29
|
WRITE_DIFF_COLLAPSED_LINES_VALUES,
|
|
30
30
|
updateConfig,
|
|
31
31
|
type CompactStyleMode,
|
|
@@ -264,15 +264,15 @@ export async function showCcstylePanel(
|
|
|
264
264
|
);
|
|
265
265
|
},
|
|
266
266
|
};
|
|
267
|
-
const
|
|
268
|
-
id: "
|
|
267
|
+
const inputClipSetting = {
|
|
268
|
+
id: "inputClip",
|
|
269
269
|
label: "Input clip",
|
|
270
270
|
description:
|
|
271
271
|
"Max characters for path/command/name in single and grouped tool summaries. Enter to type a custom value.",
|
|
272
|
-
currentValue: String(config.
|
|
273
|
-
values: [...
|
|
272
|
+
currentValue: String(config.inputClip),
|
|
273
|
+
values: [...INPUT_CLIP_VALUES],
|
|
274
274
|
submenu: (_current: string, closeSubmenu: (selected?: string) => void) =>
|
|
275
|
-
buildNumberInputSubmenu(theme,
|
|
275
|
+
buildNumberInputSubmenu(theme, inputClipSetting, closeSubmenu),
|
|
276
276
|
};
|
|
277
277
|
const diffViewSetting = {
|
|
278
278
|
id: "diffViewMode",
|
|
@@ -452,11 +452,11 @@ export async function showCcstylePanel(
|
|
|
452
452
|
return;
|
|
453
453
|
}
|
|
454
454
|
switch (id) {
|
|
455
|
-
case "
|
|
455
|
+
case "inputClip":
|
|
456
456
|
updateConfig({
|
|
457
|
-
|
|
457
|
+
inputClip: pickPositiveInt(value, DEFAULT_CONFIG.inputClip, 8, 500),
|
|
458
458
|
});
|
|
459
|
-
|
|
459
|
+
inputClipSetting.currentValue = String(config.inputClip);
|
|
460
460
|
break;
|
|
461
461
|
case "mode": {
|
|
462
462
|
// 选项值带 Experimental 标记,选择后还原为真实 mode 值。
|
|
@@ -581,7 +581,7 @@ export async function showCcstylePanel(
|
|
|
581
581
|
writeDiffCollapsedSetting,
|
|
582
582
|
diffWordWrapSetting,
|
|
583
583
|
expandedMaxSetting,
|
|
584
|
-
|
|
584
|
+
inputClipSetting,
|
|
585
585
|
],
|
|
586
586
|
},
|
|
587
587
|
{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent 回合摘要:统计一次 agent 运行的工具使用并格式化成摘要文本。
|
|
3
3
|
*
|
|
4
4
|
* 分类:bash / read / edit / write / other(精确工具名;MCP 风格名归 other)。
|
|
5
|
-
* 计数:bash 按调用次数;read/edit/write 按非空 path/file_path 去重;other 按调用次数。
|
|
5
|
+
* 计数:bash/powershell 按调用次数;read/edit/write 按非空 path/file_path 去重;other 按调用次数。
|
|
6
6
|
* 失败单独累计;另记回合耗时。
|
|
7
7
|
*
|
|
8
8
|
* 呈现:`summaryLine` 纯文本,`summaryMarkdown` Markdown(可 box 引用块)。
|
|
@@ -28,7 +28,7 @@ export type AgentSummaryData = {
|
|
|
28
28
|
|
|
29
29
|
export function classifyTool(toolName: string): AgentToolCategory {
|
|
30
30
|
const base = toolName.split(".").pop() ?? toolName;
|
|
31
|
-
if (base === "bash") return "bash";
|
|
31
|
+
if (base === "bash" || base === "powershell") return "bash";
|
|
32
32
|
if (base === "read") return "read";
|
|
33
33
|
if (base === "edit") return "edit";
|
|
34
34
|
if (base === "write") return "write";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent 回合摘要展示:agent_end 时把本回合工具统计写入会话条目,
|
|
3
3
|
* 由 entry renderer 渲染为 markdown 引用块 `> [!TIP] *斜体内容*`。
|
|
4
4
|
*
|
|
5
|
-
* 统计复用 ./core.ts(bash/read/edit/write/other)。
|
|
5
|
+
* 统计复用 ./core.ts(bash|powershell/read/edit/write/other)。
|
|
6
6
|
* appendEntry 不进 LLM 上下文,只显示在聊天区。
|
|
7
7
|
* 引用块文字色取主题 mdQuote(cc 主题下为 muted 灰),内容用 *斜体* 语法。
|
|
8
8
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fullscreen 下 ! / !! 在 agent 仍 streaming 时挂到 dock(pendingMessages)。
|
|
3
|
+
* 官方只在下次普通 submit 才 flushPendingBashComponents,命令结束后卡钉在输入框上方。
|
|
4
|
+
* 在 handleBashCommand 收尾补一次 flush。
|
|
5
|
+
*/
|
|
6
|
+
import { InteractiveMode } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { FLUSH_DOCKED_BASH_PATCH, patchRegistry } from "../../utils/patch-keys.ts";
|
|
8
|
+
|
|
9
|
+
type Patch = {
|
|
10
|
+
active: boolean;
|
|
11
|
+
prototype: any;
|
|
12
|
+
original: (...args: any[]) => unknown;
|
|
13
|
+
installed: (...args: any[]) => unknown;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function installFlushDockedBash(): void {
|
|
17
|
+
const prototype = InteractiveMode.prototype as any;
|
|
18
|
+
const previous = patchRegistry.get<Patch>(FLUSH_DOCKED_BASH_PATCH);
|
|
19
|
+
if (previous) previous.active = false;
|
|
20
|
+
const original =
|
|
21
|
+
previous && prototype.handleBashCommand === previous.installed
|
|
22
|
+
? previous.original
|
|
23
|
+
: prototype.handleBashCommand;
|
|
24
|
+
const patch: Patch = {
|
|
25
|
+
active: true,
|
|
26
|
+
prototype,
|
|
27
|
+
original,
|
|
28
|
+
installed: async function (this: any, ...args: any[]) {
|
|
29
|
+
const result = await original.apply(this, args);
|
|
30
|
+
if (patch.active) this.flushPendingBashComponents();
|
|
31
|
+
return result;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
prototype.handleBashCommand = patch.installed;
|
|
35
|
+
patchRegistry.install(FLUSH_DOCKED_BASH_PATCH, patch);
|
|
36
|
+
}
|
package/extensions/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { config } from "./config/config.ts";
|
|
|
3
3
|
|
|
4
4
|
// shell
|
|
5
5
|
import piAliases from "./feature/shell/aliases.ts";
|
|
6
|
+
import { installFlushDockedBash } from "./feature/shell/flush-docked-bash.ts";
|
|
6
7
|
import piStartupHeader from "./feature/shell/startup-header.ts";
|
|
7
8
|
import workingMessage from "./feature/shell/working-message.ts";
|
|
8
9
|
|
|
@@ -20,6 +21,7 @@ import markdownEnhance from "./renderer/markdown-enhance.ts";
|
|
|
20
21
|
export default function (pi: ExtensionAPI): void {
|
|
21
22
|
// shell chrome
|
|
22
23
|
if (config.enableAliases) piAliases(pi);
|
|
24
|
+
installFlushDockedBash();
|
|
23
25
|
piStartupHeader(pi);
|
|
24
26
|
if (config.enableWorkingMessage) workingMessage(pi);
|
|
25
27
|
|
|
@@ -48,6 +48,7 @@ export const TOOL_GROUPING_GENERATION_KEY = Symbol.for("pi.ccstyle.tool-grouping
|
|
|
48
48
|
export const TOOL_MOUSE_OWNER_KEY = Symbol.for("pi.ccstyle.tool-mouse-owner");
|
|
49
49
|
export const TOOL_MOUSE_TUI_SLOT = Symbol.for("pi.ccstyle.tool-mouse-tui");
|
|
50
50
|
export const SCROLL_BUTTON_STATE_SLOT = Symbol.for("pi.ccstyle.scroll-button-state");
|
|
51
|
+
export const FLUSH_DOCKED_BASH_PATCH = Symbol.for("pi.ccstyle.flush-docked-bash-patch");
|
|
51
52
|
export const TOOL_HOVER_STATE_KEY = Symbol.for("pi.ccstyle.tool-hover-state");
|
|
52
53
|
|
|
53
54
|
// ── rich diff 组件标记 ──
|