pi-polish 0.1.5 → 0.1.6

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,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
- const toolPhase = (name: string, args: any) => {
94
- const path = String(args?.path ?? "").split("/").pop();
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 `Running ${shortCommand(String(args?.command ?? ""), process.cwd()).slice(0, 60)}`;
97
+ return "Running";
98
98
  case "read":
99
- return `Reading ${path}`;
99
+ return "Reading";
100
100
  case "edit":
101
- return `Editing ${path}`;
101
+ return "Editing";
102
102
  case "write":
103
- return `Writing ${path}`;
103
+ return "Writing";
104
104
  case "grep":
105
105
  case "find":
106
- return `Searching for ${String(args?.pattern ?? "").slice(0, 40)}`;
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__") ? `Calling ${name.split("__")[1]}/${name.split("__").slice(2).join("__")}` : `Running ${name}`;
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, event.args);
144
+ phase = toolPhase(event.toolName);
146
145
  show(ctx);
147
146
  });
148
147
  pi.on("tool_execution_end", async () => {
@@ -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)?.(), 500);
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,8 +550,8 @@ 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 every half second while the group runs, like a cursor blink
554
- const pulse = Math.floor(Date.now() / 500) % 2 ? "dim" : "accent";
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-polish",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "author": "Thomas van Dongen",
6
6
  "type": "module",