anomalyco / anomalyco/opencode

feat: collapsible JSON tree view for raw messages in context panel

Open
#38,288 0 comments 0 reactions 1 assignee View on GitHub

@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-right toggle 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 component
  • packages/session-ui/src/components/json-viewer.css — syntax highlighting via existing --syntax-* CSS variables
  • packages/app/src/components/session/session-context-tab.tsxRawMessageContent updated to use JsonViewer instead 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.