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.
3.8 KiB
3.8 KiB
Chat Message Parts: Rendering Architecture
This folder contains renderers for chat message parts (text, tools, reasoning, placeholders) and shared tool presentation helpers.
Use this doc when you ask an agent to change tool/header/description behavior.
High-level flow
- Message parts are rendered from
MessageBody.tsx. - There are two tool rendering paths:
- Static grouped tools ->
StaticToolRowinProgressiveGroup.tsx - Expandable tools ->
ToolPart.tsx
- Static grouped tools ->
- Shared tool icon mapping is centralized in
toolPresentation.tsx(getToolIcon).
Which file controls what
-
ProgressiveGroup.tsx- Renders grouped Activity rows and grouped static tools.
- Contains
StaticToolRow. - Contains static tool short description logic (
getToolShortDescription). - If you want to change how
read/grep/perplexity/webfetch/...look in compact/grouped mode, edit here.
-
ToolPart.tsx- Renders expandable tool rows (bash/edit/write/question/task + fallback).
- Controls expandable header title/description/diff stats/timer and expanded output body.
- If you want to change expandable tool layout, edit here.
-
toolPresentation.tsx- Shared icon mapping for tool names (
getToolIcon). - Used by both
ProgressiveGroup.tsxandToolPart.tsx.
- Shared icon mapping for tool names (
-
toolRenderUtils.ts- Core classification helpers:
isExpandableToolisStaticToolisStandaloneToolgetStaticGroupToolName
- If a tool should switch between static vs expandable, change it here.
- Core classification helpers:
-
ReasoningPart.tsx- Thinking block UI (
ReasoningTimelineBlock), summary + optional duration.
- Thinking block UI (
-
JustificationBlock.tsx- Justification block wrapper over
ReasoningTimelineBlock.
- Justification block wrapper over
Current important behavior
readandskillare static navigation tools and render viaStaticToolRow.- Every other tool, including search/fetch, OpenCode built-ins, custom tools, plugins, and MCP tools, is expandable and renders through
ToolPart. ToolPartdefers 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
sortedmode (handled inReasoningPart.tsx+JustificationBlock.tsx).
"I want to change description for Perplexity" (example recipe)
If task is: "change text shown near Read or Skill in compact mode":
- Edit
ProgressiveGroup.tsx->getToolShortDescription(activity). - Update the branch that handles
readorskillinStaticToolRow. - Keep all other tool header/output behavior in
ToolPart.tsx. - Keep icon changes (if any) in
toolPresentation.tsx.
Why: only navigation tools use the compact static path; all other tools need observable input and output.
"I want tool to become expandable" (example)
- Update
toolRenderUtils.ts:- add/remove a tool name from
STATIC_TOOL_NAMESonly when it has a reliable direct in-app navigation action
- add/remove a tool name from
- Ensure
ToolPart.tsxsupports desired header + expanded output format for that tool. - Validate both modes (
sortedandlive).
Safe editing checklist
- Do not duplicate icon logic; keep it in
toolPresentation.tsx. - For static tool copy changes, prefer
ProgressiveGroup.tsxfirst. - For expanded output changes, edit
ToolPart.tsx. - After edits run:
bun run type-checkbun run lintbun run build
Quick map of files in this folder
- Text:
AssistantTextPart.tsx,UserTextPart.tsx - Tools:
ToolPart.tsx,ProgressiveGroup.tsx,toolPresentation.tsx,toolRenderUtils.ts,ToolRevealOnMount.tsx - Reasoning/justification:
ReasoningPart.tsx,JustificationBlock.tsx - Status/placeholders:
WorkingPlaceholder.tsx,SessionActiveSpinner.tsx,MigratingPart.tsx,BusyDots.tsx - Utility renderers:
VirtualizedCodeBlock.tsx,MinDurationShineText.tsx