Repository navigation
Conversation
…de switch The mode-switch compensation read the saved collapsed-width snapshot. After Agent mode the host folds its own sidebar track to zero, so the snapshot's fallback rail was subtracted from the rendered column and left the conversation that far underneath .bt-leftcol until a drag remeasured. Follow the visible overlap after layout settles, and expose the docked width for full-width host rows.
|
Review: approved Scope reviewed:
Answers to the review questions1. Idempotency — mathematically convergent, and the convergence is self-arresting. 2. ResizeObserver feedback — bounded. RO fires on size changes, not position changes; margin-left moves the column's position, so the RO chain does not self-excite. The one theoretical path to oscillation (margin affecting the column's width in a shrink-to-fit layout) does not apply to the grid/fixed center column here. Skip conditions cover the moving states: active drag ( 3. Drag authority — preserved. The correction is inert throughout a drag ( 4. Bottom row — lifecycle correct, side effects minimal. 5. Tests and scope — the honest weakness. P2 (suggestions, not blocking)
Not verifiedWindows DSH Desktop itself (verified by the author in macOS DSH web at 1600×900 with the same shell DOM); a filled plugin bottom bar; real-browser automated e2e of the correction loop (none exists in this codebase for shell geometry). |
The layout correction reuses the center column that the plugin adapter stamps instead of querying DSH class fragments, and rechecks after the host settles instead of observing its private frame nodes. The desktop selector guard requires app-loaded code to use only DS Bot data-bt-* contracts.
The correction must not build the shared margin stylesheet: app-ready's fake document has no createElement. The adapter already stamps data-bt-center on the conversation column, so read that attribute directly.
Issue
Fixes #936
Agent
Agent: DS Bot (DeepSeek V4.1 Flash)
What happened / 根因
The Bot column is fixed over the shell, and its compensation is
margin = pushed - frameSnap.collapsedWidth. After switching from Agent mode to Bot mode, the shell folds its own sidebar track to zero (the plugin's shell CSS), butcollapsedWidthstill holds the host's fallback rail (56px here). The conversation column then starts 56px underneath.bt-leftcoluntil a drag remeasures it. The report's own diagnostics and analysis point at the same snapshot-vs-rendered geometry; the shell's full-width bottom row had no compensation either.Before / after / 前后对比
Before — 56px overlap (panel right 280, conversation left 224):

After — 0 overlap (panel right 280, conversation left 280):

The screenshots live on the temporary
fix/936-shotsbranch and can be deleted after merge.What changed / 改了什么
frame-layout.js: addmeasuredLeftInset(panelRight, columnLeft, currentInset), which adds only the overlap still visible.sidebar.js: after the layout settles, measure.bt-leftcol's right edge against the center column's left edge (with its current inset) and add the remaining overlap. Recheck on the next frame, onResizeObserverchanges of the panel, the center column and the host sidebar, on the frame's and the host sidebar'stransitionend, on window resize, and after the slide spring settles. Skip while a drag owns the column or the host is mid-transition, so the drag path stays authoritative.chat-room.js+styles-dsh.js: expose--bt-left-inset(the docked column width) and pad[data-shell-bottom]by it, so a full-width host bottom row is not covered. It resets to 0 when the Bot surface unmounts.data-bt-centerstamp (chatRoom.columns()), not DSH class fragments, so the desktop selector guard stays clean; the host track is rechecked after it settles instead of observing its private frame nodes.Changelog
Switching from Agent mode to Bot mode no longer leaves chat content underneath the Bot sidebar.
How I checked it / 怎么验证的
padding-leftand--bt-left-insetare 280 while the open column is docked (0 when hidden)test/frame-layout.test.js+test/sidebar-switch.test.js: 107/107 pass (adds the settled-inset regression and models the measured host track in the existing spring test)npm test: 8647 tests, 8639 pass, 0 failures from this change; 1 pre-existing memory-test flake (a private Bot drops a legacy frozen snapshot…) that passes alone and is unrelated to the client layoutnode scripts/build-client.mjs --checkandnode scripts/build-link.mjs --checknpm run lint: 0 errorsmust fix: 0http://127.0.0.1:4195/(loopback, session-token protected; not publicly reachable). Before/after screenshots are in the first comment.Assumptions / 假设
activeDragis set, and the drag's own per-frame writes are unchanged.Risks / 风险
margin-lefton the center column, the measured inset adds to it; only positive overlap is added.[data-shell-bottom]padding applies only while this plugin's shell CSS is loaded; it is 0 when the Bot surface is not mounted.Rollback / 回滚
Revert the commit; no storage or protocol change.
未验证 / Not verified
[data-shell-bottom]; the row is empty in this shell, so the bottom-row padding is verified by computed style, not by a filled bar.