diff --git a/CHANGELOG.md b/CHANGELOG.md index ff769f7..4277286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,141 @@ # Changelog +## [0.37.10] — 2026-03-21 + +### Summary + +Scorched earth rebuild of the Chat surface. The old 16-file imperative SPA +(~11,500 lines of `app.js`, `chat.js`, `ui-core.js`, `projects-ui.js`, etc.) +is replaced by a focused Preact surface (8 files) composing the ChatPane kit. +ChatPane kit upgraded with error display, stop generation, regenerate, code +block copy, markdown toolbar, emoji picker, and message pagination. Features +that don't belong on the chat surface (projects, KB management, extensions, +notifications) are deferred — each earns its way back as its own surface or +shell-level feature. + +32 files changed. +774 / −13,615. **Net: −12,841 lines.** + +### New + +- **Chat Surface** (`src/js/sw/surfaces/chat/`) — 8 files: + - `ChatSurface` root — sidebar + workspace + ToastContainer + DialogStack + - `useWorkspace` — active conversation coordinator, sessionStorage restore + - `useSidebar` — channels, chats, folders data; search filter; WS live + updates; CRUD (rename, delete, move-to-folder, create folder) + - `Sidebar` — search bar, "New Chat" button, collapsible Channels section, + collapsible Chats section with folder grouping, context menus, desktop + collapse toggle + - `SidebarChannels` — DMs + named channels, unread badges + - `SidebarChats` — personal AI chats, folder grouping, context menus + (rename, delete, move to folder) + - `ChatWorkspace` — workspace header (sidebar toggle, tools button) + + ChatPane in `standalone=false` mode (surface manages navigation) + - `ToolsPopup` — scrollable category-based tool toggles with persistence, + `useTools` hook loads from API +- **ChatPane Kit enhancements** (4 new components in `chat-pane/`): + - `CodeBlock` — language badge + copy button, code block extraction from + rendered markdown HTML + - `MessageActions` — per-message toolbar: regenerate, copy text, delete. + Appears on hover/focus + - `MarkdownToolbar` — bold, italic, code, code block, link, bullet list, + numbered list, heading, blockquote. Wraps selection with markdown syntax. + Keyboard shortcuts: Ctrl+B, Ctrl+I, Ctrl+E + - `EmojiPicker` — categorized grid (7 categories), search, recently used + (localStorage). Inserts at cursor position +- **ChatPane Kit upgrades** (6 modified files): + - `index.js` — error banner rendered from `error` state, stop button wiring, + new kit re-exports + - `use-chat.js` — `regenerate(msgId)`, `deleteMessage(msgId)`, `loadMore()` + pagination, `hasMore`/`loadingMore` state + - `message-list.js` — "Load older messages" pagination button, scroll + position preservation on prepend, ARIA `role="log"`, regenerate/delete + wiring per message + - `message-bubble.js` — CodeBlock rendering with copy+language badge, + MessageActions toolbar (regenerate/copy/delete), relative timestamps + - `message-input.js` — MarkdownToolbar, EmojiPicker, stop button (replaces + send during streaming), ARIA labels, keyboard format shortcuts + - `markdown.js` — `marked.setOptions()` with GFM+breaks, task list checkbox + rendering via custom renderer +- **UserMenu auto-surface-filtering** — reads `body[data-surface]`, auto- + includes links to all other surfaces (Notes, extensions), filters out the + current surface. Default `handleSelect` navigates via `location.href`. + Every surface gets the same menu minus itself. +- **`sw-chat-surface.css`** — sidebar + workspace flex layout, responsive + mobile overlay, sidebar collapse, tools popup, context menus (~600 lines) + +### Deleted + +**16 JS files (~11,500 lines):** +- `src/js/app.js` (589) — SPA bootstrap, sidebar, init +- `src/js/api.js` (995) — REST client, auth, token management +- `src/js/chat.js` (1,344) — message rendering, streaming, CM6 input +- `src/js/chat-pane.js` (160) — legacy ChatPane wrapper +- `src/js/channel-models.js` (437) — channel model management UI +- `src/js/extensions.js` (506) — extension panel, package management +- `src/js/files.js` (857) — file upload/staging UI +- `src/js/knowledge-ui.js` (556) — knowledge base toggle popup +- `src/js/notifications.js` (431) — notification bell + dropdown +- `src/js/pages.js` (349) — admin page rendering +- `src/js/pane-container.js` (589) — split pane resize manager +- `src/js/panels.js` (454) — side panel registration + lifecycle +- `src/js/projects-ui.js` (2,090) — project sidebar section +- `src/js/tokens.js` (167) — token count display +- `src/js/tools-toggle.js` (245) — tools toggle popup +- `src/js/ui-core.js` (1,699) — core UI: sidebar, messages, context menus + +**5 CSS files (~1,650 lines):** +- `src/css/chat.css` (648) — old chat area, sidebar, workspace, input +- `src/css/chat-pane.css` — legacy chat pane styles +- `src/css/panels.css` — side panel styles +- `src/css/pane-container.css` — split pane layout +- `src/css/notifications.css` — notification bell + dropdown + +### Changed + +- `chat.html` — rewritten from ~387-line SPA scaffold to ~50-line Preact boot + (same pattern as settings/admin/team-admin surfaces) +- `base.html` — removed ` - - + {{/* api.js removed in v0.37.10. Extension surfaces using Switchboard.init() + should migrate to the Preact SDK (sw/sdk/). */}} - - + {{/* ui-core.js + pages.js removed in v0.37.10 */}} {{/* v0.25.0: Component scripts — available on all surfaces */}} - - {{/* note-panel.js + note-graph.js removed in v0.37.9 — see sw/components/notes-pane/ */}} + {{/* chat-pane.js + pane-container.js removed in v0.37.10 — see sw/components/chat-pane/ */}} - {{/* v0.28.5: SDK — composition layer over globals. Must load after all primitives/components it wraps, before extensions.js. */}} diff --git a/server/pages/templates/surfaces/chat.html b/server/pages/templates/surfaces/chat.html index 6ed5253..7f662dd 100644 --- a/server/pages/templates/surfaces/chat.html +++ b/server/pages/templates/surfaces/chat.html @@ -1,52 +1,14 @@ {{/* - Chat surface (Phase 1 bridge). - Server renders the page shell with full SPA scaffold. - Existing SPA JS (app.js, ui-core.js, chat.js, etc.) populates - these pre-built DOM elements with data. - - v0.22.6 fix: The original index.html contained the full scaffold - (1,296 lines). When it was replaced with a redirect stub, this - template needed the scaffold — but it was shipped empty. - This template restores the required DOM structure. + Chat surface (v0.37.10 — Preact). + Replaced the ~387-line SPA scaffold with a single mount point. + Preact ChatSurface component handles all rendering. */}} {{define "surface-chat"}} -{{/* ── Splash / Auth Gate ─────────────────────── - Server-rendered surfaces use /login for auth, so the splash - is hidden by default. Kept as a DOM node so showSplash()/ - hideSplash() in app.js don't crash on null. */}} - - {{/* ── Crash Catcher (visible without devtools) ── */}} -{{/* ── App Container ───────────────────────── */}} -