pi-cc-extensions 0.9.6 → 0.9.8
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/feature/shell/working-message.ts +21 -2
- package/extensions/renderer/compact-mode.ts +588 -78
- package/extensions/renderer/default-mode.ts +2 -0
- package/extensions/renderer/index.ts +24 -6
- package/extensions/renderer/mouse/scroll.ts +43 -4
- package/extensions/renderer/tool/diff/index.ts +45 -8
- package/extensions/renderer/tool/names.ts +1 -1
- package/extensions/utils/ansi-text.ts +29 -0
- package/extensions/utils/fullscreen-detect.ts +51 -0
- package/extensions/utils/patch-keys.ts +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { getCompactRunStatusText } from "../../renderer/compact-mode.ts";
|
|
3
|
+
import {
|
|
4
|
+
fullscreenLazyTui,
|
|
5
|
+
getToolMouseTui,
|
|
6
|
+
isFullscreenAtBottom,
|
|
7
|
+
} from "../../renderer/mouse/scroll.ts";
|
|
2
8
|
import { formatDuration } from "../../utils/format.ts";
|
|
3
9
|
|
|
4
10
|
const REFRESH_INTERVAL_MS = 1_000;
|
|
@@ -84,11 +90,24 @@ export default function (pi: ExtensionAPI): void {
|
|
|
84
90
|
if (output > 0) providerOutputTokens = output;
|
|
85
91
|
}
|
|
86
92
|
|
|
93
|
+
/**
|
|
94
|
+
* 摘要行滚出视口才镜像:仅 fullscreen 且已离开 transcript 底部。
|
|
95
|
+
* regular 没有“离开底部”信号(transcript 在终端回滚区),保持 Pi 默认文案。
|
|
96
|
+
*/
|
|
97
|
+
function compactMirrorText(): string | undefined {
|
|
98
|
+
const tui = getToolMouseTui();
|
|
99
|
+
if (!tui || !fullscreenLazyTui(tui) || isFullscreenAtBottom(tui)) return undefined;
|
|
100
|
+
return getCompactRunStatusText();
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
function buildWorkingMessage(): string {
|
|
88
|
-
const elapsed = Date.now() - (agentStartTime || turnStartTime);
|
|
89
|
-
const tokens = tokenCount();
|
|
90
104
|
const parts: string[] = [];
|
|
105
|
+
const tokens = tokenCount();
|
|
91
106
|
if (tokens > 0) parts.push(`↓ ${formatCount(tokens)} tokens`);
|
|
107
|
+
// compact 活动回合且已滚出摘要行:直接用摘要行文案(自带回合时长,不叠 agent 计时)。
|
|
108
|
+
const compactStatus = compactMirrorText();
|
|
109
|
+
if (compactStatus) return [compactStatus, ...parts].join(" · ");
|
|
110
|
+
const elapsed = Date.now() - (agentStartTime || turnStartTime);
|
|
92
111
|
if (elapsed >= SHOW_TIMER_AFTER_MS || tokens > 0) {
|
|
93
112
|
// formatDuration 低于 1 秒返回 "",此处回退 "0s" 保持计时器连续跳动。
|
|
94
113
|
parts.push(formatDuration(elapsed) || "0s");
|