Repository navigation
feat: enhance tool call functionality with collapsible details and co… - #70
chaojixinren wants to merge 1 commit into
Conversation
…ntent extraction - Introduced collapsible inline tool calls with a summary and body structure for better organization. - Updated the `addToolCall` and `addToolCallDOM` functions to handle content blocks. - Added utility functions for extracting and displaying tool call content. - Improved CSS styles for better visual representation of tool calls.
|
Noticed one gap while working the same issue — flagging it here rather than Your Minimal shape if you want it, same escaping approach you already use: const inner = block.content || {};
if (inner.type === 'text') {
blockEl.textContent = inner.text || '';
} else if (inner.type === 'diff') {
const lines = (inner.oldText || '').split('\n');
blockEl.textContent =
(inner.path ? inner.path + '\n' : '') +
'-'.repeat(40) + '\n' + lines.join('\n-') + '\n' + '+'.repeat(40) +
'\n' + (inner.newText || '').split('\n').join('\n+');
} else if (inner.type === 'terminal') {
blockEl.textContent = inner.terminalId ? '[terminal ' + inner.terminalId + ']' : '[terminal]';
} else if (inner.type === 'locations') {
blockEl.textContent = '[locations]'; // no path until click-through lands
} else {
blockEl.textContent = '[' + (inner.type || 'unknown') + ']';
}
I also dropped the truncation rather than keeping it. Two smaller notes: your Not asking for anything and not tracking a competing branch — happy to just |
Fixes #69
Summary
session/updatenotifications already carryToolCall.content/ToolCallUpdate.content, but the chat render path only readtoolCallId,titleandstatus, so tool-call details were never visible. This makes each tool call expandable and renders its text blocks.<details>; its<summary>keeps the previous one-line look (status icon + title), so the collapsed state is unchanged and the per-turn "N tool calls" collapse still works.{ type: 'content', content: { type: 'text', text } }) are rendered in the body. Agent-supplied text is set withtextContent, so there is no HTML injection path.tool_call_updatereplaces the body with the newestcontentsnapshot; updates withoutcontentkeep the previous body.status/titlehandling is unchanged.failedauto-expands once; it stays user-collapsible afterwards.chatHistoryand rebuilt byrestoreState()/addToolCallDOM(), so details survive a panel reload or session switch.diff, resource links, images), missing fields and empty arrays never throw. Bodies are capped at 20,000 characters with an "... (output truncated)" note.in_progress, which is now normalised to the existingrunningicon / colour class.Files changed
src/ui/ChatWebviewProvider.ts— render / collapse / restore logic and CSSCHANGELOG.md— Unreleased "Fixed" entryscripts/mock-acp-agent.mjs— mock ACP agent used to verify without a real agent (optional; drop if not wanted)Verification
npm run lint,npm run compile,npm testall pass (3 passing).tool_callwith content, fivetool_call_updatenotifications ~500 ms apart, acompletedsummary, afailedcall, andstopReason: end_turn.Manual F5 verification in the Extension Development Host was not run in this environment.