Frontend tool-panel registry + feature slices - #67
Merged
Conversation
… registry Move the domain panel components out of components/ into features/sessions/ and features/retrieval/ slices, each exporting a tool-name -> panel map. features/tool-panel-registry.ts is the composition root that spreads the slice maps together, and message.tsx now does a single registry lookup instead of per-tool branching — adding a tool panel no longer touches message.tsx. The shared session_id input parser moves to lib/extract-session-id.ts; the list_sessions HTML-comment ID extraction (and its rationale) moves into the sessions slice where it belongs. Behavior preserved: panels mount only on output-available, unregistered tools keep the raw ToolCall JSON view, only list_sessions hides raw output, and a failed session_id parse renders no panel. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the hardcoded per-tool branching in
components/message.tsxwith a registry lookup, and moves the domain panel components intofeatures/<name>/slices. Adding a tool panel is now: create the component in its slice + add one map entry —message.tsxnever changes again for new tools.Registry contract
features/tool-panel-registry.tsis the composition root — the only file that imports across feature slices. It spreads each slice'sRecord<string, ToolPanelEntry>map intoTOOL_PANELS.ToolPanelEntryis{ Panel: ComponentType<{ input: unknown; output: unknown }>, hideRawOutput?: boolean }. Wrapper components in each slice own the input/output parsing that previously lived inmessage.tsx.message.tsxdoes a singleTOOL_PANELS[toolName]lookup and renders the panel whenpart.state === "output-available".Slice layout
The
list_sessionsHTML-comment ID extraction (and its rationale comment) moved into the sessions slice, since it's specific to that tool.brain-context-badge.tsxstays incomponents/— it's chat chrome, not a tool panel.Behavior preservation
output-available.<ToolCall>JSON view.list_sessionshides the raw output block (hideRawOutput: true).session_idparse renders no panel (wrapper returnsnull), exactly as before.Verification
pnpm -C frontend format+pnpm -C frontend lint— clean.pnpm -C frontend exec tsc --noEmit— clean.git diff --stat main -- frontend/api/generated— empty (no backend/API changes, no client regen).🤖 Generated with Claude Code