@pi-kaush/pi-tool-call-markers 0.2.5 → 0.2.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/CHANGELOG.md +1 -0
- package/package.json +1 -1
- package/src/index.ts +7 -50
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Render every collapsed tool call as a `% tool: call → outcome` line with the tool name bolded — one marker per call, no bullets, no blank lines between sections; grouped blocks share only their leading blank row (supersedes the nested sub-heading layout).
|
|
5
6
|
- Render subagent calls as an unboxed plan — `% subagent` heading with chain/parallel counts and numbered steps as they execute, agent names in accent with emojis scraped from the native plan component (args fallback) — replacing the accent-rail card; failed subagents follow the full-red failure tone.
|
|
6
7
|
- Strip display sequences and control bytes (notably `\r` from progress writers like git) from collapsed-row text so command output cannot return the cursor to column 0 and overwrite the row.
|
|
7
8
|
- Color the truncation ellipsis to match its row tone (`muted` settled, `error` failed) instead of the terminal default foreground left by pi-tui's truncation reset.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -756,9 +756,10 @@ function styledCallLabel(
|
|
|
756
756
|
const plain = sanitizeInline(stripAnsi(label)).trim();
|
|
757
757
|
const match = /^(\S+)(.*)$/s.exec(plain);
|
|
758
758
|
if (!match) return theme.fg(color, plain);
|
|
759
|
+
const rest = match[2] ?? "";
|
|
759
760
|
return (
|
|
760
761
|
theme.fg(color, theme.bold(match[1] ?? "")) +
|
|
761
|
-
theme.fg(color,
|
|
762
|
+
(rest ? theme.fg(color, `:${rest}`) : "")
|
|
762
763
|
);
|
|
763
764
|
}
|
|
764
765
|
|
|
@@ -805,9 +806,9 @@ function collapsedHeadline(
|
|
|
805
806
|
theme: ThemeLike,
|
|
806
807
|
): string {
|
|
807
808
|
// Failed rows render entirely in error so the row reads as the one that
|
|
808
|
-
// failed, not just its outcome tail.
|
|
809
|
+
// failed, not just its outcome tail. Only the tool name is bold.
|
|
809
810
|
const color = rowHasFailed(row) ? "error" : "muted";
|
|
810
|
-
const marker = `${theme.fg(color,
|
|
811
|
+
const marker = `${theme.fg(color, GROUP_MARKER)} `;
|
|
811
812
|
const budget = Math.max(1, width - visibleWidth(marker));
|
|
812
813
|
const label = collapsedCallLabel(row, budget, theme, color);
|
|
813
814
|
const outcome = collapsedOutcome(row, budget, theme);
|
|
@@ -1069,59 +1070,15 @@ function renderCollapsedToolRow(
|
|
|
1069
1070
|
return ["", ...insetLines(body, width)];
|
|
1070
1071
|
}
|
|
1071
1072
|
|
|
1072
|
-
function compactBulletLine(
|
|
1073
|
-
summary: string,
|
|
1074
|
-
outcome: string | undefined,
|
|
1075
|
-
width: number,
|
|
1076
|
-
theme: ThemeLike,
|
|
1077
|
-
color = "muted",
|
|
1078
|
-
): string {
|
|
1079
|
-
const prefix = ` ${theme.fg(color, "•")} `;
|
|
1080
|
-
const indent = visibleWidth(prefix);
|
|
1081
|
-
if (width <= indent) return truncateToWidth(prefix, width, "", false);
|
|
1082
|
-
const available = width - indent;
|
|
1083
|
-
return (
|
|
1084
|
-
prefix +
|
|
1085
|
-
(outcome
|
|
1086
|
-
? fitSummaryTail(summary, outcome, available, theme.fg(color, "…"))
|
|
1087
|
-
: fitSummary(summary, available, theme.fg(color, "…")))
|
|
1088
|
-
);
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
1073
|
function groupedCallComponent(
|
|
1092
1074
|
rows: ToolExecutionRow[],
|
|
1093
1075
|
theme: ThemeLike,
|
|
1094
1076
|
): ComponentLike {
|
|
1095
1077
|
return {
|
|
1096
1078
|
render(width: number): string[] {
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
if (lines.length === 0 || row.toolName !== previousToolName) {
|
|
1101
|
-
if (lines.length > 0) lines.push("");
|
|
1102
|
-
const token =
|
|
1103
|
-
row.toolName === "bash" ? "$" : (row.toolName ?? "tool");
|
|
1104
|
-
const heading = `${theme.fg(
|
|
1105
|
-
"muted",
|
|
1106
|
-
theme.bold(GROUP_MARKER),
|
|
1107
|
-
)} ${theme.fg("muted", theme.bold(token))}`;
|
|
1108
|
-
lines.push(truncateToWidth(heading, width, "", false));
|
|
1109
|
-
previousToolName = row.toolName;
|
|
1110
|
-
}
|
|
1111
|
-
const color = rowHasFailed(row) ? "error" : "muted";
|
|
1112
|
-
const call = renderedCallSummary(row, Math.max(1, width - 4), theme);
|
|
1113
|
-
const outcome = renderedGroupedOutcome(row, theme);
|
|
1114
|
-
lines.push(
|
|
1115
|
-
compactBulletLine(
|
|
1116
|
-
theme.fg(color, stripAnsi(call)),
|
|
1117
|
-
outcome,
|
|
1118
|
-
width,
|
|
1119
|
-
theme,
|
|
1120
|
-
color,
|
|
1121
|
-
),
|
|
1122
|
-
);
|
|
1123
|
-
}
|
|
1124
|
-
return lines;
|
|
1079
|
+
// Every member renders like a singleton — `% tool: call → outcome` per
|
|
1080
|
+
// line with the tool name bolded — no bullets or internal blanks.
|
|
1081
|
+
return rows.map((row) => collapsedHeadline(row, width, theme));
|
|
1125
1082
|
},
|
|
1126
1083
|
invalidate() {},
|
|
1127
1084
|
};
|