pi-cc-extensions 0.8.20 → 0.8.21
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DynamicBorder, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { renderDialogHeader, renderDialogTopBorder } from "../../closable-dialog.ts";
|
|
3
2
|
import { type Component, Container, type Input, Spacer } from "@earendil-works/pi-tui";
|
|
4
3
|
import type { QuestionnaireState } from "../state/state.js";
|
|
5
4
|
import type { QuestionData } from "../tool/types.js";
|
|
@@ -134,25 +133,10 @@ export class DialogView implements StatefulView<DialogProps> {
|
|
|
134
133
|
// Render only the active tab's natural content; blank height equalization would
|
|
135
134
|
// unnecessarily consume transcript rows above this full-width editor component.
|
|
136
135
|
const natural = this.buildContainerFromStrategy(strategy, headingRowCache).render(width);
|
|
137
|
-
if (natural.length > 0) {
|
|
138
|
-
natural[0] = renderDialogTopBorder(width, (text) => this.config.theme.fg("accent", text));
|
|
139
|
-
natural.splice(
|
|
140
|
-
1,
|
|
141
|
-
0,
|
|
142
|
-
renderDialogHeader(
|
|
143
|
-
" Questions",
|
|
144
|
-
width,
|
|
145
|
-
(text) => this.config.theme.fg("accent", text),
|
|
146
|
-
(text) => this.config.theme.fg("toolTitle", text),
|
|
147
|
-
(text) => this.config.theme.fg("muted", text),
|
|
148
|
-
false,
|
|
149
|
-
),
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
136
|
|
|
153
137
|
// Fixed region sizes (deterministic from structure).
|
|
154
138
|
// TabBar.render() returns [tabLine, ""] — always 2 rows.
|
|
155
|
-
const topFixed =
|
|
139
|
+
const topFixed = 1 + (this.config.isMulti && this.config.tabBar ? 2 : 0) + 1;
|
|
156
140
|
const bottomFixed = 1 + strategy.footerRowCount;
|
|
157
141
|
const middleRows = natural.length - topFixed - bottomFixed;
|
|
158
142
|
|
|
@@ -794,7 +794,6 @@ type ToolRenderHit = {
|
|
|
794
794
|
|
|
795
795
|
const TOOL_MOUSE_WIDGET_KEY = "ccstyle-tool-mouse";
|
|
796
796
|
const TOOL_MOUSE_ENABLE = "\x1b[?1000h\x1b[?1003h\x1b[?1006h";
|
|
797
|
-
const TOOL_MOUSE_HOVER_ENABLE = "\x1b[?1003h\x1b[?1006h";
|
|
798
797
|
const TOOL_MOUSE_DISABLE = "\x1b[?1006l\x1b[?1003l\x1b[?1000l";
|
|
799
798
|
const ZENTUI_PAGE_UP_INPUT = /^\x1b\[5;9(?::[12])?~$|^\x1b\[57421;9(?::[12])?u$|^\x1b\[1;6A$/;
|
|
800
799
|
const ZENTUI_PAGE_DOWN_INPUT = /^\x1b\[6;9(?::[12])?~$|^\x1b\[57422;9(?::[12])?u$|^\x1b\[1;6B$/;
|
|
@@ -817,7 +816,6 @@ let pendingScrollMessages = 0;
|
|
|
817
816
|
let assistantMessageActive = false;
|
|
818
817
|
let scrollButtonSyncScheduled = false;
|
|
819
818
|
let sessionRenderTimer: ReturnType<typeof setTimeout> | null = null;
|
|
820
|
-
let hoveredToolSummaryRow: number | null = null;
|
|
821
819
|
let hoveredToolCallId: string | null = null;
|
|
822
820
|
|
|
823
821
|
function parseSgrMousePackets(data: string): SgrMousePacket[] | null {
|
|
@@ -1448,19 +1446,10 @@ function tryOpenToolIoShowMore(tui: any, packet: SgrMousePacket, hit: ToolRender
|
|
|
1448
1446
|
|
|
1449
1447
|
function updateToolSummaryHover(tui: any, packet: SgrMousePacket): void {
|
|
1450
1448
|
if ((packet.code & 32) === 0 || packet.final !== "M") return;
|
|
1451
|
-
const
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
-
: (Number.isFinite(tui?.previousViewportTop) ? tui.previousViewportTop : 0) + packet.row - 1;
|
|
1455
|
-
const line = stripTerminalSequences(String(previousLines[lineIndex] ?? ""));
|
|
1456
|
-
const hit = COLLAPSED_TOOL_SUMMARY.test(line) ? findToolAtScreenRow(tui, packet.row) : null;
|
|
1457
|
-
const nextRow = hit && !hit.component.expanded ? packet.row : null;
|
|
1458
|
-
const nextToolCallId = nextRow ? (hit?.component?.toolCallId ?? null) : null;
|
|
1459
|
-
if (nextRow === hoveredToolSummaryRow && nextToolCallId === hoveredToolCallId) return;
|
|
1460
|
-
hoveredToolSummaryRow = nextRow;
|
|
1449
|
+
const hit = findToolAtScreenRow(tui, packet.row);
|
|
1450
|
+
const nextToolCallId = hit && !hit.component.expanded ? hit.component.toolCallId : null;
|
|
1451
|
+
if (nextToolCallId === hoveredToolCallId) return;
|
|
1461
1452
|
hoveredToolCallId = nextToolCallId;
|
|
1462
|
-
// Collapsed result components read hoveredToolCallId during render. Keeping
|
|
1463
|
-
// hover in the render path avoids an async TUI repaint overwriting raw ANSI.
|
|
1464
1453
|
tui.requestRender?.();
|
|
1465
1454
|
}
|
|
1466
1455
|
|
|
@@ -1612,7 +1601,6 @@ function teardownToolMouseInteraction(): void {
|
|
|
1612
1601
|
}
|
|
1613
1602
|
toolMouseInputUnsubscribe?.();
|
|
1614
1603
|
toolMouseInputUnsubscribe = null;
|
|
1615
|
-
hoveredToolSummaryRow = null;
|
|
1616
1604
|
hoveredToolCallId = null;
|
|
1617
1605
|
try {
|
|
1618
1606
|
toolMouseTui?.terminal?.write?.(TOOL_MOUSE_DISABLE);
|
|
@@ -1653,7 +1641,7 @@ export function installToolMouseInteraction(
|
|
|
1653
1641
|
toolMouseTui = tui;
|
|
1654
1642
|
if (fixedEditorFeatures) patchToolMouseInputCapture(tui);
|
|
1655
1643
|
// Motion reporting is required for hover in both native and fixed-editor layouts.
|
|
1656
|
-
tui?.terminal?.write?.(fixedEditorFeatures ? TOOL_MOUSE_ENABLE :
|
|
1644
|
+
tui?.terminal?.write?.(fixedEditorFeatures ? TOOL_MOUSE_ENABLE : "\x1b[?1003h\x1b[?1006h");
|
|
1657
1645
|
const widget = {
|
|
1658
1646
|
render: (width: number) => renderScrollButton(width, theme),
|
|
1659
1647
|
invalidate() {},
|
|
@@ -2244,8 +2232,7 @@ function createCcstyleTool(
|
|
|
2244
2232
|
);
|
|
2245
2233
|
}
|
|
2246
2234
|
if (context?.state) context.state.ccstyleIoView = undefined;
|
|
2247
|
-
const toolCallId =
|
|
2248
|
-
context?.toolCallId ?? context?.id ?? context?.state?.toolCallId ?? context?.state?.id;
|
|
2235
|
+
const toolCallId = context?.toolCallId;
|
|
2249
2236
|
const summary = theme.fg(
|
|
2250
2237
|
isError ? "error" : "muted",
|
|
2251
2238
|
renderCollapsedToolResult(rendered, hint),
|
|
@@ -2254,8 +2241,10 @@ function createCcstyleTool(
|
|
|
2254
2241
|
render(width: number) {
|
|
2255
2242
|
const line = truncateToWidth(summary, width, "…");
|
|
2256
2243
|
if (!toolCallId || hoveredToolCallId !== toolCallId) return [line];
|
|
2257
|
-
const
|
|
2258
|
-
return [
|
|
2244
|
+
const highlighted = line.replace(/\x1b\[0m/g, "\x1b[0;7m");
|
|
2245
|
+
return [
|
|
2246
|
+
`\x1b[7m${highlighted}${" ".repeat(Math.max(0, width - visibleWidth(line)))}\x1b[0m`,
|
|
2247
|
+
];
|
|
2259
2248
|
},
|
|
2260
2249
|
invalidate() {},
|
|
2261
2250
|
};
|
|
@@ -14,17 +14,14 @@ export function renderDialogHeader(
|
|
|
14
14
|
color: (text: string) => string,
|
|
15
15
|
titleColor: (text: string) => string,
|
|
16
16
|
closeColor: (text: string) => string,
|
|
17
|
-
showClose = true,
|
|
18
17
|
): string {
|
|
19
18
|
const safeWidth = Math.max(8, Math.floor(width));
|
|
20
19
|
const innerWidth = safeWidth - 2;
|
|
21
|
-
const button =
|
|
22
|
-
const titleWidth = Math.max(0, innerWidth - visibleWidth(button) -
|
|
20
|
+
const button = "[ × ]";
|
|
21
|
+
const titleWidth = Math.max(0, innerWidth - visibleWidth(button) - 2);
|
|
23
22
|
const shownTitle = truncateToWidth(title, titleWidth, "…");
|
|
24
|
-
const gap = " ".repeat(
|
|
25
|
-
|
|
26
|
-
);
|
|
27
|
-
return `${color("│")}${titleColor(shownTitle)}${gap}${showClose ? closeColor(button) : ""}${color("│")}`;
|
|
23
|
+
const gap = " ".repeat(Math.max(1, innerWidth - visibleWidth(shownTitle) - visibleWidth(button)));
|
|
24
|
+
return `${color("│")}${titleColor(shownTitle)}${gap}${closeColor(button)}${color("│")}`;
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
/** Match a left-button press anywhere on the [ × ] target. */
|
package/package.json
CHANGED