3560
3561
this._register(wrapper.onSubagentStarted(e => {
3563
>
this._parentToolCallIdsByAgentId.set(e.agentId, e.data.toolCallId);
3564
>
}
3565
>
this._logService.info(`[Copilot:${sessionId}] Subagent started: toolCallId=${e.data.toolCallId}, agent=${e.data.agentName}`);
3566
>
const tracked = this._activeToolCalls.get(e.data.toolCallId);
3567
>
this._onDidSessionProgress.fire({
3568
>
kind: 'subagent_started',
3569
>
chat: this._chatChannelUri,
3570
>
toolCallId: e.data.toolCallId,
3571
>
agentName: e.data.agentName,
3572
>
agentDisplayName: e.data.agentDisplayName,
3573
>
agentDescription: e.data.agentDescription,
3574
>
// The spawning Task tool's short `description` input (captured on
3575
>
// tool start) is the concise per-task tab title for the subagent's
3576
>
// read-only peer chat — distinct even for same-type subagents.
3577
>
taskDescription: tracked?.meta?.subagentDescription,
3578
>
// The full delegated instruction (the spawning tool's `prompt`
3579
>
// argument) seeds the subagent peer chat's opening request.
3580
>
taskPrompt: typeof tracked?.parameters?.prompt === 'string' ? tracked.parameters.prompt : undefined,
3581
>
// When the spawning tool call is itself an inner tool of
3582
>
// another subagent, its recorded parent is the tool call one
3583
>
// level up — the tool call in whose (subagent) chat this
3584
>
// spawning tool lives. The host uses it to route the
3585
>
// discovery content block to that immediate parent chat, at
3586
>
// any nesting depth.
3587
>
parentToolCallId: tracked?.parentToolCallId,
3588
>
});
3589
}));
3590