@pi-kaush/pi-tool-call-markers 0.3.2 → 0.3.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/README.md +7 -4
- package/package.json +1 -1
- package/src/index.ts +8 -2
- package/src/muted.ts +14 -0
package/README.md
CHANGED
|
@@ -16,13 +16,16 @@ Collapsed tool rows use semantic theme colors with no gear, background fill, box
|
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
18
|
% Read
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
- **`%` tool headings.** A singleton stays on one line when its summary and outcome fit. A multi-call group has one `%` heading per contiguous tool type.
|
|
25
|
-
-
|
|
27
|
+
- **`%` tool headings.** A singleton stays on one line when its summary and outcome fit. A multi-call group has one `%` heading per contiguous tool type, with a blank line before each subsequent heading.
|
|
28
|
+
- **`│` grouped children.** A vertical rail — fainter than the call text — spans the members of a multi-call group; singletons carry no rail.
|
|
26
29
|
- **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
30
|
- **Width-safe outcome tails.** Long summaries truncate before useful tails such as `→ done`, `→ 42 lines`, `→ +2/-1`, or a `bash` duration.
|
|
28
31
|
- **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,12 @@ 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
22
|
const GROUP_MARKER = "%";
|
|
23
23
|
const SUBAGENT_MARKER = "↪";
|
|
24
|
+
const GROUP_CALL_MARKER = "│";
|
|
24
25
|
const PRESENTATION_PATCHED = Symbol.for("kg.pi.toolPresentation.v3");
|
|
25
26
|
const LEGACY_PRESENTATION_PATCHED = Symbol.for("kg.pi.toolPresentation.v2");
|
|
26
27
|
const GROUPING_PATCHED = Symbol.for("kg.pi.toolGrouping.v1");
|
|
@@ -1293,6 +1294,11 @@ function renderGroupedCallLines(
|
|
|
1293
1294
|
const lines: string[] = [];
|
|
1294
1295
|
const toolName = row.toolName ?? "tool";
|
|
1295
1296
|
if (toolName !== previousToolName) {
|
|
1297
|
+
// One blank line between tool-name subgroups, mirroring the block's
|
|
1298
|
+
// leading blank so each `%` heading starts its own visual run. The
|
|
1299
|
+
// blank belongs to the new run's first row, keeping the per-member
|
|
1300
|
+
// click-routing heights aligned with the drawn lines.
|
|
1301
|
+
if (previousToolName !== undefined) lines.push("");
|
|
1296
1302
|
lines.push(
|
|
1297
1303
|
`${fgCollapsed(theme, "muted", GROUP_MARKER)} ${fgCollapsed(theme, "toolTitle", toolName, true)}`,
|
|
1298
1304
|
);
|
|
@@ -1300,7 +1306,7 @@ function renderGroupedCallLines(
|
|
|
1300
1306
|
}
|
|
1301
1307
|
|
|
1302
1308
|
const color = rowHasFailed(row) ? "error" : "muted";
|
|
1303
|
-
const prefix = ` ${
|
|
1309
|
+
const prefix = ` ${fgCollapsedRail(theme, color, GROUP_CALL_MARKER)} `;
|
|
1304
1310
|
const budget = Math.max(1, width - visibleWidth(prefix));
|
|
1305
1311
|
const label = groupedChildLabel(row, budget, theme, color);
|
|
1306
1312
|
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
|
+
}
|