anomalyco / anomalyco/opencode
feat: collapsible JSON tree view for raw messages in context panel
@Hona is already working on this.
Since Jul 22, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The raw messages section in the context panel (side panel → context tab → "Raw messages") currently renders each message as a flat JSON text block using a code viewer. This makes it difficult to read deeply nested JSON structures — users have to scroll through hundreds of lines to find the relevant field.
Solution
Replace the plain text JSON display with a collapsible tree view that allows users to expand/collapse individual nodes (objects and arrays). This makes the raw data much more scannable and useful for debugging.
Key behavior:
- Top-level nodes are expanded by default; nested children are collapsed
- Each expandable node shows a
chevron-righttoggle button that rotates 90° when expanded - Collapsed objects/arrays show a
{ ... }/[...]summary - Syntax coloring: keys (magenta), strings (teal), numbers (cyan), booleans (orange), null (gray)
- Gracefully falls back to raw text if JSON parsing fails
Implementation
packages/session-ui/src/components/json-viewer.tsx— recursive tree componentpackages/session-ui/src/components/json-viewer.css— syntax highlighting via existing--syntax-*CSS variablespackages/app/src/components/session/session-context-tab.tsx—RawMessageContentupdated to useJsonViewerinstead of<File mode="text">
No new external dependencies. Uses existing @opencode-ai/ui/icon and theme variables.
Screenshots
N/A — pure UI change, no visual mockup needed.
Additional context
This is a self-contained enhancement. A follow-up could add the same treatment to diff/file views, but that requires deeper integration with @pierre/diffs and is scoped separately.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.