The transcript moves aside for the docked Session panel
正文为停靠的会话面板移开
The [Session panel](2026-11-05-session-panel.md) docked only in a 348px end gutter. With the default transcript width that takes a Chat frame 1576px wide, and the left sidebar takes 280px of the window, so no window under about 1860px docks the panel in the gutter alone. On 1440px, 1512px, and 1728px windows it showed only as the overlay, which closes on the next press outside it. A reader who wants running subagents
English
Problem
The Session panel docked only in a 348px end gutter. With the default transcript width that takes a Chat frame 1576px wide, and the left sidebar takes 280px of the window, so no window under about 1860px docks the panel in the gutter alone. On 1440px, 1512px, and 1728px windows it showed only as the overlay, which closes on the next press outside it. A reader who wants running subagents, background jobs, or change requests in view while working could not keep the panel open at those widths.
Decision
While the docking preference is on and the end gutter is narrower than 348px, the Conversation body keeps that gutter free: the transcript column and the composer move toward the start edge by the missing gutter, at their own widths, and the panel docks in it. The body makes no room when that would leave less than the column's 32px side inset before it; the panel then hides, and the toggle opens it as the overlay. The column never narrows for the panel. The header toggle turns the docking preference off, which hides the panel and centers the transcript again. Nothing else opts in: the panel docks wherever it has room.
The body owns the room, and the panel asks for it
ui-conversation owns the transcript's width axis, the scrollport, and the width handles, so it owns the room. A stylesheet asks for it by setting --dsh-chat-end-reserve on the Conversation body; the body derives --dsh-chat-end-inset, the scrollport's end padding, and --dsh-chat-end-reserve-max, the largest reserve the start gutter can give. The panel's stylesheet sets the reserve to 348px through a :has() rule that matches while its dock probe carries a mark, so the request needs no Slot prop and no render in the Chat View.
The body derives those lengths from the scrollport's width, which it measures and publishes as --dsh-conversation-viewport-width. Three boxes read the inset: the scrollport for its padding, the width handles in the body, and the ui-chat aside layer, which reaches back across the inset so the panel sits at the scrollport's end edge. A length written with percentages resolves against a different box in each of them, and the scrollport's own content box changes with the inset. A measured pixel width gives all three the same value and does not change when the inset does.
One probe whose answer does not depend on the room made
The panel's dock probe is 1px wide while the gutter holds the panel, or while the body's largest reserve covers that gutter. The second term reads the scrollport's width and the content width, not the inset, so the answer is the same before and after the transcript moves: the room the transcript makes cannot change the decision that asked for it, and the layout cannot oscillate. The plugin's state, its toggle, and its overlay rules are those of the gutter-only panel; only what its stylesheet counts as room widened.
Width handles beside the docked panel
The handles follow the column: their positions take half the inset, and each takes its width from the gutter on its own side. While the body makes room, the reserve holds the column's end edge, so a drag moves only the start edge, and the width changes by the pointer's travel instead of twice it, on either handle. A column dragged wider than the start gutter can give takes its room back: the panel hides and the column centers, as a column dragged wide already hid the panel docked in the gutter.
One motion for the panel and the transcript
A press that shows or hides the panel plays its entrance or exit, and the transcript moves over the same 160ms and curve: the panel's stylesheet sets --dsh-chat-end-reserve-transition on the Conversation body while the animation runs, and the scrollport's padding and the aside layer's margin both take their transition from it. The panel tells a press from a change of room by comparing renders: what it shows changed while its room stayed the same. A change of room shows or hides the panel at once, which covers a mount, a switch to another Session, a resized window, and a dragged transcript width.
Alternatives considered
- A pin that opts in to making room. The panel would dock at laptop widths only after the reader found and pressed a pin on it. In a wide window the pin changes nothing visible, and until it is pressed the default at laptop widths stays an overlay that closes on the next press. The panel docks wherever it can instead, and the toggle is the one control that hides it.
- Narrowing the column for the panel. A floor such as 480px docks the panel in narrower frames, but it changes the reading width without the reader asking and makes the column's width depend on the panel as well as on the width the reader dragged. The column keeps its width, and a frame that cannot give the room shows the overlay.
- The docked panel covers the transcript. It needs no layout change, but on a 1440px window the panel covers about 83px of the transcript column, and the actions at the end of each message, for as long as it shows.
- A measured reserve passed through Slot props. The Conversation body, the Chat View, and the aside would each forward a callback for one consumer, and every change of the reserve would render the Chat View. A custom property needs neither.
- Percentages without a published width. The inset would differ between the scrollport, the width handles, and the aside layer, and the largest reserve would read a width that the inset itself narrows.
- A second probe and a room type in the plugin's state. The plugin would track the gutter and the reserve apart. Nothing reads them apart, so one probe reports their union and the plugin's interfaces stay as they were.
- No width handles while the transcript makes room. The handles' positions stay simple, but the panel docks by default at laptop widths, so the reader would lose the width drag there.
- A transition that is always on. The inset follows the window and the dragged width every frame, so a standing transition makes the transcript trail the pointer during a resize or a width drag, and it would animate across a Session switch. The transition is on only while a press shows or hides the panel.
- Animating when the window crosses the width that makes room. The inset steps there inside the stylesheet, one frame before the panel learns of it, so the transcript would jump while the panel animated. Both change at once instead.
- Making room in embedded Chat Views. An embedded transcript's width is a percentage of its frame, so the inset would need that frame's own measure, and embedded frames are rarely wide enough. An embedded Chat View makes no room.
Consequences
- The panel stays beside the transcript at laptop widths without a press. On a 1440px window with the sidebar open, the 742px column keeps its width and sits 143px toward the start edge while the panel is docked.
- A reader who wants the transcript centered hides the panel from the toggle.
- With the default transcript width the panel docks from a Chat frame about 1068px wide; below that, and beside a transcript dragged wide, it is the overlay it was.
- A width drag beside the docked panel moves one edge of the column, not both.
- The transcript's motion re-lays it out on each of about ten frames. Beside the longest recorded Session, 790 elements, no frame took longer than 9.3ms; a much longer transcript has not been measured.
ui-conversationpublishes the scrollport's width and two derived lengths, pads its scrollport's end, and moves its width handles;ui-chat's aside layer has an end margin and a gutter that counts the inset. Neither renders or observes anything more for them.
Testing
Unit specs read the three stylesheets and evaluate the reserve, the inset, the gutter, the probe, and the handles around their boundaries, and drive a width drag at both scales. apps/web/tests/session-panel-layout.e2e.ts measures the shipped Web composition: the column, the composer, the width handles, the probe, and the panel across the gutter that holds the panel, the frames that make room, the last frame that can and the first that cannot, a reload, the toggle, and width drags that keep, lose, and regain the room.
中文
Problem
会话面板原先只在 348px 的末端留白里停靠。默认正文宽度下,这要求 Chat 外框宽 1576px,而左侧栏占去窗口 280px,因此约 1860px 以下的窗口都无法只靠留白停靠面板。在 1440px、1512px 和 1728px 的窗口里,面板只能以浮层显示,在面板外按下指针就会关闭。想在工作时一直看到运行中的子智能体、后台任务或变更请求的用户,在这些宽度下无法让面板保持打开。
Decision
停靠偏好开启、且末端留白窄于 348px 时,Conversation 主体空出这段留白:正文列和输入框保持各自宽度,向起始边缘移动所缺的留白,面板停靠在其中。如果移动后正文列之前剩不下它的 32px 侧边内边距,主体不让位;此时面板隐藏,按开关以浮层打开。正文列不会为面板变窄。标题栏开关关闭停靠偏好,面板随之隐藏,正文恢复居中。除此之外没有别的开关:面板在有位置的地方都会停靠。
位置归主体所有,面板提出申请
ui-conversation 拥有正文的宽度轴、滚动容器和宽度手柄,因此这段位置也归它所有。样式表在 Conversation 主体上设置 --dsh-chat-end-reserve 来提出申请;主体据此推出滚动容器的末端内边距 --dsh-chat-end-inset,以及起始留白能让出的最大预留 --dsh-chat-end-reserve-max。面板的样式表通过一条 :has() 规则把预留设为 348px,该规则在停靠探针带有标记时匹配,因此申请不需要 Slot 属性,也不会让 Chat 视图重新渲染。
主体从滚动容器的宽度推出这些长度;它测量该宽度并发布为 --dsh-conversation-viewport-width。有三个盒子读取内边距:滚动容器用它作内边距,主体中的宽度手柄用它定位,ui-chat 的侧边层用它越过内边距延伸回去,让面板位于滚动容器的末端边缘。用百分比写出的长度在这三处会按不同的盒子解析,而滚动容器自身的内容盒又随内边距变化。测量得到的像素宽度让三处取得同一个值,并且不随内边距改变。
一个探针,结果不受让出的位置影响
留白放得下面板,或者主体的最大预留覆盖这段留白时,面板的停靠探针宽 1px。第二项读取的是滚动容器的宽度和正文宽度,而不是内边距,因此正文移动前后结果相同:正文让出的位置不会改变提出让位的那项判断,布局也不会来回振荡。插件的状态、开关和浮层规则与只靠留白停靠时相同,只是样式表认定的「有位置」范围变大了。
停靠面板旁的宽度手柄
手柄跟随正文列:它们的位置计入内边距的一半,各自的宽度取自所在一侧的留白。主体让位期间,预留固定了正文列的末端边缘,因此拖动只移动起始边缘,无论拖哪个手柄,宽度的变化都等于指针移动的距离而不是它的两倍。正文列被拖到超过起始留白能让出的宽度时会收回位置:面板隐藏,正文列居中;这与原先把正文拖宽会隐藏停靠在留白里的面板一致。
面板和正文做同一个动作
用户的一次按下让面板显示或隐藏时,面板播放进入或退出动画,正文在同样的 160ms 内按同一条曲线移动:动画期间,面板的样式表在 Conversation 主体上设置 --dsh-chat-end-reserve-transition,滚动容器的内边距和侧边层的外边距都从它取得过渡。面板通过比较两次渲染来区分按下和空间变化:显示与否变了,而停靠空间没变。空间变化时面板立即显示或隐藏,这涵盖了挂载、切换到另一个会话、缩放窗口和拖动正文宽度。
Alternatives considered
- 用图钉选择是否让位。 用户要先找到并按下面板上的图钉,面板才会在笔记本宽度下停靠。在宽窗口里图钉没有任何可见效果;按下之前,笔记本宽度下的默认状态仍是点一下就关闭的浮层。现在面板在有位置的地方都会停靠,隐藏它只用开关这一个控件。
- 为面板收窄正文列。 设一个下限(例如 480px)可以让面板在更窄的外框里停靠,但会在用户没有要求的情况下改变阅读宽度,并且让正文列的宽度既取决于用户拖出的宽度,又取决于面板。正文列保持宽度,给不出位置的外框使用浮层。
- 停靠的面板盖在正文上。 不需要改动布局,但在 1440px 的窗口里,只要面板显示,就会一直遮住正文列约 83px 以及每条消息末尾的操作按钮。
- 通过 Slot 属性传递测量出的预留值。 Conversation 主体、Chat 视图和侧边层都要为这一个使用方转发回调,预留值每次变化还会让 Chat 视图重新渲染。自定义属性两者都不需要。
- 只用百分比,不发布宽度。 内边距在滚动容器、宽度手柄和侧边层中会取得不同的值,而最大预留读到的宽度又会被内边距本身收窄。
- 第二个探针,并在插件状态里区分两种位置。 插件要分别记录留白和预留。没有任何地方需要区分它们,因此用一个探针报告两者的并集,插件的接口保持不变。
- 正文让位期间不提供宽度手柄。 手柄的定位更简单,但面板在笔记本宽度下默认停靠,用户在这些宽度下就无法拖动宽度。
- 始终开启过渡。 内边距每一帧都跟随窗口宽度和拖出的正文宽度,常开的过渡会让正文在缩放窗口或拖动宽度时落后于指针,切换会话时也会带上动画。过渡只在一次按下让面板显示或隐藏的期间开启。
- 窗口越过能让位的宽度时播放动画。 内边距在样式表里于这个宽度上阶跃,比面板得知这件事早一帧,因此正文会先跳、面板再做动画。现在两者都立即变化。
- 在嵌入的 Chat 视图中让位。 嵌入的正文宽度是其外框的百分比,内边距需要该外框自己的测量值,而嵌入的外框很少够宽。嵌入的 Chat 视图不让位。
Consequences
- 面板在笔记本宽度下无需任何操作就留在正文旁。在侧栏展开的 1440px 窗口里,面板停靠时 742px 的正文列宽度不变,向起始边缘偏移 143px。
- 希望正文居中的用户用开关隐藏面板。
- 默认正文宽度下,Chat 外框约 1068px 宽起面板停靠;更窄时,或者正文被拖得很宽时,面板仍是原来的浮层。
- 在停靠面板旁拖动宽度时,正文列只移动一侧边缘,而不是两侧。
- 正文的移动在大约十帧里每帧都重新排版。在已录制的最长会话(790 个元素)旁,没有一帧超过 9.3ms;更长的对话没有测量过。
ui-conversation发布滚动容器的宽度和两个推出的长度,给滚动容器的末端加内边距,并移动它的宽度手柄;ui-chat的侧边层多了末端外边距,其留白包含内边距。两者都没有为此增加渲染或观察。
Testing
单元测试读取三份样式表,并在边界附近计算预留、内边距、留白、探针和手柄的取值,还以两种比例驱动一次宽度拖动。apps/web/tests/session-panel-layout.e2e.ts 在随产品发布的 Web 组合中测量正文列、输入框、宽度手柄、探针和面板,覆盖放得下面板的留白、需要让位的外框、最后一个能让位和第一个不能让位的外框、刷新页面、开关,以及保持、失去和重新获得位置的宽度拖动。