Skip to content

Commit d54826b

Browse files
committed
feat(ai-chat): tag subagent tool events with parentToolId, style nested rows
Pairs with the phoenix-pro inline-subagent-steps renderer. The backend now looks up the dispatching Agent's toolCounter from _toolUseIdToCounter[message.parent_tool_use_id] and includes it on both aiProgress and aiToolInfo events so the browser knows where to render each step. Styling adds .ai-subagent-steps (left border + indent for the nested block) and .ai-subagent-step / -icon / -label (compact one-line rows with the secondary text size and ellipsis truncation).
1 parent 30490d2 commit d54826b

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

src-node/claude-code-agent.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,23 +1628,27 @@ async function _runQuery(requestId, prompt, projectPath, model, signal, locale,
16281628
if (message.type === "assistant" &&
16291629
message.parent_tool_use_id &&
16301630
message.message && Array.isArray(message.message.content)) {
1631+
const parentToolId = _toolUseIdToCounter[message.parent_tool_use_id];
16311632
for (const block of message.message.content) {
16321633
if (block && block.type === "tool_use") {
16331634
toolCounter++;
16341635
if (block.id) {
16351636
_toolUseIdToCounter[block.id] = toolCounter;
16361637
}
1637-
_log("Subagent tool:", block.name, "#" + toolCounter);
1638+
_log("Subagent tool:", block.name, "#" + toolCounter,
1639+
"parent=#" + (parentToolId !== undefined ? parentToolId : "?"));
16381640
nodeConnector.triggerPeer("aiProgress", {
16391641
requestId: requestId,
16401642
toolName: block.name,
16411643
toolId: toolCounter,
1644+
parentToolId: parentToolId,
16421645
phase: "tool_use"
16431646
});
16441647
nodeConnector.triggerPeer("aiToolInfo", {
16451648
requestId: requestId,
16461649
toolName: block.name,
16471650
toolId: toolCounter,
1651+
parentToolId: parentToolId,
16481652
toolInput: block.input || {}
16491653
});
16501654
}

src/styles/Extn-AIChatPanel.less

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,39 @@
11261126
}
11271127
}
11281128

1129+
/* ── Subagent step rows ──────────────────────────────────────────────
1130+
Compact one-line entries inside an Agent dispatcher card showing
1131+
what the subagent is doing (Read foo.json, Searched: *.md, etc).
1132+
Indented with a left border so the nesting reads clearly. */
1133+
.ai-subagent-steps {
1134+
margin-top: 4px;
1135+
padding-left: 8px;
1136+
border-left: 2px solid fade(@project-panel-text-2, 25%);
1137+
}
1138+
1139+
.ai-subagent-step {
1140+
display: flex;
1141+
align-items: center;
1142+
gap: 6px;
1143+
padding: 2px 0;
1144+
font-size: @ai-text-secondary;
1145+
}
1146+
1147+
.ai-subagent-step-icon {
1148+
width: 14px;
1149+
text-align: center;
1150+
flex-shrink: 0;
1151+
font-size: @ai-text-secondary;
1152+
}
1153+
1154+
.ai-subagent-step-label {
1155+
color: @project-panel-text-2;
1156+
white-space: nowrap;
1157+
overflow: hidden;
1158+
text-overflow: ellipsis;
1159+
min-width: 0;
1160+
}
1161+
11291162
@keyframes ai-spin {
11301163
to { transform: rotate(360deg); }
11311164
}

0 commit comments

Comments
 (0)