Skip to content

feat(session-ui): collapsible JSON tree view for raw messages in context panel - #38298

Open
jiong-nba wants to merge 3 commits into
anomalyco:devfrom
jiong-nba:collapsible-json-tree
Open

feat(session-ui): collapsible JSON tree view for raw messages in context panel#38298
jiong-nba wants to merge 3 commits into
anomalyco:devfrom
jiong-nba:collapsible-json-tree

Conversation

@jiong-nba

@jiong-nba jiong-nba commented Jul 22, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38288

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The raw messages section in the context panel rendered each message as a flat JSON text block via the File component. Deeply nested structures were hard to scan.

This PR replaces that with a recursive collapsible tree viewer (JsonViewer). Each object/array node gets a chevron toggle; nodes at depth < 2 start expanded so message and parts fields are immediately visible. Parsing is wrapped in createMemo with <Show keyed> so the tree rebuilds reactively when parts stream in. Strings are escaped (\n, \", etc.) and syntax-colored using the existing --syntax-* theme variables. Invalid JSON falls back to plain text.

No new dependencies. The old File + checksum import is removed since it is no longer needed here.

How did you verify your code works?

Ran the app dev server (bun dev in packages/app against a local backend), opened a session, expanded the context panel → Raw messages, and confirmed:

  • Tree renders with correct expand/collapse behavior
  • Streaming messages update the tree reactively
  • Strings with newlines/quotes display escaped
  • Malformed JSON (manually tested by temporarily breaking input) falls back to raw text

Screenshots / recordings

N/A — pure UI behavior change, no visual mockup.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…ext panel

Replace the flat File-based JSON display in the context panel with a
recursive collapsible tree viewer. Top-level nodes (depth < 2) are
expanded by default; deeper nodes are collapsed with a chevron toggle.

- Reactive parsing via createMemo + Show keyed
- Syntax coloring using existing --syntax-* theme variables
- String escaping for \n, \r, \t, quotes, backslashes
- aria-expanded on toggle buttons
- Graceful fallback to raw text on parse failure

Closes anomalyco#38288
Copilot AI review requested due to automatic review settings July 22, 2026 11:57
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jul 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jul 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@jiong-nba
jiong-nba requested a review from Copilot July 23, 2026 08:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…ccessibility

- Replace createMemo + Show keyed with createStore + reconcile so
  streaming updates patch the tree in place without resetting user
  expand/collapse state
- Fire onRendered on every contents change via createEffect(on(...))
  instead of only on initial mount
- Add aria-label to toggle buttons for screen reader support
- Use explicit valid flag instead of truthiness to correctly handle
  root-level primitive JSON values (false, 0, "", null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants