@pi-kaush/pi-tool-call-markers 0.2.6 → 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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- - Group consecutive tool blocks under one `%` marker with per-tool sub-headings and nested sub-bullets, dropping the blank lines between tool sections (F25's compact goal, with the hierarchy that makes it readable).
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).
6
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.
7
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.
8
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-kaush/pi-tool-call-markers",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Compact and group Pi tool calls, with a bundled extension for adjacent thinking blocks.",
5
5
  "license": "MIT",
6
6
  "author": "Kaushik Gopal",
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, match[2] ?? "")
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, theme.bold(GROUP_MARKER))} `;
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,73 +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
- indentSpaces = 2,
1079
- ): string {
1080
- const prefix = `${" ".repeat(indentSpaces)}${theme.fg(color, "•")} `;
1081
- const indent = visibleWidth(prefix);
1082
- if (width <= indent) return truncateToWidth(prefix, width, "", false);
1083
- const available = width - indent;
1084
- return (
1085
- prefix +
1086
- (outcome
1087
- ? fitSummaryTail(summary, outcome, available, theme.fg(color, "…"))
1088
- : fitSummary(summary, available, theme.fg(color, "…")))
1089
- );
1090
- }
1091
-
1092
1073
  function groupedCallComponent(
1093
1074
  rows: ToolExecutionRow[],
1094
1075
  theme: ThemeLike,
1095
1076
  ): ComponentLike {
1096
1077
  return {
1097
1078
  render(width: number): string[] {
1098
- // One marker for the whole consecutive block; each tool run gets a
1099
- // sub-heading, and calls nest one level deeper as sub-bullets. No blank
1100
- // lines inside the block — the hierarchy carries the separation.
1101
- const lines: string[] = [
1102
- truncateToWidth(
1103
- theme.fg("muted", theme.bold(GROUP_MARKER)),
1104
- width,
1105
- "",
1106
- false,
1107
- ),
1108
- ];
1109
- let previousToolName: string | undefined;
1110
- for (const row of rows) {
1111
- if (row.toolName !== previousToolName) {
1112
- const token =
1113
- row.toolName === "bash" ? "$" : (row.toolName ?? "tool");
1114
- lines.push(
1115
- truncateToWidth(
1116
- ` ${theme.fg("muted", theme.bold(token))}`,
1117
- width,
1118
- "",
1119
- false,
1120
- ),
1121
- );
1122
- previousToolName = row.toolName;
1123
- }
1124
- const color = rowHasFailed(row) ? "error" : "muted";
1125
- const call = renderedCallSummary(row, Math.max(1, width - 6), theme);
1126
- const outcome = renderedGroupedOutcome(row, theme);
1127
- lines.push(
1128
- compactBulletLine(
1129
- theme.fg(color, stripAnsi(call)),
1130
- outcome,
1131
- width,
1132
- theme,
1133
- color,
1134
- 4,
1135
- ),
1136
- );
1137
- }
1138
- 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));
1139
1082
  },
1140
1083
  invalidate() {},
1141
1084
  };