Changeset 0.28.5 (#191)

This commit is contained in:
2026-03-14 22:51:50 +00:00
parent 85d5e3cc13
commit 6f0ad1355c
17 changed files with 2389 additions and 110 deletions

View File

@@ -1,5 +1,62 @@
# Changelog
## [0.28.5] — 2026-03-14
### Summary
Frontend SDK + pipe/filter pipeline. `switchboard-sdk.js` provides a
single-object composition layer (`sw`) over the 15+ platform globals.
Three-stage pipe/filter pipeline (pre-send, post-receive stream,
post-render) formalizes the ad-hoc extension hook model into composable,
priority-ordered, scope-aware transform chains. Backward-compatible
compat shim for existing `ctx.renderers.register()` extensions. ICD
runner gains `sdk` test tier (36 tests).
### New
- **`switchboard-sdk.js`** — SDK core. `Switchboard.init()` returns
`sw` singleton with identity (`sw.user`, `sw.isAdmin`), REST client
(`sw.api.get/post/put/del/stream`), events (`sw.on/once/off/emit`),
theme (`sw.theme.current/mode/set/on`), UI primitives
(`sw.toast/confirm/modal`), and component wrappers (`sw.chat()`).
- **Pipe/filter pipeline** — three composable stages:
- `sw.pipe.pre(priority, fn, opts)` — pre-send: transform user message
before LLM request. Runs on both `sendMessage()` and `regenerateMessage()`.
Context includes `regenerate` flag and `regenerateMessageId`.
- `sw.pipe.stream(priority, fn, opts)` — post-receive: transform each
SSE chunk during streaming. Sync-only for performance.
- `sw.pipe.render(priority, fn, opts)` — post-render: transform rendered
DOM after DOMPurify. Replaces `runExtensionPostRender()` delegation.
- **Filter scoping** — filters declare optional `scope: { channelType: [...] }`
to restrict execution to specific channel types. Scoped-out filters are
skipped with zero overhead.
- **Pipeline introspection** — `sw.pipe.list()` returns all registered
filters by stage with priority, source, scope, call count, avgMs, errors.
- **Extension compat shim** — `ctx.renderers.register(name, { type: 'post' })`
auto-shims into `sw.pipe.render()`. Existing block renderers (mermaid,
katex, csv, diff) continue working through the unchanged `formatMessage()`
path. Shimmed renderers appear in `sw.pipe.list()`.
- **ICD runner `sdk` tier** — 36 tests: boot, identity, REST client,
events, theme, pipe registration, execution ordering, scoping, halt
semantics, error isolation, compat shim, introspection.
### Changed
- `base.html` — SDK script tag added after component scripts. Universal
init block simplified to `Switchboard.init()` call. UserMenu band-aid
(cs15) absorbed into SDK `_hydrateUserMenu()`.
- `app.js``startApp()` calls `Switchboard.init()` (idempotent).
- `chat.js``sendMessage()` and `regenerateMessage()` run pre-send
pipe. New `_buildPreSendContext()` helper.
- `ui-core.js``streamResponse()` SSE loop runs stream pipe per chunk.
- `ui-format.js``runExtensionPostRender()` delegates to render pipe
with fallback to `Extensions.runPostRenderers()`.
- `extensions.js``_registerRenderer()` shims `type: 'post'` renderers
into `sw.pipe.render()`.
- ICD runner version bumped to 0.28.5.0, `sdk` tier added.
## [0.28.4] — 2026-03-14
### Summary