@pi-kaush/pi-tool-call-markers 0.3.21 → 0.3.23

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 CHANGED
@@ -15,14 +15,14 @@ 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
- │ § writing-prose/SKILL.md 42 lines
19
- │ π .pi/prompts/review.md 18 lines
20
- │ ● src/a.ts 42 lines
21
- │ $ npm test → done
18
+ ▏ § writing-prose/SKILL.md 42 lines
19
+ ▏ ≡ .pi/prompts/review.md 18 lines
20
+ ▏ ● src/a.ts 42 lines
21
+ ▏ $ npm test → done
22
22
  ```
23
23
 
24
24
  - **Two-column outer inset.** Tool markers and image output align with an inset conversation surface. Very narrow terminals reduce the decoration before useful content.
25
- - **`│` tool-call rail.** Collapsed calls use a bold glyph instead of repeating the tool name. A single space separates the glyph from the call text. Grouped rows flow directly across tool types. See [Tool-call glyphs](#tool-call-glyphs) for the full list.
25
+ - **`▏` tool-call rail.** Collapsed calls use a bold glyph instead of repeating the tool name. The thin rail lines up with the start of the submitted prompt background, and the glyph lines up with the first character of the prompt. A single space separates the glyph from the call text. Grouped rows flow directly across tool types. See [Tool-call glyphs](#tool-call-glyphs) for the full list.
26
26
  - **Semantic, low-contrast status.** The anchor and the call content share the collapsed mute, pending state is warning-colored, and failures remain error-colored. Ordinary tool states have no background.
27
27
  - **Width-safe outcome tails.** Long summaries truncate before useful tails such as `→ done`, `→ 42 lines`, `→ +2/-1`, or a `bash` duration.
28
28
  - **Stable running groups.** Adjacent calls group as they appear, including settled failures, which stay error-colored inside the group. Pending state and elapsed `bash` time settle into the final outcome without changing the row count.
@@ -37,7 +37,7 @@ Collapsed tool rows use semantic theme colors with no gear, background fill, box
37
37
  | Tool call | Glyph |
38
38
  | --------------------------------------------------- | ----- |
39
39
  | `read` a local `SKILL.md` | `§` |
40
- | `read` a registered Pi prompt template | `π` |
40
+ | `read` a registered Pi prompt template | `≡` |
41
41
  | `read` any other resource | `●` |
42
42
  | `bash` | `$` |
43
43
  | `write` | `+` |
@@ -50,15 +50,15 @@ Collapsed tool rows use semantic theme colors with no gear, background fill, box
50
50
 
51
51
  Pi prompt templates are matched against the templates registered at session start, including files outside the usual prompt directories. Other skill files and unregistered templates keep the `●` read marker. These markers do not change submitted prompts or slash commands.
52
52
 
53
- Subagent calls use the `│` rail without a glyph. Recognized question calls use the submitted-prompt shell instead of a tool-call glyph.
53
+ Subagent calls use the `▏` rail without a glyph. Recognized question calls use the submitted-prompt shell instead of a tool-call glyph.
54
54
 
55
55
  ## Codemode commands
56
56
 
57
57
  Collapsed codemode rows include bash command previews instead of only tool names:
58
58
 
59
59
  ```text
60
- │ ¢ bash ×1 npm test
61
- │ ¢ bash ×2 git status --short, bash npm test
60
+ ▏ ¢ bash ×1 npm test
61
+ ▏ ¢ bash ×2 git status --short, bash npm test
62
62
  ```
63
63
 
64
64
  The first preview for each tool shows its total call count, including ×1.
@@ -73,19 +73,19 @@ native script, nested call status, and result details.
73
73
 
74
74
  ## Subagent plans
75
75
 
76
- A recognized `subagent` call renders as an unboxed plan in the shared tool aesthetic, using the same `│` tool-call rail:
76
+ A recognized `subagent` call renders as an unboxed plan in the shared tool aesthetic, using the same `▏` tool-call rail:
77
77
 
78
78
  ```text
79
- │ subagent chain (3 steps) [repo-review]
80
- 1. 🐝 bee [workhorse] Challenge the compatibility conclusion…
81
- 2. 🐝 bee …
79
+ ▏ subagent chain (3 steps) [repo-review]
80
+ 1. 🐝 bee [workhorse] Challenge the compatibility conclusion…
81
+ 2. 🐝 bee …
82
82
  ```
83
83
 
84
- Single calls stay on one `│ [<emoji>] [<profile>][<agent>] <task preview>` row — no tool label. Chain calls get a heading with the kind, count, and scope followed by numbered steps (parallel tasks list without numbers), with each step ordered emoji, profile badge, name badge. Agent display names (emoji + name) are scraped from the native plan component — including the single-call heading — with an args fallback, and render in `accent`; everything else stays muted, and failed subagents go full red. Subagents never join ordinary tool groups.
84
+ Single calls stay on one `▏ [<emoji>] [<profile>][<agent>] <task preview>` row — no tool label. Chain calls get a heading with the kind, count, and scope followed by numbered steps (parallel tasks list without numbers), with each step ordered emoji, profile badge, name badge. Agent display names (emoji + name) are scraped from the native plan component — including the single-call heading — with an args fallback, and render in `accent`; everything else stays muted, and failed subagents go full red. Subagents never join ordinary tool groups.
85
85
 
86
86
  While a subagent runs, the plan headline's tail shows live progress from the streamed result details — `→ 1 turn · provider/model` in the warning tone — and a settled call keeps the same `→ N turns · provider/model` summary in muted (turns aggregate across tasks; the model shows only when every task used the same one).
87
87
 
88
- Malformed, ambiguous, future, or too-narrow shapes fall back to the generic `│ subagent …` collapsed row rather than dropping information, and `Ctrl+O` still exposes the native subagent renderer.
88
+ Malformed, ambiguous, future, or too-narrow shapes fall back to the generic `▏ subagent …` collapsed row rather than dropping information, and `Ctrl+O` still exposes the native subagent renderer.
89
89
 
90
90
  ## Asked questions
91
91
 
@@ -137,11 +137,11 @@ The second package entrypoint, `src/thinking-block-merger.ts`, combines only dir
137
137
  When Pi exposes its per-row hidden-thinking and streaming fields, hidden reasoning uses these native-themed labels:
138
138
 
139
139
  ```text
140
- │ ⠋ Thinking… → │ ⠙ Thinking… → …
141
- │ * Thought · 2.5s
140
+ ▏ ⠋ Thinking… → ▏ ⠙ Thinking… → …
141
+ ▏ * Thought · 2.5s
142
142
  ```
143
143
 
144
- The live label samples Pi's native braille spinner sequence from the clock each time the TUI draws it, so it steps with the redraws Pi's working indicator already drives instead of freezing between bursty thinking deltas. It does not add a timer; with the working indicator hidden, the spinner advances on each content update. The adapter stores the first local streaming timestamp per assistant row in a `WeakMap`. A restored message or an older runtime with no streaming argument uses `│ * Thought`. Both labels borrow the collapsed tool-row anchor — a faint `│` rail and a bold glyph — so reasoning reads like the tool calls around it. The spinner holds the glyph slot and settles into `*` in place: the rail and the label text keep their columns, and the rail keeps the settled tone throughout. There is no interval, timeout, render request, model call, or network work.
144
+ The live label samples Pi's native braille spinner sequence from the clock each time the TUI draws it, so it steps with the redraws Pi's working indicator already drives instead of freezing between bursty thinking deltas. It does not add a timer; with the working indicator hidden, the spinner advances on each content update. The adapter stores the first local streaming timestamp per assistant row in a `WeakMap`. A restored message or an older runtime with no streaming argument uses `▏ * Thought`. Both labels keep a faint `▏` rail and a bold glyph. The spinner holds the glyph slot and settles into `*` in place: the rail and the label text keep their columns, and the rail keeps the settled tone throughout. There is no interval, timeout, render request, model call, or network work.
145
145
 
146
146
  Pi renders thinking labels and traces italic. This package drops those italics: both labels read as plain collapsed rows (the live spinner keeps its thinking-level tint, the settled row the muted tone, and a theme that resolves no color still loses the italics), and a visible trace stays italic only while it streams, then settles into ordinary transcript text. `PI_TOOL_CALL_MARKERS_THOUGHT_COLOR=inherit` is the opt-out that keeps Pi's native italic `thinkingText` styling.
147
147
 
@@ -175,7 +175,7 @@ Names are comma-separated and matched exactly. Listed rows never join a group, a
175
175
 
176
176
  ### Collapsed-row colors
177
177
 
178
- Collapsed rows (tool calls, `│ * Thought`, subagents) default to the theme's `dim` color — it ships with every Pi theme and sits below `muted`, including in the generated `system` theme — with the row's anchor and the call content sharing it. Failures stay error-colored and live spinners keep their existing tints.
178
+ Collapsed rows (tool calls, `▏ * Thought`, subagents) default to the theme's `dim` color — it ships with every Pi theme and sits below `muted`, including in the generated `system` theme — with the row's anchor and the call content sharing it. Failures stay error-colored and live spinners keep their existing tints.
179
179
 
180
180
  A theme can override each collapsed kind independently with optional color tokens:
181
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-kaush/pi-tool-call-markers",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
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
@@ -21,12 +21,16 @@ import {
21
21
  installInfoVisibility,
22
22
  uninstallInfoVisibility,
23
23
  } from "./info-visibility.ts";
24
- import { fgCollapsed, fgCollapsedRail, paletteSample } from "./muted.ts";
24
+ import {
25
+ COLLAPSED_RAIL_PREFIX,
26
+ fgCollapsed,
27
+ paletteSample,
28
+ withFaintCollapsedRail,
29
+ } from "./muted.ts";
25
30
  import { isQuestionToolCall, renderQuestionBlock } from "./question-block.ts";
26
31
  import { sanitizeInline } from "./sanitize.ts";
27
32
 
28
33
  const OUTER_INSET = 2;
29
- const TOOL_RAIL_MARKER = "│";
30
34
  // Collapsed rows anchor with a glyph instead of repeating the tool name;
31
35
  // tools that read as one family share a glyph, and unmapped tools fall back
32
36
  // to `*`. A single space separates the glyph from the call content: the
@@ -953,16 +957,14 @@ function codemodeCallLabel(row: ToolExecutionRow): string | undefined {
953
957
  return parts.length > 0 ? parts.join(" · ") : undefined;
954
958
  }
955
959
 
956
- // One anchor builder for every collapsed row: the faint rail, then the
957
- // row's bold glyph when it has one — `│ ● src/a.ts`, `│ $ npm test`. A
958
- // subagent row anchors on the rail alone and keeps its `│ subagent …`
959
- // reading instead of a glyph.
960
960
  function collapsedAnchor(
961
961
  theme: ThemeLike,
962
962
  color: string,
963
963
  glyph: string | undefined,
964
964
  ): string {
965
- const rail = `${fgCollapsedRail(theme, TOOL_RAIL_MARKER)} `;
965
+ const rail = withFaintCollapsedRail((marker) =>
966
+ fgCollapsed(theme, "muted", marker),
967
+ );
966
968
  return glyph === undefined
967
969
  ? rail
968
970
  : `${rail}${fgCollapsed(theme, color, glyph, true)} `;
@@ -987,7 +989,7 @@ function readGlyph(
987
989
  const localPath = path.startsWith("@") ? path.slice(1) : path;
988
990
  if (/^[a-z][a-z\d+.-]*:\/\//i.test(localPath)) return "●";
989
991
  if (/(?:^|[/\\])SKILL\.md$/.test(localPath)) return "§";
990
- return state.promptPaths.has(resourcePath(path, state.cwd)) ? "π" : "●";
992
+ return state.promptPaths.has(resourcePath(path, state.cwd)) ? "≡" : "●";
991
993
  }
992
994
 
993
995
  // The collapsed-row seam lives here and nowhere else: which anchor a row
@@ -1280,11 +1282,9 @@ function subagentPlanOutcome(
1280
1282
  return theme.fg("warning", "…");
1281
1283
  }
1282
1284
 
1283
- // Subagents render as an ordinary unboxed tool block: a `│` heading with the
1284
- // plan kind/count/scope, then the numbered chain steps or parallel tasks with
1285
- // agent identities (emoji, profile badge, name badge) in accent. Single calls
1286
- // collapse to one row: `│ <emoji> [<profile>][<name>] <task preview>`. Everything
1287
- // else stays muted (or error on failure), matching the shared tool-row aesthetic.
1285
+ // Subagents use the collapsed rail with no separate glyph. A single call
1286
+ // starts with its agent identity; a multi-step plan starts with a heading.
1287
+ // Agent identities use accent, and failures use error colors.
1288
1288
  function renderSubagentPlan(
1289
1289
  row: ToolExecutionRow,
1290
1290
  width: number,
@@ -1343,6 +1343,7 @@ function renderSubagentPlan(
1343
1343
  fgCollapsed(theme, failed ? "error" : "toolOutput", ` [${plan.scope}]`),
1344
1344
  ),
1345
1345
  ];
1346
+ const stepIndent = " ".repeat(visibleWidth(COLLAPSED_RAIL_PREFIX));
1346
1347
  const shown = plan.steps.slice(0, 3);
1347
1348
  for (let index = 0; index < shown.length; index++) {
1348
1349
  const step = shown[index]!;
@@ -1350,11 +1351,11 @@ function renderSubagentPlan(
1350
1351
  plan.kind === "chain"
1351
1352
  ? `${fgCollapsed(theme, color, `${index + 1}.`)} `
1352
1353
  : "";
1353
- lines.push(` ${number}${identityOf(step)}${previewOf(step)}`);
1354
+ lines.push(`${stepIndent}${number}${identityOf(step)}${previewOf(step)}`);
1354
1355
  }
1355
1356
  if (plan.steps.length > shown.length) {
1356
1357
  lines.push(
1357
- ` ${fgCollapsed(theme, color, `... +${plan.steps.length - shown.length} more`)}`,
1358
+ `${stepIndent}${fgCollapsed(theme, color, `... +${plan.steps.length - shown.length} more`)}`,
1358
1359
  );
1359
1360
  }
1360
1361
  return lines;
@@ -1610,7 +1611,12 @@ function installGroupingPatch(
1610
1611
  if (!proto || typeof proto.render !== "function") return undefined;
1611
1612
 
1612
1613
  const existing = proto[GROUPING_PATCHED];
1613
- if (existing) {
1614
+ if (existing?.disabled && proto.render === existing.patchedRender) {
1615
+ // A later wrapper may have restored ours after we shut down. Replace
1616
+ // it now so reload uses the new module's renderer, not the old closure.
1617
+ proto.render = existing.originalRender;
1618
+ delete proto[GROUPING_PATCHED];
1619
+ } else if (existing) {
1614
1620
  existing.owners++;
1615
1621
  existing.presentation = presentation;
1616
1622
  existing.disabled = false;
package/src/muted.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Collapsed-row color policy.
2
2
  //
3
- // Collapsed blocks (tool calls, settled "│ * Thought" labels, subagent rows)
3
+ // Collapsed blocks (tool calls, settled thinking labels, subagent rows)
4
4
  // default to the theme's `dim` token — it ships with every Pi theme and sits
5
5
  // below `muted` — instead of the louder muted/toolTitle/toolOutput split.
6
6
  // Pi's generated `system` theme solves `syntaxComment` to the same contrast
@@ -10,6 +10,20 @@
10
10
  //
11
11
  // Failures always fall back to the historical tokens.
12
12
 
13
+ const COLLAPSED_RAIL = "▏";
14
+ // The rail starts at the prompt background; the label starts at the prompt text.
15
+ export const COLLAPSED_RAIL_PREFIX = ` ${COLLAPSED_RAIL} `;
16
+
17
+ // Faint keeps the rail quieter than the label, even on failed rows.
18
+ export function withFaintCollapsedRail(
19
+ style: (rail: string) => string,
20
+ ): string {
21
+ return COLLAPSED_RAIL_PREFIX.replace(
22
+ COLLAPSED_RAIL,
23
+ () => `\x1b[2m${style(COLLAPSED_RAIL)}\x1b[22m`,
24
+ );
25
+ }
26
+
13
27
  const TOOL_OVERRIDE_TOKEN = "collapsedToolCall";
14
28
  const THINKING_OVERRIDE_TOKEN = "collapsedThinkingCall";
15
29
  const DEFAULT_TOKEN = "dim";
@@ -94,12 +108,3 @@ export function fgCollapsed(
94
108
  }
95
109
  return theme.fg(color, bold && theme.bold ? theme.bold(text) : text);
96
110
  }
97
-
98
- // Decoration rails recede further than collapsed text. No palette token is
99
- // guaranteed lighter than the collapsed `dim` color, so apply the terminal's
100
- // faint attribute: it lightens toward the background on light themes and
101
- // darkens on dark ones. The rail keeps this muted weight even on failed
102
- // rows, where only the row's text turns error-colored.
103
- export function fgCollapsedRail(theme: CollapsedTheme, text: string): string {
104
- return `\x1b[2m${fgCollapsed(theme, "muted", text)}\x1b[22m`;
105
- }
@@ -1,7 +1,11 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { AssistantMessageComponent } from "@earendil-works/pi-coding-agent";
3
3
  import { infoVisibilityHidden } from "./info-visibility-state.ts";
4
- import { collapsedThinkingAnsi } from "./muted.ts";
4
+ import {
5
+ COLLAPSED_RAIL_PREFIX,
6
+ collapsedThinkingAnsi,
7
+ withFaintCollapsedRail,
8
+ } from "./muted.ts";
5
9
 
6
10
  const THINKING_GROUPING_PATCHED = Symbol.for("kg.pi.thinkingGrouping.v2");
7
11
  const PI_SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
@@ -10,7 +14,7 @@ const SPINNER_INTERVAL_MS = 80;
10
14
  // Visual treatment for the collapsed thinking label. The live "Thinking…"
11
15
  // spinner tints with the session's active thinking-level color
12
16
  // (thinkingOff…thinkingMax), so progress reads as activity; the settled
13
- // "│ * Thought" row drops to the muted token collapsed tool calls use, so
17
+ // "Thought" row drops to the muted token collapsed tool calls use, so
14
18
  // finished reasoning stops advertising the level. "inherit" keeps Pi's
15
19
  // native styling (italic + thinkingText) for both states, and "mdheading"
16
20
  // rides the theme's mdHeading token for both. The env var overrides the
@@ -109,10 +113,12 @@ function labelStyle(
109
113
  // so reasoning reads like the tool calls around it. The live spinner holds
110
114
  // the glyph slot and settles into `*` in place: the rail and the label text
111
115
  // keep their columns, and only the glyph, the words, and the tint change.
112
- const THOUGHT_RAIL = "│";
113
116
  const THOUGHT_GLYPH = "*";
114
- const SETTLED_THOUGHT = `${THOUGHT_RAIL} ${THOUGHT_GLYPH} Thought`;
115
- const ANCHORED_LABEL_RE = /^│ (\S) (.*)$/su;
117
+ const SETTLED_THOUGHT = `${COLLAPSED_RAIL_PREFIX}${THOUGHT_GLYPH} Thought`;
118
+ const ANCHORED_LABEL_RE = new RegExp(
119
+ String.raw`^${COLLAPSED_RAIL_PREFIX}(\S) (.*)$`,
120
+ "su",
121
+ );
116
122
 
117
123
  function isSettledThoughtLabel(label: string): boolean {
118
124
  return label.startsWith(SETTLED_THOUGHT);
@@ -128,8 +134,8 @@ function styledAnchoredLabel(
128
134
  const match = ANCHORED_LABEL_RE.exec(raw);
129
135
  if (!match) return `${style.prefix}${raw}${style.suffix}`;
130
136
  const rail = settledMutedStyle(theme) ?? style;
131
- const railText = `\x1b[2m${THOUGHT_RAIL}\x1b[22m`;
132
- const body = ` \x1b[1m${match[1]}\x1b[22m ${match[2]}${style.suffix}`;
137
+ const railText = withFaintCollapsedRail((marker) => marker);
138
+ const body = `\x1b[1m${match[1]}\x1b[22m ${match[2]}${style.suffix}`;
133
139
  return rail.prefix === style.prefix
134
140
  ? `${style.prefix}${railText}${body}`
135
141
  : `${rail.prefix}${railText}${rail.suffix}${style.prefix}${body}`;
@@ -424,7 +430,7 @@ function formatThoughtDuration(startedAt: number, finishedAt: number): string {
424
430
  }
425
431
 
426
432
  function liveThinkingLabel(startedAt: number, now: number): string {
427
- return `${THOUGHT_RAIL} ${thinkingSpinner(startedAt, now)} Thinking…`;
433
+ return `${COLLAPSED_RAIL_PREFIX}${thinkingSpinner(startedAt, now)} Thinking…`;
428
434
  }
429
435
 
430
436
  function thinkingSpinner(startedAt: number, now: number): string {