Skip to content

refactor(dashboard): drop the editor surface (Stage 2 of #28)#31

Merged
esengine merged 1 commit into
mainfrom
refactor/dashboard-drop-editor
May 1, 2026
Merged

refactor(dashboard): drop the editor surface (Stage 2 of #28)#31
esengine merged 1 commit into
mainfrom
refactor/dashboard-drop-editor

Conversation

@esengine

@esengine esengine commented May 1, 2026

Copy link
Copy Markdown
Owner

Why

The design mockup deleted §7 Editor in #26 — Reasonix's value is the agent loop, not a VSCode-in-a-tab. The code follows. Stage 2 of #28.

Net −1535 LoC across nine files. Dashboard bundle drops from 137 KB to 121 KB.

Removed

  • dashboard/app.jsEditorPanel + the lazy CodeMirror loader (~540 lines), the editor drawer overlay in App, the editor entry in TABS, the openFileInEditor helper, the open-file event-bus path, and the four tool-card path-link click handlers (now plain <code> spans).
  • dashboard/app.css — 590 lines of editor-drawer / file-tree / CodeMirror skin. The .tool-card-path-link hover treatment goes with the click handler.
  • dashboard/codemirror.js — 36-line CDN loader stub, gone.
  • scripts/bundle-codemirror.mjs — the build-time CodeMirror bundler, gone.
  • src/server/api/file.ts — the /api/files + /api/file/<path> endpoints had no consumer outside the editor panel.
  • src/server/router.ts — drops the files / file route cases.
  • src/server/assets.ts — drops the codemirror.js serving branch.
  • package.json — drops dashboard/codemirror.js from the npm files list and the build:cm script.

Out of scope

The new §7 Edit review surface (Stage 4 PR 4.15) will live in dashboard/src/panels/edit-review.tsx and conceptually replaces this slot in the IA, but lands much later in the rollout — Stage 3 (extract shared infra) goes first.

Test plan

  • npm run build — bundles cleanly, dashboard output drops to 121 KB.
  • npm run typecheck — both root + dashboard projects clean.
  • npm run lint — clean (6 pre-existing warnings unrelated).
  • npm test — 1682/1682.
  • Manual: open the dashboard, confirm:
    • No "Editor" tab in the sidebar
    • Clicking a file path in a Chat tool card no longer pops a drawer
    • All other panels still work (Overview, Usage, Sessions, etc.)

The design mockup deleted §7 Editor in #26 — Reasonix's value is the
agent loop, not a VSCode-in-a-tab. The code follows. Net −1535 LoC
across nine files; the dashboard bundle shrinks from 137 KB to 121 KB.

Removed:

- dashboard/app.js — EditorPanel + the lazy CodeMirror loader (~540
  lines), the editor drawer overlay in App, the `editor` entry in
  TABS, the `openFileInEditor` helper, the `open-file` event-bus
  path, and the four tool-card path-link click handlers (now plain
  code spans).
- dashboard/app.css — 590 lines of editor-drawer / file-tree /
  CodeMirror skin. The `.tool-card-path-link` hover treatment goes
  with the click handler.
- dashboard/codemirror.js — 36-line CDN loader stub, gone.
- scripts/bundle-codemirror.mjs — the build-time CodeMirror bundler,
  no longer needed.
- src/server/api/file.ts — the `/api/files` + `/api/file/<path>`
  endpoints had no consumer outside the editor panel.
- src/server/router.ts — drops the `files` / `file` route cases.
- src/server/assets.ts — drops the `codemirror.js` serving branch.
- package.json — drops `dashboard/codemirror.js` from the npm
  files list and removes the `build:cm` script.

Out of scope: the new §7 Edit review surface (Stage 4 PR 4.15)
will live in `dashboard/src/panels/edit-review.tsx` and replaces
this slot in the IA conceptually, but that's later in the rollout.
@esengine esengine added the enhancement New feature or request label May 1, 2026
@esengine esengine merged commit 2ff2262 into main May 1, 2026
2 checks passed
@esengine esengine deleted the refactor/dashboard-drop-editor branch May 1, 2026 10:01
esengine added a commit that referenced this pull request May 1, 2026
Stage 3 PR (consolidated). Originally split across PRs 3.2–3.5 in #28
but each was a 30–60 line leaf extraction — not enough review value
for the PR overhead. Folded the four into one architectural slice.

New files under dashboard/src/lib/:

- use-poll.ts (45 LoC) — typed `usePoll<T>` hook over the api() wrapper.
- bus.ts (65 LoC) — appBus, toastBus, showToast, ToastStack, plus
  reportAppError and the two window error listeners (registered on
  module load, same as before).
- error-boundary.ts (159 LoC) — ErrorOverlay component, ErrorBoundary
  class, buildIssueBody helper. Both consumers of bus.ts.
- markdown.ts (169 LoC) — escapeHtml, SEARCH_REPLACE_RE,
  renderSearchReplace, renderUnifiedDiff, the marked renderer
  customisation, renderMarkdownToString (was inline in
  renderMessageBody), LANG_BY_EXT, langFromPath,
  renderHighlightedBlock, hlLine. Drops the unused previewMarked
  (was only for the Editor that #31 removed).

Other moves:

- types.d.ts — module shims so TypeScript resolves the CDN URL
  imports against npm types. Specific shims for preact, htm,
  marked, highlight.js; wildcard fallback for anything else.
- package.json — preact, htm, marked, highlight.js added as
  devDependencies (types only — runtime still loads from esm.sh,
  tsup keeps them external).
- dashboard/app.js — drops ~500 LoC of moved blocks. renderMessageBody
  stays as a thin wrapper around renderMarkdownToString since it
  needs the Preact-bound `html` template literal.

Bundle output verified: dashboard/dist/app.js still 121 KB, CDN
imports preserved external. 1682/1682 tests pass.
esengine added a commit that referenced this pull request May 1, 2026
Stage 2 (#31) removed the dashboard's editor surface — the
CodeMirror integration that was its only consumer. The 20
@codemirror/* packages have been dead weight in package-lock
since then.

Removed:
  @codemirror/autocomplete, commands, language, search, state,
  theme-one-dark, view, plus 13 lang-* grammars.

Build / typecheck / 1682 tests still green.
esengine pushed a commit that referenced this pull request May 20, 2026
…tems (#1394)

Fixes #1295 — Desktop MCP tools panel crashes with React error #31 ("Objects are not valid as a React child") when `config.json` contains non-string items in the `mcp` array.

Root cause: `readConfig()` does `JSON.parse` without runtime validation, so `cfg.mcp` can contain objects even though it's typed as `string[]`. When `summarizeMcpSpec()` threw on these object inputs, its catch block returned `summary: raw` directly, leaking objects into JSX.

Fix:
- `summarizeMcpSpec` catch block — stringify non-string `raw` before returning.
- `emitMcpSpecs` — filter `cfg.mcp` to string items before mapping.
- `CtxTools` / `PageMCP` — render `summary` / `name` only when string.
- Regression test in `tests/mcp-desktop-react31.test.ts`.

Follow-up tracked separately: tighten `readConfig` with zod schema validation so this boundary check lives in one place.
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
Stage 3 PR (consolidated). Originally split across PRs 3.2–3.5 in esengine#28
but each was a 30–60 line leaf extraction — not enough review value
for the PR overhead. Folded the four into one architectural slice.

New files under dashboard/src/lib/:

- use-poll.ts (45 LoC) — typed `usePoll<T>` hook over the api() wrapper.
- bus.ts (65 LoC) — appBus, toastBus, showToast, ToastStack, plus
  reportAppError and the two window error listeners (registered on
  module load, same as before).
- error-boundary.ts (159 LoC) — ErrorOverlay component, ErrorBoundary
  class, buildIssueBody helper. Both consumers of bus.ts.
- markdown.ts (169 LoC) — escapeHtml, SEARCH_REPLACE_RE,
  renderSearchReplace, renderUnifiedDiff, the marked renderer
  customisation, renderMarkdownToString (was inline in
  renderMessageBody), LANG_BY_EXT, langFromPath,
  renderHighlightedBlock, hlLine. Drops the unused previewMarked
  (was only for the Editor that esengine#31 removed).

Other moves:

- types.d.ts — module shims so TypeScript resolves the CDN URL
  imports against npm types. Specific shims for preact, htm,
  marked, highlight.js; wildcard fallback for anything else.
- package.json — preact, htm, marked, highlight.js added as
  devDependencies (types only — runtime still loads from esm.sh,
  tsup keeps them external).
- dashboard/app.js — drops ~500 LoC of moved blocks. renderMessageBody
  stays as a thin wrapper around renderMarkdownToString since it
  needs the Preact-bound `html` template literal.

Bundle output verified: dashboard/dist/app.js still 121 KB, CDN
imports preserved external. 1682/1682 tests pass.
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
Stage 2 (esengine#31) removed the dashboard's editor surface — the
CodeMirror integration that was its only consumer. The 20
@codemirror/* packages have been dead weight in package-lock
since then.

Removed:
  @codemirror/autocomplete, commands, language, search, state,
  theme-one-dark, view, plus 13 lang-* grammars.

Build / typecheck / 1682 tests still green.
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
…string items (esengine#1394)

Fixes esengine#1295 — Desktop MCP tools panel crashes with React error esengine#31 ("Objects are not valid as a React child") when `config.json` contains non-string items in the `mcp` array.

Root cause: `readConfig()` does `JSON.parse` without runtime validation, so `cfg.mcp` can contain objects even though it's typed as `string[]`. When `summarizeMcpSpec()` threw on these object inputs, its catch block returned `summary: raw` directly, leaking objects into JSX.

Fix:
- `summarizeMcpSpec` catch block — stringify non-string `raw` before returning.
- `emitMcpSpecs` — filter `cfg.mcp` to string items before mapping.
- `CtxTools` / `PageMCP` — render `summary` / `name` only when string.
- Regression test in `tests/mcp-desktop-react31.test.ts`.

Follow-up tracked separately: tighten `readConfig` with zod schema validation so this boundary check lives in one place.
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