feat(trace-workbench): show spawned-session links in chat tool blocks
The parent session log has no record of subagent spawns (the workflow engine spawns them internally; the only durable linkage is the child header's parentSession field), so the workbench reconstructs call -> children attribution by creation-time window. Surface that panel in the chat tool block too, not just the trajectory row.
This commit is contained in:
@@ -988,11 +988,13 @@ function renderChatToolActivity(call) {
|
|||||||
const outputHtml = result
|
const outputHtml = result
|
||||||
? `<div class="activity-section-title">${failed ? 'Error output' : 'Output'}</div><pre>${escapeHtml(resultText)}</pre>`
|
? `<div class="activity-section-title">${failed ? 'Error output' : 'Output'}</div><pre>${escapeHtml(resultText)}</pre>`
|
||||||
: ''
|
: ''
|
||||||
|
const callEvent = state.callPairs.get(call.id)?.call
|
||||||
|
const spawnHtml = callEvent ? spawnedSessionsHtml(callEvent).trim() : ''
|
||||||
const openBtn = `<button class="activity-open-inspector" type="button" data-inspect-call="${escapeHtml(call.id ?? '')}">在检查器中打开 →</button>`
|
const openBtn = `<button class="activity-open-inspector" type="button" data-inspect-call="${escapeHtml(call.id ?? '')}">在检查器中打开 →</button>`
|
||||||
return `
|
return `
|
||||||
<details class="chat-activity tool-use ${failed ? 'failed' : ''}" data-call-id="${escapeHtml(call.id ?? '')}">
|
<details class="chat-activity tool-use ${failed ? 'failed' : ''}" data-call-id="${escapeHtml(call.id ?? '')}">
|
||||||
<summary><span>${failed ? 'Tool failed' : 'Tool use'}</span><strong>${escapeHtml(call.name)}${preview ? `<span class="activity-preview"> · ${escapeHtml(preview)}</span>` : ''}</strong></summary>
|
<summary><span>${failed ? 'Tool failed' : 'Tool use'}</span><strong>${escapeHtml(call.name)}${preview ? `<span class="activity-preview"> · ${escapeHtml(preview)}</span>` : ''}</strong></summary>
|
||||||
<div class="activity-body">${inputHtml}${outputHtml}${openBtn}</div>
|
<div class="activity-body">${inputHtml}${outputHtml}${spawnHtml}${openBtn}</div>
|
||||||
</details>
|
</details>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1290,6 +1290,9 @@ h4 {
|
|||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
background: #f7fbf7;
|
background: #f7fbf7;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
/* Inside .activity-body (white-space: pre-wrap) the template's own
|
||||||
|
newlines must not render. */
|
||||||
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spawn-list-head {
|
.spawn-list-head {
|
||||||
|
|||||||
Reference in New Issue
Block a user