pi-polish 0.1.2 → 0.1.3
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/chrome.ts +11 -7
- package/package.json +1 -1
package/extensions/chrome.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssistantMessageComponent, CustomEditor, type ExtensionAPI, UserMessageComponent } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { Markdown } from "@earendil-works/pi-tui";
|
|
2
|
+
import { Markdown, MouseRegion, Spacer, Text } from "@earendil-works/pi-tui";
|
|
3
3
|
|
|
4
4
|
const PROMPT = "❯";
|
|
5
5
|
const REPLY = "●";
|
|
@@ -26,16 +26,20 @@ function patchOnce(proto: any, method: string, wrap: (original: (...args: any[])
|
|
|
26
26
|
|
|
27
27
|
export default function (pi: ExtensionAPI) {
|
|
28
28
|
try {
|
|
29
|
-
// Drop hidden thinking blocks entirely instead of rendering a "Thinking..." line plus spacers
|
|
30
29
|
patchOnce(AssistantMessageComponent.prototype, "updateContent", (original) =>
|
|
31
30
|
function (this: any, message: any, ...rest: any[]) {
|
|
32
31
|
// Two columns of padding so reply text lines up behind the ● marker, like tool rows
|
|
33
32
|
this.outputPad = Math.max(this.outputPad ?? 1, 2);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
original.call(this, message, ...rest);
|
|
34
|
+
// Hidden thinking draws nothing instead of a "Thinking..." line plus spacers. Its rows stay in place,
|
|
35
|
+
// so extensions that read pi's layout, like pi-stereo-view, still match it
|
|
36
|
+
// A block collapsed by clicking it while thinking is shown keeps its line, so it can be clicked open again
|
|
37
|
+
const children: any[] = this.hideThinkingBlock ? (this.contentContainer?.children ?? []) : [];
|
|
38
|
+
children.forEach((child, i) => {
|
|
39
|
+
if (!(child instanceof MouseRegion) || !((child as any).child instanceof Text)) return;
|
|
40
|
+
const spacer = [children[i + 1], children[i - 1]].find((c) => c instanceof Spacer);
|
|
41
|
+
for (const row of [child, spacer]) if (row) row.render = () => [];
|
|
42
|
+
});
|
|
39
43
|
// Text blocks are the Markdown children without a default style; thinking blocks carry one
|
|
40
44
|
for (const child of this.contentContainer?.children ?? []) {
|
|
41
45
|
if (!(child instanceof Markdown) || (child as any).defaultTextStyle !== undefined || (child as any)[patched]) continue;
|