A failed render used to show only a generic "Mermaid render failed" label
plus the fence source, with the actual reason hidden in the hover title —
which makes a bad fence hard to find. Print the first two lines of
mermaid's own message under the label (the full text stays on the title)
and cover it in the fallback spec.
This was triggered by a real document whose diagram used "A 与 B" instead
of mermaid's "A & B" multi-target syntax: the error strip now names the
parse error and the source block points at the broken lines.
Follow-up to the iframe isolation: after that fix a 31-diagram document
still felt janky while scrolling. The remaining cost was work competing
with the scroll gesture:
- background diagram renders kept running during scroll (each one injects
an SVG, runs DOM passes and lays out);
- hidden native tabs kept warming diagrams (tab bodies are keepMounted);
- the inline-HTML and heading-anchor MutationObservers ran a full-document
scan per mutation (measured 8-15 ms per pass, dozens of passes when a
document swaps its diagrams in);
- initial near-viewport detection read one rect per diagram between DOM
writes, forcing a layout per diagram;
- off-screen rendered SVGs still participated in layout and paint.
The queue now pauses background work for 350 ms after the last captured
scroll event, and only schedules renders whose preview is visible
(IntersectionObserver gate per preview; hidden tabs keep placeholders and
wake the queue when shown again, and unmounting a preview drops its queued
tasks). The two mutation passes coalesce bursts into one 80 ms pass.
Initial priorities come from one batched rect read before the swap writes.
.mermaidWrap gains content-visibility:auto + contain-intrinsic-size +
contain:layout paint style, so off-screen diagrams leave layout and paint.
Visible diagrams still render on demand, every diagram is still eventually
rendered, and nothing falls back to a code block.
Mermaid measures every label with SVGElement.getBBox() against a node
appended to document.body, so each measurement flushes the whole host
document's layout. Measured in the live DSH window (15,418 DOM nodes):
59-75 ms per measurement, versus 1 ms in an empty iframe document. One
diagram therefore took 1.5-7.3 s, and a 31-diagram markdown document kept
the renderer main thread blocked for >20 s - long enough for the desktop
shell's surface watchdog to kill the renderer, with tab restoration
turning it into a crash loop. CSS containment on the app root does not
help (59-62 ms); only an independent layout tree does.
Render diagrams inside a hidden sandboxed iframe instead: a self-contained
blob: document (mermaid UMD bundle + a small postMessage protocol, both
inlined by scripts/build-mermaid-frame-asset.mjs) renders each diagram;
the parent only sends/receives and sanitizes the SVG. Diagrams now take
30-104 ms each and 31 diagrams complete in ~5 s in the background, while
the client mermaid chunk shrinks from 7.04 MB to 3.69 MB (minified UMD
replaces the unminified inline bundle).
Also add a shared render queue: visible/near-viewport diagrams first, the
rest filled in on requestIdleCallback with 16 ms main-thread yields between
renders, so every diagram is still rendered (none degrades to a code
block). Fence-line-sized placeholder skeletons reserve height while a
diagram waits. No host-half route changes are needed.
resolveAddressPath() re-spells an address path in the base's separator
style. Folding every separator run into one '\' also folded the UNC share
marker of a \\wsl.localhost\<distro>\... path, turning an absolute network
path into a drive-root-relative one. On Windows the host's requireAbsolute()
then path.resolve()d it onto the host process drive (C:\wsl.localhost\...),
so every file opened from a WSL workspace failed with ENOENT.
Keep exactly the two leading separators of a UNC path and fold only the
rest. Drive paths, POSIX bases and unknown bases are unchanged.
tests/worktree-address.spec.ts pins the UNC absolute, workspace-relative and
forward-slash spellings; the case fails on the previous source and passes
with the fix.
cwdOf() resolves the cwd for every file/Git route, and a cold (detached)
session paid one host observation per call: sessionQuery.observeSession({
projectionMode: 'all' }) decodes the whole zstd artifact and hydrates every
projection to answer with one workingDirectory string. The 0.28.1
single-flight only covered /sidebar/api, while the real startup fan-out
never goes through it: the fs-watch socket sends one frame PER WATCHED
DIRECTORY (server resolves cwd before it even reads the op), /sidebar/file
and /sidebar/html resolve per resource, upload/write per call. A 39 MB
session was therefore decoded dozens of times in parallel — the 44-read
OOM on 0.28.0 and the 36 reads reported against 0.28.1 are the same path,
not a broken dedupe.
A detached session now resolves through sessionPersistence.stat(), which
reads the first zstd frame only (header-only, never the log), memoized per
session id (headers are immutable) and shared in-flight across concurrent
asks. activeWorktreeRootOf() answers a detached session with that address
and no longer folds the stored log. Once the host attaches the session the
committed working_directory and linked-worktree following resume as before.
Trade-off (documented): until attach, the sidebar roots at the original
project rather than the agent's last directory/worktree.
tests/smoke.spec.ts rewrites the cwd group (header ahead of a stale hint,
one header read per session, 12 concurrent asks share one, stat absent or
failing falls back to the hint, live committed directory wins, relative
header cwd still refused) and tests/active-worktree.spec.ts pins that a
detached session performs no persistence read and no git probe.
#1035 (seed trim on a model switch) and #1044 (local images and deliveries)
merged after v0.28.0 and ship in v0.28.1; the changelog and the release
notes now list them and credit their author.
The release notes now carry the contributor table (like v0.28.0); mirror the
per-PR handles in the changelog so the record itself names @lhh010,
@wang-kaopu, @yanzhaohui1999, @finley08, @UNscientific-9, @mvanhorn,
@z11y11w and @WinterXMQ.
cwdOf() resolves the session cwd for all twelve /sidebar routes. On a
detached session every call runs one host observation — the whole log read
plus decode — and the host's cold cache only helps AFTER a read completes,
so a session-switch burst decoded the same multi-MB log N times in parallel
(0.28.0: 39 MB × 44 requests ≈ 1.7 GB, OOM). Concurrent asks for the same
session + client cwd hint now share ONE resolution; there is no TTL (the
host already caches completed cold reads by persistence revision), and the
hint stays in the key so different fallbacks never leak across each other.
tests/smoke.spec.ts pins 12 concurrent calls → 1 observeSession (red before
this change: expected 12 to be 1) and the per-hint key. The dock-fallback
reserve test now clears localStorage per case — a previous case persisted
bottomOpen and made the new click toggle it closed.
- Rewrite the feature list as comparison bullets (editable editor,
enhanced file tree, Changes / Background Tasks / Side Chat / bottom
workbench — none of which the stock sidebar has)
- Split the full release history into CHANGELOG.md / CHANGELOG_EN.md;
READMEs keep only v0.21.1 and link out
- Drop Star History; move the ecosystem section after Community
- Fix stale claims: v0.21.1 is the npm latest stable (not the alpha
channel); drop the untruthful 'built-in browser' hero badge; pin
'^0.21.1' in update / source-install notes
- Condense the install prose and the top IMPORTANT block