feat: add navigable JSON summaries for tool output

Tool JSON output now starts with a compact navigable summary view.
Expandable tool output includes quick open-file and diff actions for changed files.
Reasoning headers strip stray HTML comments, and navigation tools stay compact.
This commit is contained in:
Bohdan Triapitsyn
2026-07-10 14:51:33 +03:00
parent 6c2e657511
commit b3fa19fe3e
23 changed files with 389 additions and 144 deletions
@@ -1,9 +1,7 @@
const EXPANDABLE_TOOL_NAMES = new Set<string>([
'edit', 'multiedit', 'apply_patch', 'str_replace', 'str_replace_based_edit_tool',
'bash', 'shell', 'cmd', 'terminal',
'write', 'create', 'file_write',
'question', 'task', 'lsp',
]);
// Keep only tools with a direct in-app navigation destination compact. Every
// other tool uses ToolPart so custom, plugin, and MCP calls expose their input
// and output through the common expandable renderer.
const STATIC_TOOL_NAMES = new Set<string>(['read', 'skill']);
const STANDALONE_TOOL_NAMES = new Set<string>(['task']);
@@ -21,7 +19,7 @@ const normalizeToolName = (toolName: unknown): string => {
};
export const isExpandableTool = (toolName: unknown): boolean => {
return EXPANDABLE_TOOL_NAMES.has(normalizeToolName(toolName));
return !isStaticTool(toolName);
};
export const isStandaloneTool = (toolName: unknown): boolean => {
@@ -29,6 +27,5 @@ export const isStandaloneTool = (toolName: unknown): boolean => {
};
export const isStaticTool = (toolName: unknown): boolean => {
if (typeof toolName !== 'string') return false;
return !isExpandableTool(toolName) && !isStandaloneTool(toolName);
return STATIC_TOOL_NAMES.has(normalizeToolName(toolName));
};