Repository navigation
[PR] fix(dsh): hide the host composer seat while the Context tab is open (#4406) / 打开上下文标签页时隐藏宿主 composer 座位 - #5837
Conversation
…anglei#4406) conversation.view entries own the whole conversation surface, but the host keeps its composer seat (input, todo dock, goal box) pinned under them and offers no registration switch to turn it off. The tab now marks its own scroll container with data-bili-surface and carries a single scoped rule that hides the seat, the same shape dsh's own context pane uses with data-lc-surface. Approval, question and plan-review takeovers keep the seat visible, so a pending prompt is never hidden behind the tab. The client bundle has no DOM lib in its typecheck, so the style injection goes through a narrow globalThis document surface, and the react shim gains useLayoutEffect/useRef for the post-commit marking. tests: the settings harness now defers effects to the end of a render pass (React commits refs before effects run), which the new case relies on.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 #5837 是引用 #4406 的唯一 PR,无已合并或并行的同类修复(#4406 仍 open)。 标签: 结论先行方向正确、实现干净、失败模式优雅降级(即便宿主选择器对不上,最坏也只是「座位照旧显示」= 现状,无崩溃 / 无数据丢失 / 无线上协议影响),测试有牙。CI 静态门禁(typecheck + build + dist 标注/外部检查)ubuntu/windows 已绿;11 个 结构化八问
代码整洁(外部提交从严,逐项过)命名达意( CI 状态(mirror sha 204f79f)
判定可合(待 CI test 分片转绿即由 owner 合并)。无小问题需顺手修,无需要 owner 拍板的决策点(方向与 issue 自提方案一致)。若要更稳,可在合并说明里补一句:宿主选择器以作者真机实测为准;若后续某 dsh 版本座位未被隐藏,则按 issue #4406 建议#1 走宿主侧 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1093-master.f1a4af4 # this exact build
npm install -g billion-context@master # always the newest merged build
|
中文
问题
「上下文」(Context)标签页接管整个会话区后,宿主(dsh)的 composer 座位仍然钉在它下面:输入框、任务条(todo dock)、目标框都还显示着,任务条会浮在上下文面板下方,输入框还会被窗口底边裁掉。
根因
conversation.view注册项会拿走整块会话视图,但宿主没有提供任何「隐藏 composer 座位」的注册开关。dsh 自带的上下文面板(dsh-context)是自己给滚动容器打上data-lc-surface标记、再自带一条 CSS 把座位隐藏掉的;本插件的 Context 标签页没有做这一步,于是座位照常渲染。改动
src/agent/dsh-native-client.ts:Context 标签页在挂载后用useLayoutEffect找到自己所在的[data-conversation-scroll]容器,打上data-bili-surface标记,卸载时移除;同时按需注入唯一一条样式规则,把该容器下的[data-composer-seat]隐藏。规则沿用宿主同款写法,但作用域是自己的属性,不会和 dsh-context 抢同一个节点。:not(:has([data-approval-key],[data-question-key],[data-plan-review-key])):审批 / 提问 / 计划评审这类接管面板出现时座位保持可见,待处理的提示不会被藏到标签页背后。src/agent/dsh-native-client-react-shim.d.ts:补上useLayoutEffect/useRef声明(客户端包不装 react,靠运行时注入)。globalThis.document类型面,而不是裸document。验证
npm run typecheck:通过。npm run build:通过(dist-import-annotations: OK、dist-external: OK)。node --import tsx --test tests/dsh-settings-ui.test.ts:27/27 通过,含新增用例(标记只注入一次、滚动容器被打上标记、规则含 approval/question/plan-review 例外、卸载后标记被移除)。display:none、任务条高度归零、会话区铺满;切回「对话」标签页后座位恢复、任务条重新出现。测试夹具
新增用例需要 effect 在 ref 挂载之后运行(React 语义)。原来的
runEffect在 render 内联执行,此时 ref 还是 null,因此改为把 effect 排到本次 render 结束、树构建完之后统一 flush;resetHooks一并清空队列。Fixes #4406
English
Problem
Once the Context tab takes over the conversation surface, the host composer seat stays pinned underneath it: the input, the todo dock and the goal box keep rendering, so the task bar floats under the context panel and the composer gets clipped by the window edge.
Root cause
A
conversation.viewentry owns the whole conversation surface, but the host exposes no registration switch to hide its composer seat. dsh's own context pane (dsh-context) marks its scroll container withdata-lc-surfaceand ships the CSS that hides the seat itself; this plugin's Context tab never did that, so the seat kept rendering.Changes
src/agent/dsh-native-client.ts: after mount, the Context tab usesuseLayoutEffectto find the enclosing[data-conversation-scroll]container, marks it withdata-bili-surface, and drops the marker on unmount; it also injects one style rule on demand that hides[data-composer-seat]under that container. Same shape as the host's own rule, but scoped to our attribute so the two can never fight over one node.:not(:has([data-approval-key],[data-question-key],[data-plan-review-key])): approval / question / plan-review takeovers keep the seat visible, so a pending prompt is never hidden behind the tab.src/agent/dsh-native-client-react-shim.d.ts: declaresuseLayoutEffect/useRef(the client bundle installs no react; it arrives at runtime).globalThis.documentsurface instead of a baredocument.Verification
npm run typecheck: passes.npm run build: passes (dist-import-annotations: OK,dist-external: OK).node --import tsx --test tests/dsh-settings-ui.test.ts: 27/27 pass, including a new case (style injected once, scroll container marked, rule keeps the approval/question/plan-review exception, marker removed on unmount).display:none, the todo dock collapses to zero height and the conversation area fills the pane; switching back to the chat tab restores the seat and the task bar.Test harness
The new case needs effects to run after refs are attached (React semantics). The old
runEffectran inline during render, where the ref is still null, so effects are now queued and flushed once the tree for that render is built;resetHooksclears the queue too.Fixes #4406