Skip to content

refactor(dashboard): migrate Chat + Sessions + chat internals — app.js shrinks 1562 → 125 LoC#39

Merged
esengine merged 1 commit into
mainfrom
refactor/dashboard-panel-chat
May 1, 2026
Merged

refactor(dashboard): migrate Chat + Sessions + chat internals — app.js shrinks 1562 → 125 LoC#39
esengine merged 1 commit into
mainfrom
refactor/dashboard-panel-chat

Conversation

@esengine

@esengine esengine commented May 1, 2026

Copy link
Copy Markdown
Owner

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-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) — depends on ChatMessage from chat-internals. Properly typed.

Bug fix bundled in

ROLE_GLYPH was accidentally dropped during the PR 4.1 strip. Any chat/sessions render would have crashed at runtime with ReferenceError. Tests didn't catch it (no test loads the bundled dashboard). Restored in chat-internals.ts.

Net effect

dashboard/app.js is 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.

…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.
@esengine esengine added the enhancement New feature or request label May 1, 2026
@esengine esengine merged commit cc2b2ef into main May 1, 2026
2 checks passed
@esengine esengine deleted the refactor/dashboard-panel-chat branch May 1, 2026 10:47
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant