feat(#2196): stamp _body on mcp__bash__run, drop tool-specific JS branch

Backend now stamps `_body` (full `$ <cmd>`) alongside `_summary` (first
line) and `_category: "rich"` for mcp__bash__run tool_use entries. The
frontend drops the mcp__bash__run-specific branch in renderRichToolUse
and uses a generic `if (c._body)` path instead — api.details() with the
backend-computed summary and body, no JS knowledge of the tool name.
This commit is contained in:
iris 2026-07-19 18:16:46 +02:00
commit b62652c01b
2 changed files with 32 additions and 8 deletions

View file

@ -1559,14 +1559,11 @@ window.marked = marked;
'answer #' + id + (lines > 1 ? ` · ${lines}L` : ''),
a, icon);
}
// Bash task runner — show full command in an expandable pre block so
// multi-line scripts are readable. Summary uses the first line so the
// row is identifiable without expanding.
if (name === 'mcp__bash__run') {
const cmd = String(input.cmd || '');
const firstLine = cmd.split('\n')[0];
const summary = 'run* $ ' + trim(firstLine.trim(), 72);
return api.details('tool-use', summary, '$ ' + cmd, icon);
// Generic plain-text body: the backend stamps `_body` for tools whose
// expandable content is plain text (e.g. mcp__bash__run full command).
// Render as a collapsible details row without any tool-specific logic.
if (c._body) {
return api.details('tool-use', c._summary || name || '?', c._body, icon);
}
return null;
}