pi-polish 0.1.5 → 0.1.7
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 -12
- package/extensions/tools.ts +5 -4
- package/package.json +1 -1
package/extensions/chrome.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AssistantMessageComponent, CustomEditor, type ExtensionAPI, UserMessageComponent } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { Markdown, MouseRegion, Spacer, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
3
|
-
import { shortCommand } from "./command.ts";
|
|
4
3
|
|
|
5
4
|
const PROMPT = "❯";
|
|
6
5
|
const REPLY = "●";
|
|
@@ -90,28 +89,28 @@ export default function (pi: ExtensionAPI) {
|
|
|
90
89
|
const stats = `(${secs}s · ↓ ${fmtTokens(tokens + Math.round(streamed / 4))} tokens)`;
|
|
91
90
|
ctx.ui.setWorkingMessage(`${ORANGE}${phase}…${RESET} ${DIM}${stats}${RESET}`);
|
|
92
91
|
};
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
// Just the verb for tools that pi-polish draws as live rows, which already show what is running;
|
|
93
|
+
// other extensions' tools keep their name, since their rows may not
|
|
94
|
+
const toolPhase = (name: string) => {
|
|
95
95
|
switch (name) {
|
|
96
96
|
case "bash":
|
|
97
|
-
return
|
|
97
|
+
return "Running";
|
|
98
98
|
case "read":
|
|
99
|
-
return
|
|
99
|
+
return "Reading";
|
|
100
100
|
case "edit":
|
|
101
|
-
return
|
|
101
|
+
return "Editing";
|
|
102
102
|
case "write":
|
|
103
|
-
return
|
|
103
|
+
return "Writing";
|
|
104
104
|
case "grep":
|
|
105
105
|
case "find":
|
|
106
|
-
|
|
106
|
+
case "tool_search":
|
|
107
|
+
return "Searching";
|
|
107
108
|
case "bg_run":
|
|
108
109
|
return "Starting a background job";
|
|
109
110
|
case "questionnaire":
|
|
110
111
|
return "Waiting for your answer";
|
|
111
|
-
case "tool_search":
|
|
112
|
-
return "Searching tools";
|
|
113
112
|
default:
|
|
114
|
-
return name.startsWith("mcp__") ?
|
|
113
|
+
return name.startsWith("mcp__") ? "Calling" : `Running ${name}`;
|
|
115
114
|
}
|
|
116
115
|
};
|
|
117
116
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -142,7 +141,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
142
141
|
});
|
|
143
142
|
pi.on("tool_execution_start", async (event, ctx) => {
|
|
144
143
|
if (!ctx.hasUI) return;
|
|
145
|
-
phase = toolPhase(event.toolName
|
|
144
|
+
phase = toolPhase(event.toolName);
|
|
146
145
|
show(ctx);
|
|
147
146
|
});
|
|
148
147
|
pi.on("tool_execution_end", async () => {
|
package/extensions/tools.ts
CHANGED
|
@@ -448,7 +448,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
448
448
|
|
|
449
449
|
const tick = (group: Group) => {
|
|
450
450
|
const running = group.members.some((m) => !m.done);
|
|
451
|
-
if (running && !group.timer) group.timer = setInterval(() => rowInvalidate.get(group.members[0].id)?.(),
|
|
451
|
+
if (running && !group.timer) group.timer = setInterval(() => rowInvalidate.get(group.members[0].id)?.(), 1000);
|
|
452
452
|
if (!running && group.timer) {
|
|
453
453
|
clearInterval(group.timer);
|
|
454
454
|
group.timer = undefined;
|
|
@@ -550,14 +550,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
550
550
|
if (running) {
|
|
551
551
|
const secs = Math.round((Date.now() - group.started) / 1000);
|
|
552
552
|
const active = [...group.members].reverse().find((m) => !m.done) ?? group.members[group.members.length - 1];
|
|
553
|
-
// The dot pulses
|
|
554
|
-
const pulse =
|
|
553
|
+
// The dot pulses once a second while the group runs, in step with the seconds counter
|
|
554
|
+
const pulse = secs % 2 ? "dim" : "accent";
|
|
555
555
|
const head = theme.fg(pulse, `${MARK} `) + theme.fg("toolTitle", `${summary(group, true)}…`) + theme.fg("dim", ` · ${secs}s`) + failNote;
|
|
556
556
|
return oneLine([head, theme.fg("dim", ` └ ${active.label}`)]);
|
|
557
557
|
}
|
|
558
558
|
// Finished rows go quiet, like Claude Code's: dim text, with a red ● only when something failed
|
|
559
559
|
const mark = failed ? theme.fg("error", `${MARK} `) : " ";
|
|
560
|
-
|
|
560
|
+
// Always the summary, even for one call ("Ran 1 shell command"), like Claude Code; ctrl+o shows each one
|
|
561
|
+
const text = summary(group, false);
|
|
561
562
|
return oneLine([mark + theme.fg("dim", text)], failNote);
|
|
562
563
|
};
|
|
563
564
|
|