refactor(dashboard): migrate Chat + Sessions + chat internals — app.js shrinks 1562 → 125 LoC#39
Merged
Merged
Conversation
…s shrinks 1562 → 125 LoC Stage 4 PR 4.6 from #28. The largest single migration: ChatPanel + SessionsPanel + all 7 modals + ToolCard + ChatMessage + diff helpers move out of app.js into typed modules. - components/chat-internals.ts (541 LoC) — ROLE_GLYPH, ToolCard, ChatMessage, ModalCard, 7 modal components (ShellModal, ChoiceModal, PlanModal, EditReviewModal, WorkspaceModal, CheckpointModal, RevisionModal), plus lineDiff/pairDiffRows helpers used by EditReviewModal. Carries `// @ts-nocheck` for bulk migration; type tightening is a follow-up. - panels/chat.ts (784 LoC) — ChatPanel + summarizeActiveTool + InFlightRow + ChatStatusBar. Same @ts-nocheck rationale. - panels/sessions.ts (128 LoC) — SessionsPanel; depends on ChatMessage from chat-internals. Properly typed. Bug fix: ROLE_GLYPH was accidentally dropped during PR 4.1 (small panels) when the strip cut its definition along with the chat banner comment. ChatMessage would have crashed at runtime with ReferenceError on any chat / sessions render. Tests didn't catch it because no test loads the bundled dashboard. Restored in chat-internals.ts. Cleanup: dashboard/app.js trimmed to a 125-line shell — imports + TABS array + the App component (sidebar + tab routing + error boundary + toast stack). The @ts-nocheck pragmas in chat-related files are explicitly tagged "tighten in follow-up". Bundle: 122 → 123 KB (ROLE_GLYPH restoration). 1682 tests pass.
This was referenced May 1, 2026
esengine
added a commit
that referenced
this pull request
May 1, 2026
…parseToolArgs PR #39 (Chat migration) extracted ChatPanel into panels/chat.ts with a `@ts-nocheck` pragma. Four references the original function had via global lexical scope in app.js were silently missed at extraction time: - MODE — used in the placeholder text at line 448 - TOKEN — used to build the SSE EventSource URL at line 126 - appBus — used in a navigate-tab dispatch at line 545 - parseToolArgs — used in summarizeActiveTool at line 641 @ts-nocheck masked all four ("cannot find name" errors are suppressed by the pragma), and tests don't load the bundled dashboard, so it shipped. The runtime symptom is the error overlay reproduced in the user's bug report: ReferenceError: MODE is not defined at ChatPanel ... Restored as named imports from `../lib/api.js`, `../lib/bus.js`, and `../components/chat-internals.js`. parseToolArgs was previously a private helper inside chat-internals.ts; promoted to a named export so panels/chat.ts can reach it. Verified by temporarily removing the @ts-nocheck and running typecheck — zero "Cannot find name" errors after this fix. 1682 tests still pass.
ChasLui
pushed a commit
to ChasLui/DeepSeek-Reasonix
that referenced
this pull request
May 23, 2026
…parseToolArgs PR esengine#39 (Chat migration) extracted ChatPanel into panels/chat.ts with a `@ts-nocheck` pragma. Four references the original function had via global lexical scope in app.js were silently missed at extraction time: - MODE — used in the placeholder text at line 448 - TOKEN — used to build the SSE EventSource URL at line 126 - appBus — used in a navigate-tab dispatch at line 545 - parseToolArgs — used in summarizeActiveTool at line 641 @ts-nocheck masked all four ("cannot find name" errors are suppressed by the pragma), and tests don't load the bundled dashboard, so it shipped. The runtime symptom is the error overlay reproduced in the user's bug report: ReferenceError: MODE is not defined at ChatPanel ... Restored as named imports from `../lib/api.js`, `../lib/bus.js`, and `../components/chat-internals.js`. parseToolArgs was previously a private helper inside chat-internals.ts; promoted to a named export so panels/chat.ts can reach it. Verified by temporarily removing the @ts-nocheck and running typecheck — zero "Cannot find name" errors after this fix. 1682 tests still pass.
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.
Stage 4 PR 4.6 from #28. Largest single migration: ChatPanel + SessionsPanel + 7 modals + ToolCard + ChatMessage + diff helpers move into typed modules.
New files
components/chat-internals.ts(541 LoC) — ROLE_GLYPH, ToolCard, ChatMessage, ModalCard + 7 modal components, lineDiff/pairDiffRows helpers used by EditReviewModal.// @ts-nocheckfor bulk migration; type tightening is a follow-up.panels/chat.ts(784 LoC) — ChatPanel + summarizeActiveTool + InFlightRow + ChatStatusBar. Same @ts-nocheck rationale.panels/sessions.ts(128 LoC) — depends on ChatMessage from chat-internals. Properly typed.Bug fix bundled in
ROLE_GLYPHwas accidentally dropped during the PR 4.1 strip. Any chat/sessions render would have crashed at runtime withReferenceError. Tests didn't catch it (no test loads the bundled dashboard). Restored in chat-internals.ts.Net effect
dashboard/app.jsis now 125 lines — pure shell: imports, TABS array, App component (sidebar + tab routing + error boundary + toast stack). Down from 4768 LoC at the start of #28.Closes part of #28.