@pi-kaush/pi-tool-call-markers 0.3.26 → 0.3.27
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 +1 -1
- package/package.json +1 -1
- package/src/index.ts +29 -24
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ A recognized `subagent` call renders as an unboxed plan in the shared tool aesth
|
|
|
83
83
|
|
|
84
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
|
-
Assigned agent emojis take priority. Without one,
|
|
86
|
+
Assigned agent emojis always take priority. Without one, non-interactive runs use 👻; interactive launches and worker controls (`list`, `status`, `send`, `wait`, `stop`, and `resume`) use 👾. Profiles and explicit model overrides do not affect the fallback. These defaults also cover generic fallback rows such as `subagent 👾 ... [user]`.
|
|
87
87
|
|
|
88
88
|
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).
|
|
89
89
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1107,11 +1107,7 @@ function subagentDisplayProfile(
|
|
|
1107
1107
|
return profile.trim() || undefined;
|
|
1108
1108
|
}
|
|
1109
1109
|
|
|
1110
|
-
function defaultSubagentEmoji(
|
|
1111
|
-
action: unknown,
|
|
1112
|
-
profile: string | undefined,
|
|
1113
|
-
): string {
|
|
1114
|
-
if (profile === "coder") return "🧑💻";
|
|
1110
|
+
function defaultSubagentEmoji(action: unknown): string {
|
|
1115
1111
|
return typeof action === "string" &&
|
|
1116
1112
|
[
|
|
1117
1113
|
"interactive",
|
|
@@ -1122,8 +1118,8 @@ function defaultSubagentEmoji(
|
|
|
1122
1118
|
"stop",
|
|
1123
1119
|
"resume",
|
|
1124
1120
|
].includes(action)
|
|
1125
|
-
? "
|
|
1126
|
-
: "
|
|
1121
|
+
? "👾"
|
|
1122
|
+
: "👻";
|
|
1127
1123
|
}
|
|
1128
1124
|
|
|
1129
1125
|
// Match a whole icon token, including joined emoji, flags, and keycaps.
|
|
@@ -1146,9 +1142,7 @@ function subagentFallbackLabel(args: unknown, summary: string): string {
|
|
|
1146
1142
|
? /[^\x00-\x7f]/u.test(icon)
|
|
1147
1143
|
: !startsWithAgent(summary) && SUBAGENT_EMOJI_TOKEN.test(icon);
|
|
1148
1144
|
const action = input?.action;
|
|
1149
|
-
const prefix = assigned
|
|
1150
|
-
? ""
|
|
1151
|
-
: `${defaultSubagentEmoji(action, input && subagentDisplayProfile(input, action))} `;
|
|
1145
|
+
const prefix = assigned ? "" : `${defaultSubagentEmoji(action)} `;
|
|
1152
1146
|
return `subagent ${prefix}${summary}`.trimEnd();
|
|
1153
1147
|
}
|
|
1154
1148
|
|
|
@@ -1318,8 +1312,8 @@ function subagentPlanOutcome(
|
|
|
1318
1312
|
return theme.fg("warning", "…");
|
|
1319
1313
|
}
|
|
1320
1314
|
|
|
1321
|
-
//
|
|
1322
|
-
//
|
|
1315
|
+
// Single subagents use the agent emoji in the glyph slot. Plans leave that
|
|
1316
|
+
// slot empty for the heading and align each agent emoji with the slot below.
|
|
1323
1317
|
// Agent identities use accent, and failures use error colors.
|
|
1324
1318
|
function renderSubagentPlan(
|
|
1325
1319
|
row: ToolExecutionRow,
|
|
@@ -1338,22 +1332,26 @@ function renderSubagentPlan(
|
|
|
1338
1332
|
const displayEmojis = scrapeSubagentEmojis(row, plan.kind);
|
|
1339
1333
|
// Agent/profile/task values are model-supplied; sanitize them like every
|
|
1340
1334
|
// other collapsed-row text so control bytes cannot reach the terminal.
|
|
1341
|
-
// Identity order: emoji, then the profile and agent-name badges.
|
|
1342
1335
|
const identityOf = (step: SubagentStep) => {
|
|
1343
1336
|
const emoji = displayEmojis.get(step.agent);
|
|
1344
1337
|
const accentPart = (text: string) => fgCollapsed(theme, nameColor, text);
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1338
|
+
return {
|
|
1339
|
+
emoji: sanitizeInline(emoji || defaultSubagentEmoji(action)),
|
|
1340
|
+
label:
|
|
1341
|
+
(step.profile ? accentPart(`[${sanitizeInline(step.profile)}]`) : "") +
|
|
1342
|
+
accentPart(`[${sanitizeInline(step.agent)}]`),
|
|
1343
|
+
};
|
|
1351
1344
|
};
|
|
1352
1345
|
const detailColor = failed ? "error" : "toolOutput";
|
|
1353
1346
|
const previewOf = (step: SubagentStep) =>
|
|
1354
1347
|
fgCollapsed(theme, detailColor, ` ${subagentStepPreview(step.task)}`);
|
|
1355
1348
|
|
|
1356
|
-
const
|
|
1349
|
+
const firstIdentity = identityOf(plan.steps[0]);
|
|
1350
|
+
const marker = collapsedAnchor(
|
|
1351
|
+
theme,
|
|
1352
|
+
plan.kind === "single" ? nameColor : color,
|
|
1353
|
+
plan.kind === "single" ? firstIdentity.emoji : undefined,
|
|
1354
|
+
);
|
|
1357
1355
|
const budget = Math.max(1, width - visibleWidth(marker));
|
|
1358
1356
|
const progress = subagentProgressText(row);
|
|
1359
1357
|
const outcome = subagentPlanOutcome(row, failed, progress, budget, theme);
|
|
@@ -1365,7 +1363,7 @@ function renderSubagentPlan(
|
|
|
1365
1363
|
|
|
1366
1364
|
if (plan.kind === "single") {
|
|
1367
1365
|
const step = plan.steps[0];
|
|
1368
|
-
return [headline(
|
|
1366
|
+
return [headline(firstIdentity.label + previewOf(step))];
|
|
1369
1367
|
}
|
|
1370
1368
|
|
|
1371
1369
|
const kindLabel =
|
|
@@ -1374,10 +1372,15 @@ function renderSubagentPlan(
|
|
|
1374
1372
|
: `parallel (${plan.steps.length} tasks)`;
|
|
1375
1373
|
const lines = [
|
|
1376
1374
|
headline(
|
|
1377
|
-
|
|
1375
|
+
" " +
|
|
1376
|
+
fgCollapsed(theme, failed ? "error" : "toolTitle", "subagents:", true) +
|
|
1378
1377
|
" " +
|
|
1379
1378
|
fgCollapsed(theme, failed ? "error" : "toolOutput", kindLabel) +
|
|
1380
|
-
fgCollapsed(
|
|
1379
|
+
fgCollapsed(
|
|
1380
|
+
theme,
|
|
1381
|
+
failed ? "error" : "toolOutput",
|
|
1382
|
+
` [${plan.scope} level]`,
|
|
1383
|
+
),
|
|
1381
1384
|
),
|
|
1382
1385
|
];
|
|
1383
1386
|
const stepIndent = " ".repeat(
|
|
@@ -1386,11 +1389,13 @@ function renderSubagentPlan(
|
|
|
1386
1389
|
const shown = plan.steps.slice(0, 3);
|
|
1387
1390
|
for (let index = 0; index < shown.length; index++) {
|
|
1388
1391
|
const step = shown[index]!;
|
|
1392
|
+
const identity = identityOf(step);
|
|
1389
1393
|
const number =
|
|
1390
1394
|
plan.kind === "chain"
|
|
1391
1395
|
? `${fgCollapsed(theme, color, `${index + 1}.`)} `
|
|
1392
1396
|
: "";
|
|
1393
|
-
|
|
1397
|
+
const stepAnchor = collapsedAnchor(theme, nameColor, identity.emoji);
|
|
1398
|
+
lines.push(`${stepAnchor}${number}${identity.label}${previewOf(step)}`);
|
|
1394
1399
|
}
|
|
1395
1400
|
if (plan.steps.length > shown.length) {
|
|
1396
1401
|
lines.push(
|