@pi-kaush/pi-tool-call-markers 0.3.23 → 0.3.24
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 +14 -14
- package/package.json +1 -1
- package/src/index.ts +7 -3
- package/src/muted.ts +3 -7
- package/src/thinking-block-merger.ts +4 -4
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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. The thin rail lines up with the
|
|
25
|
+
- **`▏` tool-call rail.** Collapsed calls use a bold glyph instead of repeating the tool name. The thin rail lines up with the left edge of the submitted prompt bar, and the call text 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.
|
|
@@ -57,8 +57,8 @@ Subagent calls use the `▏` rail without a glyph. Recognized question calls use
|
|
|
57
57
|
Collapsed codemode rows include bash command previews instead of only tool names:
|
|
58
58
|
|
|
59
59
|
```text
|
|
60
|
-
|
|
61
|
-
|
|
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.
|
|
@@ -76,16 +76,16 @@ native script, nested call status, and result details.
|
|
|
76
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
|
-
|
|
79
|
+
▏ subagent chain (3 steps) [repo-review]
|
|
80
80
|
1. 🐝 bee [workhorse] Challenge the compatibility conclusion…
|
|
81
81
|
2. 🐝 bee …
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
Single calls stay on one `▏
|
|
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 `▏
|
|
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
|
-
|
|
141
|
-
|
|
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
|
|
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,
|
|
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
package/src/index.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
uninstallInfoVisibility,
|
|
23
23
|
} from "./info-visibility.ts";
|
|
24
24
|
import {
|
|
25
|
-
|
|
25
|
+
COLLAPSED_RAIL,
|
|
26
26
|
fgCollapsed,
|
|
27
27
|
paletteSample,
|
|
28
28
|
withFaintCollapsedRail,
|
|
@@ -31,6 +31,8 @@ import { isQuestionToolCall, renderQuestionBlock } from "./question-block.ts";
|
|
|
31
31
|
import { sanitizeInline } from "./sanitize.ts";
|
|
32
32
|
|
|
33
33
|
const OUTER_INSET = 2;
|
|
34
|
+
// Glyphless rows leave room for the glyph and its trailing space.
|
|
35
|
+
const SUBAGENT_LABEL_GAP = " ";
|
|
34
36
|
// Collapsed rows anchor with a glyph instead of repeating the tool name;
|
|
35
37
|
// tools that read as one family share a glyph, and unmapped tools fall back
|
|
36
38
|
// to `*`. A single space separates the glyph from the call content: the
|
|
@@ -966,7 +968,7 @@ function collapsedAnchor(
|
|
|
966
968
|
fgCollapsed(theme, "muted", marker),
|
|
967
969
|
);
|
|
968
970
|
return glyph === undefined
|
|
969
|
-
? rail
|
|
971
|
+
? `${rail}${SUBAGENT_LABEL_GAP}`
|
|
970
972
|
: `${rail}${fgCollapsed(theme, color, glyph, true)} `;
|
|
971
973
|
}
|
|
972
974
|
|
|
@@ -1343,7 +1345,9 @@ function renderSubagentPlan(
|
|
|
1343
1345
|
fgCollapsed(theme, failed ? "error" : "toolOutput", ` [${plan.scope}]`),
|
|
1344
1346
|
),
|
|
1345
1347
|
];
|
|
1346
|
-
const stepIndent = " ".repeat(
|
|
1348
|
+
const stepIndent = " ".repeat(
|
|
1349
|
+
visibleWidth(COLLAPSED_RAIL + SUBAGENT_LABEL_GAP),
|
|
1350
|
+
);
|
|
1347
1351
|
const shown = plan.steps.slice(0, 3);
|
|
1348
1352
|
for (let index = 0; index < shown.length; index++) {
|
|
1349
1353
|
const step = shown[index]!;
|
package/src/muted.ts
CHANGED
|
@@ -10,18 +10,14 @@
|
|
|
10
10
|
//
|
|
11
11
|
// Failures always fall back to the historical tokens.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const COLLAPSED_RAIL_PREFIX = ` ${COLLAPSED_RAIL} `;
|
|
13
|
+
// The thin rail shares the submitted prompt bar's left edge.
|
|
14
|
+
export const COLLAPSED_RAIL = "▏";
|
|
16
15
|
|
|
17
16
|
// Faint keeps the rail quieter than the label, even on failed rows.
|
|
18
17
|
export function withFaintCollapsedRail(
|
|
19
18
|
style: (rail: string) => string,
|
|
20
19
|
): string {
|
|
21
|
-
return
|
|
22
|
-
COLLAPSED_RAIL,
|
|
23
|
-
() => `\x1b[2m${style(COLLAPSED_RAIL)}\x1b[22m`,
|
|
24
|
-
);
|
|
20
|
+
return `\x1b[2m${style(COLLAPSED_RAIL)}\x1b[22m`;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
23
|
const TOOL_OVERRIDE_TOKEN = "collapsedToolCall";
|
|
@@ -2,7 +2,7 @@ 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
4
|
import {
|
|
5
|
-
|
|
5
|
+
COLLAPSED_RAIL,
|
|
6
6
|
collapsedThinkingAnsi,
|
|
7
7
|
withFaintCollapsedRail,
|
|
8
8
|
} from "./muted.ts";
|
|
@@ -114,9 +114,9 @@ function labelStyle(
|
|
|
114
114
|
// the glyph slot and settles into `*` in place: the rail and the label text
|
|
115
115
|
// keep their columns, and only the glyph, the words, and the tint change.
|
|
116
116
|
const THOUGHT_GLYPH = "*";
|
|
117
|
-
const SETTLED_THOUGHT = `${
|
|
117
|
+
const SETTLED_THOUGHT = `${COLLAPSED_RAIL}${THOUGHT_GLYPH} Thought`;
|
|
118
118
|
const ANCHORED_LABEL_RE = new RegExp(
|
|
119
|
-
String.raw`^${
|
|
119
|
+
String.raw`^${COLLAPSED_RAIL}(\S) (.*)$`,
|
|
120
120
|
"su",
|
|
121
121
|
);
|
|
122
122
|
|
|
@@ -430,7 +430,7 @@ function formatThoughtDuration(startedAt: number, finishedAt: number): string {
|
|
|
430
430
|
}
|
|
431
431
|
|
|
432
432
|
function liveThinkingLabel(startedAt: number, now: number): string {
|
|
433
|
-
return `${
|
|
433
|
+
return `${COLLAPSED_RAIL}${thinkingSpinner(startedAt, now)} Thinking…`;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
function thinkingSpinner(startedAt: number, now: number): string {
|