@pi-kaush/pi-tool-call-markers 0.3.2 → 0.3.4
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 +7 -5
- package/package.json +1 -1
- package/src/index.ts +14 -9
- package/src/muted.ts +14 -0
package/README.md
CHANGED
|
@@ -15,14 +15,16 @@ Restart Pi or run `/reload`.
|
|
|
15
15
|
Collapsed tool rows use semantic theme colors with no gear, background fill, box padding, or filled blank rows:
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
│ Read
|
|
19
|
+
│ src/a.ts 42 lines
|
|
20
|
+
│ src/b.ts 18 lines
|
|
21
|
+
│
|
|
22
|
+
│ Bash
|
|
23
|
+
│ $: npm test → done
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
- **Two-column outer inset.** Tool markers and image output align with an inset conversation surface. Very narrow terminals reduce the decoration before useful content.
|
|
24
|
-
-
|
|
25
|
-
- **`•` grouped children.** Bullets appear only for members of a multi-call group.
|
|
27
|
+
- **`│` tool-call rail.** Single calls use a rail beside the summary. Multi-call groups extend it through bold tool-name headings, indented call summaries, and separators between tool types.
|
|
26
28
|
- **Semantic, low-contrast status.** Tool names are emphasized, summaries and settled metadata are muted, pending state is warning-colored, and failures remain error-colored. Ordinary tool states have no background.
|
|
27
29
|
- **Width-safe outcome tails.** Long summaries truncate before useful tails such as `→ done`, `→ 42 lines`, `→ +2/-1`, or a `bash` duration.
|
|
28
30
|
- **Stable running groups.** Adjacent calls group as they appear. Pending state and elapsed `bash` time settle into the final outcome without changing the row count.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
} from "./bash-block.ts";
|
|
17
17
|
import { runChatContainerHooks } from "./container-hooks.ts";
|
|
18
18
|
import { installInfoVisibility } from "./info-visibility.ts";
|
|
19
|
-
import { fgCollapsed } from "./muted.ts";
|
|
19
|
+
import { fgCollapsed, fgCollapsedRail } from "./muted.ts";
|
|
20
20
|
|
|
21
21
|
const OUTER_INSET = 2;
|
|
22
|
-
const GROUP_MARKER = "%";
|
|
23
22
|
const SUBAGENT_MARKER = "↪";
|
|
23
|
+
const GROUP_CALL_MARKER = "│";
|
|
24
24
|
const PRESENTATION_PATCHED = Symbol.for("kg.pi.toolPresentation.v3");
|
|
25
25
|
const LEGACY_PRESENTATION_PATCHED = Symbol.for("kg.pi.toolPresentation.v2");
|
|
26
26
|
const GROUPING_PATCHED = Symbol.for("kg.pi.toolGrouping.v1");
|
|
@@ -932,11 +932,10 @@ function collapsedHeadline(
|
|
|
932
932
|
// Failed rows render entirely in error so the row reads as the one that
|
|
933
933
|
// failed, not just its outcome tail. Only the tool name is bold.
|
|
934
934
|
const tone = rowHasFailed(row) ? "error" : "muted";
|
|
935
|
-
const marker =
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
)} `;
|
|
935
|
+
const marker =
|
|
936
|
+
row.toolName === "subagent"
|
|
937
|
+
? `${fgCollapsed(theme, tone, SUBAGENT_MARKER)} `
|
|
938
|
+
: `${fgCollapsedRail(theme, tone, GROUP_CALL_MARKER)} `;
|
|
940
939
|
const budget = Math.max(1, width - visibleWidth(marker));
|
|
941
940
|
const label = collapsedCallLabel(row, budget, theme, tone);
|
|
942
941
|
const outcome = collapsedOutcome(row, budget, theme);
|
|
@@ -1293,14 +1292,20 @@ function renderGroupedCallLines(
|
|
|
1293
1292
|
const lines: string[] = [];
|
|
1294
1293
|
const toolName = row.toolName ?? "tool";
|
|
1295
1294
|
if (toolName !== previousToolName) {
|
|
1295
|
+
// Keep the rail unbroken across subgroup spacing and put each bold
|
|
1296
|
+
// tool name beside it. The separator belongs to the new row so
|
|
1297
|
+
// click-routing heights stay aligned with the rendered lines.
|
|
1298
|
+
if (previousToolName !== undefined) {
|
|
1299
|
+
lines.push(fgCollapsedRail(theme, "muted", GROUP_CALL_MARKER));
|
|
1300
|
+
}
|
|
1296
1301
|
lines.push(
|
|
1297
|
-
`${
|
|
1302
|
+
`${fgCollapsedRail(theme, "muted", GROUP_CALL_MARKER)} ${fgCollapsed(theme, "toolTitle", toolName, true)}`,
|
|
1298
1303
|
);
|
|
1299
1304
|
previousToolName = toolName;
|
|
1300
1305
|
}
|
|
1301
1306
|
|
|
1302
1307
|
const color = rowHasFailed(row) ? "error" : "muted";
|
|
1303
|
-
const prefix =
|
|
1308
|
+
const prefix = `${fgCollapsedRail(theme, color, GROUP_CALL_MARKER)} `;
|
|
1304
1309
|
const budget = Math.max(1, width - visibleWidth(prefix));
|
|
1305
1310
|
const label = groupedChildLabel(row, budget, theme, color);
|
|
1306
1311
|
const outcome = collapsedOutcome(row, budget, theme);
|
package/src/muted.ts
CHANGED
|
@@ -78,3 +78,17 @@ export function fgCollapsed(
|
|
|
78
78
|
}
|
|
79
79
|
return theme.fg(color, bold && theme.bold ? theme.bold(text) : text);
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
// Decoration rails recede further than collapsed text. No palette token is
|
|
83
|
+
// guaranteed lighter than the collapsed color (e.g. catppuccin-latte's `dim`
|
|
84
|
+
// resolves to the same overlay0 as syntaxComment), so apply the terminal's
|
|
85
|
+
// faint attribute: it lightens toward the background on light themes and
|
|
86
|
+
// darkens on dark ones. Error rails keep their full-strength semantic red.
|
|
87
|
+
export function fgCollapsedRail(
|
|
88
|
+
theme: CollapsedTheme,
|
|
89
|
+
color: string,
|
|
90
|
+
text: string,
|
|
91
|
+
): string {
|
|
92
|
+
const styled = fgCollapsed(theme, color, text);
|
|
93
|
+
return color === "error" ? styled : `\x1b[2m${styled}\x1b[22m`;
|
|
94
|
+
}
|