pi-one-ui 0.1.1 → 0.2.0
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 +66 -39
- package/extensions/{shell → app/commands}/settings-previews.ts +7 -7
- package/extensions/app/config/renderer.ts +13 -63
- package/extensions/app/config/shell.ts +24 -138
- package/extensions/app/config/store.ts +290 -0
- package/extensions/app/host/pi-extension-port.ts +25 -0
- package/extensions/app/host/pi-ui-port.ts +52 -0
- package/extensions/app/host/tui-capabilities.ts +27 -0
- package/extensions/app/overlay/input-router.ts +63 -0
- package/extensions/app/overlay/overlay-manager.ts +39 -0
- package/extensions/{shell → app/overlay}/selector-border.ts +3 -3
- package/extensions/app/overlay/selector-controller.ts +104 -0
- package/extensions/app/ownership/layout-registry.ts +65 -0
- package/extensions/app/ownership.ts +21 -7
- package/extensions/app/panel.ts +261 -140
- package/extensions/app/runtime/event-coordinator.ts +84 -0
- package/extensions/app/runtime/render-scheduler.ts +56 -0
- package/extensions/app/runtime/runtime-state.ts +83 -0
- package/extensions/app/runtime/tui-runtime.ts +546 -0
- package/extensions/features/{context.ts → context-inspector/index.ts} +30 -23
- package/extensions/features/{shell/flush-docked-bash.ts → flush-docked-bash.ts} +1 -4
- package/extensions/index.ts +2 -48
- package/extensions/layouts/context/index.ts +188 -0
- package/extensions/{shell → layouts/context/message}/user-message-styles.ts +2 -2
- package/extensions/{shell → layouts/context/message}/user-message.ts +2 -2
- package/extensions/{transcript → layouts/context}/renderer/compact-mode.ts +17 -13
- package/extensions/layouts/context/renderer/context-refresh.ts +79 -0
- package/extensions/{transcript → layouts/context}/renderer/default-mode.ts +3 -3
- package/extensions/{transcript → layouts/context}/renderer/index.ts +14 -14
- package/extensions/{transcript → layouts/context}/renderer/mouse/hover.ts +2 -2
- package/extensions/{transcript → layouts/context}/renderer/mouse/interaction.ts +26 -7
- package/extensions/{transcript → layouts/context}/renderer/mouse/layout.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/mouse/packets.ts +3 -3
- package/extensions/{transcript → layouts/context}/renderer/mouse/scroll.ts +12 -7
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-component.ts +2 -2
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-edit-render.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-highlight.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-layout.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-limits.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-palette.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-presentation.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-renderer.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-write-render.ts +1 -1
- package/extensions/{transcript → layouts/context}/renderer/tool/diff/index.ts +2 -2
- package/extensions/{transcript → layouts/context}/renderer/tool/grouping.ts +4 -4
- package/extensions/{transcript → layouts/context}/renderer/tool/message-display.ts +6 -4
- package/extensions/{transcript → layouts/context}/renderer/tool/names.ts +2 -2
- package/extensions/{transcript → layouts/context}/renderer/tool/result.ts +3 -3
- package/extensions/{features/agent-summary → layouts/context/summary}/core.ts +1 -1
- package/extensions/{features → layouts/context/thinking}/compact-thinking.ts +7 -7
- package/extensions/{shell → layouts/editor}/accent-rail-editor.ts +8 -8
- package/extensions/{shell → layouts/editor}/completion-menu.ts +3 -6
- package/extensions/layouts/editor/controller.ts +613 -0
- package/extensions/{shell → layouts/editor}/editor-metadata-format.ts +6 -3
- package/extensions/layouts/editor/factory.ts +159 -0
- package/extensions/layouts/editor/index.ts +16 -0
- package/extensions/{shell → layouts/editor}/minimalist-editor.ts +4 -4
- package/extensions/layouts/editor/ownership.ts +103 -0
- package/extensions/{shell → layouts/editor}/ui.ts +2 -2
- package/extensions/layouts/footer/controller.ts +392 -0
- package/extensions/layouts/footer/data.ts +41 -0
- package/extensions/{shell → layouts/footer}/extension-status.ts +2 -2
- package/extensions/{shell → layouts/footer}/footer-layout.ts +1 -1
- package/extensions/{shell → layouts/footer}/footer.ts +11 -8
- package/extensions/layouts/footer/index.ts +24 -0
- package/extensions/layouts/header/index.ts +5 -0
- package/extensions/{features/shell → layouts/header}/startup-header.ts +105 -19
- package/extensions/layouts/working-line/controller.ts +291 -0
- package/extensions/{shell → layouts/working-line}/interaction-summary.ts +3 -3
- package/extensions/{shell → layouts/working-line}/working-line-spinners.ts +1 -1
- package/extensions/{shell → layouts/working-line}/working-line.ts +4 -4
- package/extensions/{shell → services}/live-context.ts +29 -1
- package/extensions/services/project-refresh.ts +374 -0
- package/extensions/{shell → services}/project-state.ts +5 -5
- package/extensions/{shell/state.ts → services/session-state.ts} +75 -5
- package/extensions/{shell → shared}/format.ts +4 -4
- package/extensions/tools/component-tree.ts +6 -6
- package/package.json +4 -4
- package/extensions/shell/index.ts +0 -1659
- package/extensions/shell/project-refresh.ts +0 -130
- package/extensions/shell/settings-command.ts +0 -2144
- package/extensions/transcript/index.ts +0 -65
- package/extensions/transcript/renderer/transcript-refresh.ts +0 -79
- /package/extensions/{shell → app/ownership}/prototype-patch-registry.ts +0 -0
- /package/extensions/{shell → app/runtime}/session-lifecycle.ts +0 -0
- /package/extensions/features/{shell/aliases.ts → aliases.ts} +0 -0
- /package/extensions/features/{shell → legacy}/working-message.ts +0 -0
- /package/extensions/features/{reference → session-reference}/index.ts +0 -0
- /package/extensions/features/{reference → session-reference}/session.ts +0 -0
- /package/extensions/features/{reference/subagent.ts → subagent-autocomplete.ts} +0 -0
- /package/extensions/{shell → layouts/context/message}/user-message-osc.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/markdown-enhance.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/ATTRIBUTION.md +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/ansi-utils.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-header.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-inline.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-parse.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/diff-text.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/line-width-safety.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/shiki-highlight.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/diff/write-execution.ts +0 -0
- /package/extensions/{transcript → layouts/context}/renderer/tool/show-more-hint.ts +0 -0
- /package/extensions/{features/agent-summary → layouts/context/summary}/index.ts +0 -0
- /package/extensions/{shell → layouts/editor}/accent-rail-layout-patch.ts +0 -0
- /package/extensions/{shell → layouts/editor}/editor-transfer.ts +0 -0
- /package/extensions/{shell → layouts/footer}/footer-format.ts +0 -0
- /package/extensions/{shell → layouts/working-line}/working-line-messages.ts +0 -0
- /package/extensions/{shell/git.ts → services/git-data.ts} +0 -0
- /package/extensions/{shell/package-version.ts → services/package-data.ts} +0 -0
- /package/extensions/{shell/runtime.ts → services/runtime-data.ts} +0 -0
- /package/extensions/{shell → services}/telemetry.ts +0 -0
- /package/extensions/{shell → shared}/icons.ts +0 -0
- /package/extensions/{shell → shared}/style.ts +0 -0
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
visibleWidth,
|
|
6
6
|
type Keybinding,
|
|
7
7
|
} from "@earendil-works/pi-tui";
|
|
8
|
-
import { config } from "
|
|
9
|
-
import { isLazyProxyTui } from "
|
|
8
|
+
import { config } from "../../../../app/config/renderer.ts";
|
|
9
|
+
import { isLazyProxyTui } from "../../../../tools/fullscreen-detect.ts";
|
|
10
10
|
import { parseSgrMousePackets } from "./packets.ts";
|
|
11
11
|
import {
|
|
12
12
|
patchRegistry,
|
|
13
13
|
SCROLL_BUTTON_STATE_SLOT,
|
|
14
14
|
TOOL_MOUSE_TUI_SLOT,
|
|
15
|
-
} from "
|
|
15
|
+
} from "../../../../tools/patch-keys.ts";
|
|
16
16
|
|
|
17
17
|
const ZENTUI_PAGE_UP_INPUT =
|
|
18
18
|
/^\x1b\[5;9(?::[12])?~$|^\x1b\[57421;9(?::[12])?u$|^\x1b\[1;6A$/;
|
|
@@ -93,7 +93,9 @@ export function fullscreenLazyTui(tui: any): boolean {
|
|
|
93
93
|
return isLazyProxyTui(tui) && tui.mode === "fullscreen";
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Reports whether fullscreen output is following the bottom of the context.
|
|
98
|
+
*/
|
|
97
99
|
export function isFullscreenAtBottom(tui: any): boolean {
|
|
98
100
|
const following =
|
|
99
101
|
tui.isFollowingOutput ??
|
|
@@ -146,7 +148,10 @@ function isScrollNavigationInput(data: string): boolean {
|
|
|
146
148
|
);
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Reports whether the context is at the bottom for the detected TUI mode.
|
|
153
|
+
*/
|
|
154
|
+
function isAtContextBottom(tui: any): boolean {
|
|
150
155
|
// 惰性 Proxy fullscreen:官方 viewport 以 isFollowingOutput 判定是否在底部。
|
|
151
156
|
if (fullscreenLazyTui(tui)) return isFullscreenAtBottom(tui);
|
|
152
157
|
return true;
|
|
@@ -173,7 +178,7 @@ export function scheduleScrollButtonSync(tui: any, data: string): void {
|
|
|
173
178
|
scrollButtonSyncScheduled = false;
|
|
174
179
|
if (toolMouseTui !== tui) return;
|
|
175
180
|
// Pi renders on its own frame timer. Inspect the resulting viewport before
|
|
176
|
-
// showing the button so empty or non-scrollable
|
|
181
|
+
// showing the button so empty or non-scrollable contexts never flash it.
|
|
177
182
|
const rendered = tui.previousLines !== previousLines;
|
|
178
183
|
// fullscreen 下 isFollowingOutput 是即时状态,无需等待官方帧渲染。
|
|
179
184
|
if (!rendered && attempt < 4 && !fullscreenLazyTui(tui)) {
|
|
@@ -184,7 +189,7 @@ export function scheduleScrollButtonSync(tui: any, data: string): void {
|
|
|
184
189
|
}
|
|
185
190
|
return;
|
|
186
191
|
}
|
|
187
|
-
const nextVisible = !
|
|
192
|
+
const nextVisible = !isAtContextBottom(tui);
|
|
188
193
|
if (nextVisible !== getScrollButtonVisible()) {
|
|
189
194
|
setScrollButtonVisible(nextVisible);
|
|
190
195
|
tui.requestRender?.();
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
DEFAULT_TOOL_DISPLAY_CONFIG,
|
|
3
3
|
type DiffIndicatorMode,
|
|
4
4
|
type ToolDisplayConfig,
|
|
5
|
-
} from "
|
|
5
|
+
} from "../../../../../app/config/renderer.ts";
|
|
6
6
|
import type { DiffPresentationMode } from "./diff-presentation.ts";
|
|
7
|
-
import { RICH_DIFF_COMPONENT } from "
|
|
7
|
+
import { RICH_DIFF_COMPONENT } from "../../../../../tools/patch-keys.ts";
|
|
8
8
|
export { RICH_DIFF_COMPONENT };
|
|
9
9
|
|
|
10
10
|
/** Snapshot or live getter — panel changes must apply on the next paint. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Text, type Component } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { EditToolDetails } from "@earendil-works/pi-coding-agent";
|
|
3
|
-
import { sanitizeToolResultText } from "
|
|
3
|
+
import { sanitizeToolResultText } from "../../../../../tools/tool-result-sanitize.ts";
|
|
4
4
|
import {
|
|
5
5
|
getLineNumberWidth,
|
|
6
6
|
parseDiff,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
highlightCode,
|
|
4
4
|
} from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { sanitizeAnsiForThemedOutput } from "./ansi-utils.ts";
|
|
6
|
-
import { sanitizeToolResultText } from "
|
|
6
|
+
import { sanitizeToolResultText } from "../../../../../tools/tool-result-sanitize.ts";
|
|
7
7
|
import { MAX_HL_CHARS, shikiHighlightCache } from "./shiki-highlight.ts";
|
|
8
8
|
import { normalizeCodeWhitespace } from "./diff-text.ts";
|
|
9
9
|
import {
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
type SplitDiffRow,
|
|
32
32
|
} from "./diff-inline.ts";
|
|
33
33
|
import { formatMetaEntryRows } from "./diff-header.ts";
|
|
34
|
-
import type { DiffIndicatorMode } from "
|
|
34
|
+
import type { DiffIndicatorMode } from "../../../../../app/config/renderer.ts";
|
|
35
35
|
|
|
36
36
|
export interface RenderedRow {
|
|
37
37
|
text: string;
|
|
@@ -2,7 +2,7 @@ import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_TOOL_DISPLAY_CONFIG,
|
|
4
4
|
type ToolDisplayConfig,
|
|
5
|
-
} from "
|
|
5
|
+
} from "../../../../../app/config/renderer.ts";
|
|
6
6
|
import { showMoreHintText } from "../show-more-hint.ts";
|
|
7
7
|
import {
|
|
8
8
|
buildCollapsedDiffHintText,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
readSgrColorSequence,
|
|
6
6
|
toSgrParams,
|
|
7
7
|
} from "./ansi-utils.ts";
|
|
8
|
-
import { ansi256ToRgb } from "
|
|
8
|
+
import { ansi256ToRgb } from "../../../../../tools/ansi-color.ts";
|
|
9
9
|
import { fitToWidth } from "./diff-text.ts";
|
|
10
10
|
import { mergeSpans, type DiffSpan } from "./diff-inline.ts";
|
|
11
11
|
import type { DiffLineKind } from "./diff-parse.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
2
|
import { pluralize } from "./diff-text.ts";
|
|
3
|
-
import type { ToolDisplayConfig } from "
|
|
3
|
+
import type { ToolDisplayConfig } from "../../../../../app/config/renderer.ts";
|
|
4
4
|
|
|
5
5
|
export interface DiffSummaryStats {
|
|
6
6
|
added: number;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
visibleWidth,
|
|
5
5
|
type Component,
|
|
6
6
|
} from "@earendil-works/pi-tui";
|
|
7
|
-
import { sanitizeToolResultText } from "
|
|
7
|
+
import { sanitizeToolResultText } from "../../../../../tools/tool-result-sanitize.ts";
|
|
8
8
|
import { showMoreHintText } from "../show-more-hint.ts";
|
|
9
9
|
import { splitWriteContentLines } from "./diff-text.ts";
|
|
10
10
|
import {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
renderWriteDiffResult,
|
|
9
9
|
type DisplayConfigInput,
|
|
10
10
|
} from "./diff-renderer.ts";
|
|
11
|
-
import { DEFAULT_TOOL_DISPLAY_CONFIG } from "
|
|
11
|
+
import { DEFAULT_TOOL_DISPLAY_CONFIG } from "../../../../../app/config/renderer.ts";
|
|
12
12
|
import {
|
|
13
13
|
executeWriteWithMetadata,
|
|
14
14
|
WriteExecutionMetadataStore,
|
|
@@ -142,6 +142,6 @@ export {
|
|
|
142
142
|
type ToolDisplayConfig,
|
|
143
143
|
type DiffViewMode,
|
|
144
144
|
type DiffIndicatorMode,
|
|
145
|
-
} from "
|
|
145
|
+
} from "../../../../../app/config/renderer.ts";
|
|
146
146
|
export type { DisplayConfigInput } from "./diff-renderer.ts";
|
|
147
147
|
export { WriteExecutionMetadataStore } from "./write-execution.ts";
|
|
@@ -12,21 +12,21 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
TOOL_LOADING_INTERVAL_MS,
|
|
14
14
|
toolLoadingIcon,
|
|
15
|
-
} from "
|
|
15
|
+
} from "../../../../tools/tool-loading-icon.ts";
|
|
16
16
|
import { isToolTuiFullscreen, showMoreHintText } from "./show-more-hint.ts";
|
|
17
17
|
import {
|
|
18
18
|
stripAnsi,
|
|
19
19
|
stripBackgroundAnsi,
|
|
20
20
|
stripLeadingStatusIcon,
|
|
21
|
-
} from "
|
|
22
|
-
import { walkComponentTree } from "
|
|
21
|
+
} from "../../../../tools/ansi-text.ts";
|
|
22
|
+
import { walkComponentTree } from "../../../../tools/component-tree.ts";
|
|
23
23
|
import { humanizeToolLabel, toolCallSummary } from "./names.ts";
|
|
24
24
|
import {
|
|
25
25
|
patchRegistry,
|
|
26
26
|
TOOL_GROUPING_GENERATION_KEY as GENERATION_KEY,
|
|
27
27
|
TOOL_GROUPING_PARENT_KEY as PARENT_KEY,
|
|
28
28
|
TOOL_GROUPING_PATCH_KEY as PATCH_KEY,
|
|
29
|
-
} from "
|
|
29
|
+
} from "../../../../tools/patch-keys.ts";
|
|
30
30
|
|
|
31
31
|
const NON_GROUPABLE = new Set(["edit", "write", "apply_patch"]);
|
|
32
32
|
|
|
@@ -7,10 +7,10 @@ import { Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
|
7
7
|
import {
|
|
8
8
|
MESSAGE_DISPLAY_PATCH,
|
|
9
9
|
patchRegistry,
|
|
10
|
-
} from "
|
|
11
|
-
import { config } from "
|
|
10
|
+
} from "../../../../tools/patch-keys.ts";
|
|
11
|
+
import { config } from "../../../../app/config/renderer.ts";
|
|
12
12
|
import { showMoreHintText } from "./show-more-hint.ts";
|
|
13
|
-
import { walkComponentTree } from "
|
|
13
|
+
import { walkComponentTree } from "../../../../tools/component-tree.ts";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* 接管三个消息组件(`<skill>` 块、压缩摘要、分支摘要),ccstyle on 时渲染为
|
|
@@ -172,7 +172,9 @@ export function isMessageDisplayComponent(value: any): boolean {
|
|
|
172
172
|
);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Refreshes mounted context message components after a mode change.
|
|
177
|
+
*/
|
|
176
178
|
export function refreshMessageDisplays(root: any): void {
|
|
177
179
|
walkComponentTree(root, (value: any) => {
|
|
178
180
|
if (isMessageDisplayComponent(value)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { config } from "
|
|
2
|
-
import { oneLine } from "
|
|
1
|
+
import { config } from "../../../../app/config/renderer.ts";
|
|
2
|
+
import { oneLine } from "../../../../tools/format.ts";
|
|
3
3
|
|
|
4
4
|
function clip(value: unknown): string {
|
|
5
5
|
return oneLine(value, config.toolInputNameLength);
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
wrapTextWithAnsi,
|
|
6
6
|
} from "@earendil-works/pi-tui";
|
|
7
7
|
import { inspect } from "node:util";
|
|
8
|
-
import { config } from "
|
|
8
|
+
import { config } from "../../../../app/config/renderer.ts";
|
|
9
9
|
import { showMoreHintText } from "./show-more-hint.ts";
|
|
10
10
|
import {
|
|
11
11
|
TOOL_LOADING_INTERVAL_MS,
|
|
12
12
|
toolLoadingIcon,
|
|
13
|
-
} from "
|
|
14
|
-
import { sanitizeToolResultText } from "
|
|
13
|
+
} from "../../../../tools/tool-loading-icon.ts";
|
|
14
|
+
import { sanitizeToolResultText } from "../../../../tools/tool-result-sanitize.ts";
|
|
15
15
|
|
|
16
16
|
const TOOL_VIEWPORT_WIDTH_RATIO = 0.8;
|
|
17
17
|
|
|
@@ -24,19 +24,19 @@ import {
|
|
|
24
24
|
Text,
|
|
25
25
|
type Component,
|
|
26
26
|
} from "@earendil-works/pi-tui";
|
|
27
|
-
import { isToolTuiFullscreen } from "../
|
|
27
|
+
import { isToolTuiFullscreen } from "../renderer/tool/show-more-hint.ts";
|
|
28
28
|
import {
|
|
29
29
|
animateCompactThinkingText,
|
|
30
30
|
formatThoughtDuration,
|
|
31
31
|
styleCompactThinkingText,
|
|
32
|
-
} from "../
|
|
33
|
-
import {
|
|
32
|
+
} from "../renderer/compact-mode.ts";
|
|
33
|
+
import { refreshMountedContext } from "../renderer/context-refresh.ts";
|
|
34
34
|
import {
|
|
35
35
|
COMPACT_THINKING_OWNER,
|
|
36
36
|
COMPACT_THINKING_PATCH_KEY,
|
|
37
37
|
patchRegistry,
|
|
38
38
|
PROTOTYPE_ORIGINAL_KEY,
|
|
39
|
-
} from "
|
|
39
|
+
} from "../../../tools/patch-keys.ts";
|
|
40
40
|
// 保持导出兼容:渲染函数已并入 renderer/compact-mode.ts,这里 re-export。
|
|
41
41
|
export {
|
|
42
42
|
animateCompactThinkingText,
|
|
@@ -1089,15 +1089,15 @@ function compactThinking(pi: ExtensionAPI) {
|
|
|
1089
1089
|
|
|
1090
1090
|
// pi 在 reload/resume 时先于 session_start 用原始原型重建聊天组件
|
|
1091
1091
|
// (rebuildChatFromMessages / renderCurrentSessionState)。由共享的
|
|
1092
|
-
//
|
|
1092
|
+
// refreshMountedContext 扫描挂载树重绘这些组件,恢复 compact 渲染、
|
|
1093
1093
|
// 持久化时长与工具调用显示。
|
|
1094
|
-
|
|
1094
|
+
refreshMountedContext(activeTui);
|
|
1095
1095
|
activeTui?.requestRender(true);
|
|
1096
1096
|
});
|
|
1097
1097
|
|
|
1098
1098
|
pi.on("session_tree", (_event, ctx) => {
|
|
1099
1099
|
restoreDurationEntries(ctx.sessionManager.getBranch(), completedDurations);
|
|
1100
|
-
|
|
1100
|
+
refreshMountedContext(activeTui);
|
|
1101
1101
|
activeTui?.requestRender(true);
|
|
1102
1102
|
});
|
|
1103
1103
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
applyOwnedLayoutBackground,
|
|
5
5
|
fillTerminalLine,
|
|
6
6
|
renderCompletionRows,
|
|
7
7
|
} from "./completion-menu.ts";
|
|
8
|
-
import type { ZentuiConfig } from "
|
|
8
|
+
import type { ZentuiConfig } from "../../app/config/shell.ts";
|
|
9
9
|
import { sanitizeEditorMetadataText } from "./editor-metadata-format.ts";
|
|
10
10
|
import {
|
|
11
11
|
renderStyleForSourceOrFallback,
|
|
12
12
|
type SourceStyleFallback,
|
|
13
|
-
} from "
|
|
13
|
+
} from "../../shared/style.ts";
|
|
14
14
|
|
|
15
15
|
export const ACCENT_RAIL_CHROME_WIDTH = 2;
|
|
16
16
|
|
|
@@ -90,17 +90,17 @@ export function renderAccentRailEditorFrame({
|
|
|
90
90
|
];
|
|
91
91
|
const transparent =
|
|
92
92
|
config.components.editor.styles["accent-rail"].transparent;
|
|
93
|
-
const
|
|
93
|
+
const layout = rows.map((line) => {
|
|
94
94
|
const railCell = transparent
|
|
95
95
|
? rail
|
|
96
|
-
:
|
|
96
|
+
: applyOwnedLayoutBackground(uiTheme, rail);
|
|
97
97
|
const bodyText = ` ${fillTerminalLine(line, contentWidth)}`;
|
|
98
98
|
const body = transparent
|
|
99
99
|
? bodyText
|
|
100
|
-
:
|
|
100
|
+
: applyOwnedLayoutBackground(uiTheme, bodyText);
|
|
101
101
|
return `${railCell}${body}`;
|
|
102
102
|
});
|
|
103
|
-
const
|
|
103
|
+
const autocompleteLayout = renderCompletionRows({
|
|
104
104
|
lines: autocompleteLines,
|
|
105
105
|
width,
|
|
106
106
|
theme: uiTheme,
|
|
@@ -108,5 +108,5 @@ export function renderAccentRailEditorFrame({
|
|
|
108
108
|
ownedBackground: !transparent,
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
return clampLines([...
|
|
111
|
+
return clampLines([...layout, ...autocompleteLayout], width);
|
|
112
112
|
}
|
|
@@ -70,10 +70,7 @@ export function fillTerminalLine(content: string, width: number): string {
|
|
|
70
70
|
return `${truncated}${" ".repeat(Math.max(0, width - renderedWidth))}`;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export function
|
|
74
|
-
theme: Theme,
|
|
75
|
-
text: string,
|
|
76
|
-
): string {
|
|
73
|
+
export function applyOwnedLayoutBackground(theme: Theme, text: string): string {
|
|
77
74
|
try {
|
|
78
75
|
const background = theme.getBgAnsi("userMessageBg");
|
|
79
76
|
const restored = text.replace(SGR_SEQUENCE, (sequence) =>
|
|
@@ -136,7 +133,7 @@ export function renderCompletionRows({
|
|
|
136
133
|
width,
|
|
137
134
|
);
|
|
138
135
|
const surfaced = ownedBackground
|
|
139
|
-
?
|
|
136
|
+
? applyOwnedLayoutBackground(theme, content)
|
|
140
137
|
: content;
|
|
141
138
|
return truncateTerminalLine(surfaced, width);
|
|
142
139
|
});
|
|
@@ -176,7 +173,7 @@ export function renderCompletionPalette({
|
|
|
176
173
|
return [...rows, truncateToWidth(separator, safeWidth, "")];
|
|
177
174
|
const helpText = fillTerminalLine(helpLabel(safeWidth), safeWidth);
|
|
178
175
|
const help = ownedBackground
|
|
179
|
-
?
|
|
176
|
+
? applyOwnedLayoutBackground(theme, helpText)
|
|
180
177
|
: helpText;
|
|
181
178
|
return [
|
|
182
179
|
...rows,
|