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
@@ -45,26 +45,26 @@ Use this doc when you ask an agent to change tool/header/description behavior.
## Current important behavior
- `read` and most search/fetch tools are treated as **static tools** and usually render via `StaticToolRow`.
- `bash/edit/write/question/task` are **expandable tools** and render via `ToolPart`.
- `perplexity` is currently treated as static and grouped into search/web-search style rows (through static grouping + short description extraction).
- `read` and `skill` are **static navigation tools** and render via `StaticToolRow`.
- Every other tool, including search/fetch, OpenCode built-ins, custom tools, plugins, and MCP tools, is **expandable** and renders through `ToolPart`.
- `ToolPart` defers expanded content after a user toggle, preventing large tool input/output payloads from mounting during the initial chat render.
- Thinking/Justification duration is hidden in `sorted` mode (handled in `ReasoningPart.tsx` + `JustificationBlock.tsx`).
## "I want to change description for Perplexity" (example recipe)
If task is: "change text shown near Perplexity tool header/description":
If task is: "change text shown near Read or Skill in compact mode":
1. Edit `ProgressiveGroup.tsx` -> `getToolShortDescription(activity)`.
2. Update the branch that handles web-search tools (`websearch`, `web-search`, `search_web`, `codesearch`, `perplexity`, etc.).
3. If needed, update group rendering in `StaticToolRow` (search/fetch specific rendering branches).
2. Update the branch that handles `read` or `skill` in `StaticToolRow`.
3. Keep all other tool header/output behavior in `ToolPart.tsx`.
4. Keep icon changes (if any) in `toolPresentation.tsx`.
Why: in current pipeline Perplexity is static/grouped, so `StaticToolRow` is the primary path.
Why: only navigation tools use the compact static path; all other tools need observable input and output.
## "I want tool to become expandable" (example)
1. Update `toolRenderUtils.ts`:
- add/remove tool name in `EXPANDABLE_TOOL_NAMES`
- add/remove a tool name from `STATIC_TOOL_NAMES` only when it has a reliable direct in-app navigation action
2. Ensure `ToolPart.tsx` supports desired header + expanded output format for that tool.
3. Validate both modes (`sorted` and `live`).