@herbertgao/pi-extensions 2026.10.5 → 2026.10.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/README.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +5 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +22 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +2 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +131 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +2 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +10 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/token-rate.ts +15 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +2 -23
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +105 -55
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +23 -471
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +6 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +16 -83
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +53 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ask-user-question.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +467 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +1 -24
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +53 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +41 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +2 -862
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +735 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-state.ts +138 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +5 -4
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +2 -2
- package/node_modules/@herbertgao/pi-subagents/package.json +2 -1
- package/node_modules/@herbertgao/sol-pi/README.md +3 -3
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +4 -4
- package/node_modules/@herbertgao/sol-pi/agents-install.md +3 -3
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +1 -1
- package/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/show-more-hint.ts +0 -48
package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Text, truncateToWidth, visibleWidth, type Component } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { ToolDisplayConfig } from "../../../config/config.ts";
|
|
3
3
|
import { sanitizeToolResultText } from "../../../utils/tool-result-sanitize.ts";
|
|
4
|
-
import { showMoreHintText } from "../
|
|
4
|
+
import { showMoreHintText } from "../names.ts";
|
|
5
5
|
import { splitWriteContentLines } from "./diff-text.ts";
|
|
6
6
|
import {
|
|
7
7
|
collectDiffStats,
|
package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeDiffRenderWidth } from "./diff-presentation.ts";
|
|
2
2
|
import { pluralize } from "./diff-text.ts";
|
|
3
|
-
import { showMoreHintText } from "../
|
|
3
|
+
import { showMoreHintText } from "../names.ts";
|
|
4
4
|
|
|
5
5
|
export interface WidthMeasurementOps {
|
|
6
6
|
measure(text: string): number;
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./codemode.ts";
|
|
23
23
|
import { getToolMouseTui } from "../mouse/scroll.ts";
|
|
24
24
|
import { mcpToolTitle } from "./mcp-title.ts";
|
|
25
|
-
import { collapseHintText, isToolTuiFullscreen, showMoreHintText } from "./
|
|
25
|
+
import { collapseHintText, isToolTuiFullscreen, showMoreHintText } from "./names.ts";
|
|
26
26
|
import { stripAnsi, stripBackgroundAnsi, stripLeadingStatusIcon } from "../../utils/ansi-text.ts";
|
|
27
27
|
import { walkComponentTree } from "../../utils/component-tree.ts";
|
|
28
28
|
import {
|
|
@@ -33,12 +33,8 @@ import {
|
|
|
33
33
|
toolCallSummary,
|
|
34
34
|
type ToolCallSummary,
|
|
35
35
|
} from "./names.ts";
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
headTruncateToWidth,
|
|
39
|
-
isLiveToolCall,
|
|
40
|
-
toolViewportWidth,
|
|
41
|
-
} from "./result.ts";
|
|
36
|
+
import { formatToolDuration, headTruncateToWidth, toolViewportWidth } from "./result.ts";
|
|
37
|
+
import { isLiveToolCall } from "./tool-state.ts";
|
|
42
38
|
import {
|
|
43
39
|
patchRegistry,
|
|
44
40
|
TOOL_GROUPING_GENERATION_KEY as GENERATION_KEY,
|
|
@@ -279,6 +275,53 @@ function shellResultTail(
|
|
|
279
275
|
return duration ? ` ${fg("dim", `· ${duration}`)}` : "";
|
|
280
276
|
}
|
|
281
277
|
|
|
278
|
+
/** 分组折叠态的一行子工具:`├/└` + 状态图标 + 与组内同一套摘要。 */
|
|
279
|
+
function collapsedGroupToolLine(
|
|
280
|
+
tool: any,
|
|
281
|
+
last: boolean,
|
|
282
|
+
fg: (color: string, text: string) => string,
|
|
283
|
+
width: number,
|
|
284
|
+
): string {
|
|
285
|
+
const toolStatus = status(tool);
|
|
286
|
+
const color = toolStatus === "pending" ? "accent" : toolStatus;
|
|
287
|
+
const summary = askUserResultSummary(tool) ?? codemodeResultSummary(tool) ?? toolSummary(tool);
|
|
288
|
+
const prefix = ` ${fg("dim", last ? "└" : "├")} ${fg(color, statusIcon(toolStatus))} `;
|
|
289
|
+
const detail = fg("dim", summary.detail);
|
|
290
|
+
const result = shellResultTail(tool, fg, toolStatus);
|
|
291
|
+
const rowWidth = toolViewportWidth(width);
|
|
292
|
+
const mainWidth = Math.max(
|
|
293
|
+
0,
|
|
294
|
+
rowWidth - visibleWidth(prefix) - visibleWidth(detail) - visibleWidth(result),
|
|
295
|
+
);
|
|
296
|
+
return truncateToWidth(
|
|
297
|
+
`${prefix}${renderToolSummary(summary, mainWidth, fg)}${detail}${result}`,
|
|
298
|
+
rowWidth,
|
|
299
|
+
"",
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
type GroupHeaderCounts = { pending: number; success: number; error: number };
|
|
304
|
+
|
|
305
|
+
/** 组头计数:`2 done · 1 failed`。没有计数时返回空串。 */
|
|
306
|
+
function groupCountText(
|
|
307
|
+
counts: GroupHeaderCounts,
|
|
308
|
+
fg: (color: string, text: string) => string,
|
|
309
|
+
): string {
|
|
310
|
+
return (["pending", "success", "error"] as const)
|
|
311
|
+
.filter((key) => counts[key])
|
|
312
|
+
.map((key) => {
|
|
313
|
+
const label = key === "pending" ? "running" : key === "success" ? "done" : "failed";
|
|
314
|
+
const color = key === "pending" ? "accent" : key;
|
|
315
|
+
return `${fg(color, String(counts[key]))} ${label}`;
|
|
316
|
+
})
|
|
317
|
+
.join(` ${fg("dim", "·")} `);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** 组头圆点色:有失败取 error,否则有运行中取 accent,否则 success。 */
|
|
321
|
+
function groupOverallStatus(counts: GroupHeaderCounts): ToolStatus {
|
|
322
|
+
return counts.error ? "error" : counts.pending ? "pending" : "success";
|
|
323
|
+
}
|
|
324
|
+
|
|
282
325
|
/**
|
|
283
326
|
* 组头的工具列表:名称用与单组标题、子行同一套人性化写法,次数一律带上(各跑一次也报 ×1)。
|
|
284
327
|
* 同名(同显示标题)的合并成一项,避免 `MCP call×1, MCP call×1` 这种重复。
|
|
@@ -451,17 +494,10 @@ export class ToolGroupComponent extends Container {
|
|
|
451
494
|
const fg = (color: string, text: string) => theme?.fg?.(color, text) ?? text;
|
|
452
495
|
const counts = { pending: 0, success: 0, error: 0 };
|
|
453
496
|
for (const tool of this.children) counts[status(tool)]++;
|
|
454
|
-
const countText = (
|
|
455
|
-
.filter((key) => counts[key])
|
|
456
|
-
.map((key) => {
|
|
457
|
-
const label = key === "pending" ? "running" : key === "success" ? "done" : "failed";
|
|
458
|
-
const color = key === "pending" ? "accent" : key;
|
|
459
|
-
return `${fg(color, String(counts[key]))} ${label}`;
|
|
460
|
-
})
|
|
461
|
-
.join(` ${fg("dim", "·")} `);
|
|
497
|
+
const countText = groupCountText(counts, fg);
|
|
462
498
|
const names = new Set(this.children.map(toolName));
|
|
463
499
|
const label = names.size === 1 ? toolTitle(this.children[0]) : "Multiple Tools";
|
|
464
|
-
const overall
|
|
500
|
+
const overall = groupOverallStatus(counts);
|
|
465
501
|
if ((this.children as any[]).some(isAnimatingTool)) scheduleGroupAnimation(this.patch);
|
|
466
502
|
const overallColor = overall === "pending" ? "accent" : overall;
|
|
467
503
|
// 圆点保持 dim;hover 只高亮可点击文字。
|
|
@@ -506,24 +542,7 @@ export class ToolGroupComponent extends Container {
|
|
|
506
542
|
const branch = index === total - 1 ? "└" : "├";
|
|
507
543
|
const continuation = index === total - 1 ? " " : "│ ";
|
|
508
544
|
if (!this._expanded) {
|
|
509
|
-
|
|
510
|
-
askUserResultSummary(tool) ?? codemodeResultSummary(tool) ?? toolSummary(tool);
|
|
511
|
-
const prefix = ` ${fg("dim", branch)} ${fg(color, statusIcon(toolStatus))} `;
|
|
512
|
-
const detail = fg("dim", summary.detail);
|
|
513
|
-
const result = shellResultTail(tool, fg, toolStatus);
|
|
514
|
-
// 与单工具卡标题同宽,宽屏右侧留白一致
|
|
515
|
-
const rowWidth = toolViewportWidth(width);
|
|
516
|
-
const mainWidth = Math.max(
|
|
517
|
-
0,
|
|
518
|
-
rowWidth - visibleWidth(prefix) - visibleWidth(detail) - visibleWidth(result),
|
|
519
|
-
);
|
|
520
|
-
lines.push(
|
|
521
|
-
truncateToWidth(
|
|
522
|
-
`${prefix}${renderToolSummary(summary, mainWidth, fg)}${detail}${result}`,
|
|
523
|
-
rowWidth,
|
|
524
|
-
"",
|
|
525
|
-
),
|
|
526
|
-
);
|
|
545
|
+
lines.push(collapsedGroupToolLine(tool, index === total - 1, fg, width));
|
|
527
546
|
continue;
|
|
528
547
|
}
|
|
529
548
|
const rendered = visibleLines(Array.isArray(childPaints?.[index]) ? childPaints[index] : []);
|
package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
7
7
|
import { MESSAGE_DISPLAY_PATCH, patchRegistry } from "../../utils/patch-keys.ts";
|
|
8
8
|
import { config } from "../../config/config.ts";
|
|
9
|
-
import { showMoreHintText } from "./
|
|
9
|
+
import { showMoreHintText } from "./names.ts";
|
|
10
10
|
import { walkComponentTree } from "../../utils/component-tree.ts";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { posix, win32 } from "node:path";
|
|
2
2
|
import type { ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
3
|
+
import { getKeybindings, visibleWidth } from "@earendil-works/pi-tui";
|
|
4
4
|
import { config } from "../../config/config.ts";
|
|
5
5
|
import { oneLine } from "../../utils/format.ts";
|
|
6
6
|
import { headTruncateToWidth } from "./result.ts";
|
|
@@ -427,3 +427,43 @@ export function renderToolSummary(
|
|
|
427
427
|
? `${fg("toolTitle", title)}${fg("dim", headTruncateToWidth(` ${summary.payload}`, room))}`
|
|
428
428
|
: fg("toolTitle", title);
|
|
429
429
|
}
|
|
430
|
+
|
|
431
|
+
let toolTuiFullscreen: boolean | undefined;
|
|
432
|
+
|
|
433
|
+
export function setToolTuiFullscreen(value: boolean): void {
|
|
434
|
+
toolTuiFullscreen = value;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export function isToolTuiFullscreen(): boolean {
|
|
438
|
+
return toolTuiFullscreen !== false;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function formatKeyPart(part: string): string {
|
|
442
|
+
// 与 pi 内置 keybinding-hints 一致:macOS 上 alt 显示为 option
|
|
443
|
+
return process.platform === "darwin" && part.toLowerCase() === "alt" ? "option" : part;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** 默认展开快捷键(app.tools.expand)显示文本;未配置时回退 ctrl+o。 */
|
|
447
|
+
export function expandShortcutText(): string {
|
|
448
|
+
const keys = getKeybindings().getKeys("app.tools.expand");
|
|
449
|
+
if (keys.length === 0) return "ctrl+o";
|
|
450
|
+
return keys
|
|
451
|
+
.join("/")
|
|
452
|
+
.split("/")
|
|
453
|
+
.map((part) => part.split("+").map(formatKeyPart).join("+"))
|
|
454
|
+
.join("/");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export function showMoreHintText(): string {
|
|
458
|
+
return isToolTuiFullscreen() ? "click to show more" : `${expandShortcutText()} to show more`;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** 展开卡的收起提示,与折叠态 showMoreHintText 同一位置对称。 */
|
|
462
|
+
export function collapseHintText(): string {
|
|
463
|
+
return isToolTuiFullscreen() ? "↑ Collapse" : `${expandShortcutText()} to collapse`;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** 该行是否带展开态收起提示(用于展开卡的 hint hover 命中)。 */
|
|
467
|
+
export function isCollapseHintLine(plainLine: string): boolean {
|
|
468
|
+
return plainLine.includes(collapseHintText());
|
|
469
|
+
}
|