Changeset 0.37.8 (#220)

Co-authored-by: gobha <jasafpro@gmail.com>
Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
2026-03-21 18:50:04 +00:00
committed by xcaliber
parent b6152fbf5e
commit 2695bb3bdc
18 changed files with 1151 additions and 299 deletions

View File

@@ -1,5 +1,58 @@
# Changelog
## [0.37.8] — 2026-03-21
### Summary
Preact ChatPane kit — composable chat components replacing the old
imperative `chat-pane.js` standalone mode. Every piece (hooks,
components, utilities) independently importable. `ChatPane` is the
default assembly; surfaces import individual pieces for custom layouts.
### New
- **ChatPane kit** (`src/js/sw/components/chat-pane/`) — 9 files:
- `ChatPane` — default assembly: header + messages + input
- `useChat(opts)` — channel state machine (messages, send/receive,
model selection, channel CRUD)
- `useStream()` — SSE ReadableStream parser with rAF-batched updates
- `MessageList` — scrollable messages with auto-scroll-to-bottom
- `MessageBubble` — single message with role styling + markdown
- `MessageInput` — auto-resize textarea, Enter-to-send, handleRef
- `ModelSelector` — model dropdown from `sw.api.models.enabled()`
- `ChatHistory` — channel history select + new-chat button
- `renderMarkdown``marked` + `DOMPurify` wrapper with fallback
- **`sw.chatPane(container, opts)`** — SDK mount helper, lazy-imports
Preact ChatPane, returns imperative handle
- **`sw-chat-pane.css`** — component styles with `sw-` prefix convention
- **Layer 1.5: Components** — `src/js/sw/components/` directory
established for reusable compound components (between SDK and surfaces)
### Changed
- `switchboard-sdk.js``sw.chat()` now prefers `window.sw.chatPane()`
when new SDK is loaded, falls back to legacy `ChatPane.mount()`
- `chat-pane.js` — stripped standalone mode (446 → 160 lines). Removed
`mount()`, `_initStandalone()`, and all streaming/model/history logic.
Retained DOM-binding `create()` for legacy chat surface (`app.js`)
- `server/version.go` — version `0.37.6``0.37.8`
- `VERSION``0.37.6``0.37.8`
- `src/js/sw/sdk/index.js``sw.chatPane()` helper, `sw._sdk``0.37.8`
- `server/pages/templates/base.html` — added `sw-chat-pane.css` link
### Design Notes
- **Kit of Parts + Default Assembly** — every hook and component is
independently importable. Future Chat surface (v0.37.10) will import
`useChat`, `useStream`, `MessageList`, `MessageInput` individually
with a completely different layout.
- **handleRef pattern** — core Preact only exposes `{ h, render }`;
`forwardRef` requires `preact/compat`. Components use a `handleRef`
prop pattern instead: caller passes `{ current: null }`, component
populates with imperative methods via `useEffect`.
---
## [0.37.7] — 2026-03-21
### Summary