This lands the clue collection line on top of origin/dev (v0.32.1, DSH
0.2.2-rc.2). The 14 commits that carried it are squashed into this one
because every one of them overlapped upstream's own changes (version,
19 dictionaries, CHANGELOG), and each intermediate commit would have
failed to compile against rc.2's menu API. The pre-integration head is
kept at backup/clues-uiux-refresh-pre-rebase.
What the feature is:
- a Clues tab that reads local files, Feishu tasks/docs and GitHub
issues/pulls through one source registry, with a scope row, shared
search, filters, paging and stable [[dsh-clue:...]] references;
- one window host for detail, pack management, source configuration,
new pack and sharing (preview and edit are separate paths: a read is
never saved over);
- .cluepack export/import with per-row resolvability previews;
- a source runtime that owns dependency installs and connection
authorization (gh, lark-cli device code) and only probes on an
explicit read;
- the public betterSidebarClues service and the windows capability
(features gains clues / windowHost).
Merged with upstream rather than over it:
- the settings section keeps upstream's start-page takeover group and
this branch's clue sources group; navigation is now six groups;
- the dictionaries keep both sides' new keys (1211 each, verified equal
across all 19), the external-plugin guide and CHANGELOG keep both
histories, and service features list both capability sets.
Adapted to 0.2.2-rc.2:
- menu call sites use anchorPoint instead of getAnchorRect;
- the shared SelectMenu mounts the host menu only while open, because
rc.2's Menu reads the DOM during render and broke server-rendered
settings surfaces;
- the submenu flip workaround stays deleted (the host positions
submenus now), pinned by an updated layout-css assertion.
Version 0.33.0 (three synced spots) with a new 未发布 / Unreleased
changelog section; package.json regains the ./clues export, lib/clues.js
and the uqr dependency that upstream never had.
Gates: typecheck, lint, 5410 unit tests, build, check:consumer-types and
the full mount lane (35 passed) against dsh 0.2.2-rc.2 in Chromium.
Keep the contributor independent-page implementation, but make it opt-in: the default is still one shared page with the session last/newest reattach, and Settings -> Side card -> Side chat can switch to one native page per thread. The descriptor gains a dynamic multiple predicate, native sync re-registers on a flip, and occurrence bindings are read/written only for sidebar://sidechat/<uuid> contentIds so the shared page can never be captured by an old binding.
Markdown syntax now passes data:image/* through the image vocabulary (the host allowlist already accepts it); every other data payload stays inert. The desktop shell's sandboxed HTML preview is self-contained: the trusted top frame fetches the document and its same-origin assets, inlines them, and frames a sandboxed blob instead of a dsh-app route the shell rejects from an opaque subframe. The sandbox never gains allow-same-origin; browser and explicitly-unsandboxed paths are unchanged.
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.
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.