@pi-kaush/pi-tool-call-markers 0.1.0 → 0.1.1

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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Wait for every call in a contiguous parallel run to settle before grouping successful calls, which prevents completed prefixes and suffixes from repeatedly collapsing around active calls.
6
+
3
7
  ## 0.1.0
4
8
 
5
9
  - Collapse adjacent successful tool calls into one compact block per tool type, each with a gear header and bulleted call summaries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ When several tool calls of the same type succeed in a row, Pi normally renders e
10
10
  - **Bulleted call summaries.** Each call in a group becomes one bullet with a short summary (the tool name is stripped from the bullet since the header already names the tool).
11
11
  - **Vertical spacing between tool types.** A blank line separates one tool group from the next.
12
12
  - **Hanging indent for wrapped bullets.** When a summary wraps, continuation lines align under the bullet text rather than under the gear.
13
- - **Boundaries stay separate.** Visible thinking or text, still-running (active) calls, and failed calls split groups, so they never get silently merged.
13
+ - **Parallel runs settle before grouping.** A contiguous run stays ungrouped while any call is active. After every call settles, successful calls group around visible thinking or text and failed-call boundaries.
14
14
  - **Errors expand in place.** A failed call keeps its own block and shows its full detail.
15
15
  - **Ctrl+O restores full blocks.** Expanding tools (`setToolsExpanded(true)`) brings back Pi's individual full blocks, results and all.
16
16
  - **Adjacent thinking blocks combine.** Only directly adjacent `thinking` blocks merge into one; a non-thinking block between them keeps them separate. Malformed thinking content safely falls back to Pi's renderer exactly once, so the display never breaks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-kaush/pi-tool-call-markers",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Collapse adjacent successful tool calls into one compact, gear-headed block per tool type in Pi's transcript.",
5
5
  "license": "MIT",
6
6
  "author": "Kaushik Gopal",
package/src/index.ts CHANGED
@@ -231,6 +231,33 @@ function isCollapsibleSuccess(row: ToolExecutionRow): boolean {
231
231
  );
232
232
  }
233
233
 
234
+ function isSettledToolRow(row: ToolExecutionRow): boolean {
235
+ return row.isPartial === false && !!row.result;
236
+ }
237
+
238
+ function hasUnsettledToolInGroupRun(
239
+ children: unknown[],
240
+ index: number,
241
+ renderAt: (index: number) => string[],
242
+ ): boolean {
243
+ for (const direction of [-1, 1] as const) {
244
+ for (
245
+ let candidateIndex = index + direction;
246
+ candidateIndex >= 0 && candidateIndex < children.length;
247
+ candidateIndex += direction
248
+ ) {
249
+ const candidate = children[candidateIndex];
250
+ if (isToolExecutionRow(candidate)) {
251
+ if (!isSettledToolRow(candidate)) return true;
252
+ if (!isCollapsibleSuccess(candidate)) break;
253
+ continue;
254
+ }
255
+ if (renderAt(candidateIndex).some(hasVisibleContent)) break;
256
+ }
257
+ }
258
+ return false;
259
+ }
260
+
234
261
  function renderComponent(component: unknown, width: number): string[] {
235
262
  if (!component || typeof (component as ComponentLike).render !== "function")
236
263
  return [];
@@ -550,6 +577,10 @@ function renderContainerWithToolGroups(
550
577
  lines.push(...renderAt(index));
551
578
  continue;
552
579
  }
580
+ if (hasUnsettledToolInGroupRun(children, index, renderAt)) {
581
+ lines.push(...renderAt(index));
582
+ continue;
583
+ }
553
584
 
554
585
  const group: ToolExecutionRow[] = [child];
555
586
  let lastMemberIndex = index;