Skip to content

[PR] feat: dsh-context coexistence — own tab name, softer banner with repo link, host-plugin contract docs (#4319) - #4327

Closed
ranxianglei wants to merge 3 commits into
masterfrom
2026-10-22_dsh-coexistence-tab-docs
Closed

ranxianglei wants to merge 3 commits into
masterfrom
2026-10-22_dsh-coexistence-tab-docs

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Implements the owner's decisions on #4319 (coexistence with dsh-context: tab name collision, banner cross-linking, status contract docs). All five optional suggestions were triaged; decisions are recorded in the issue thread.

Changes

1. Tab renamed to bili's own name (behavior change)

  • dsh session tab label: 上下文 → 压缩代理 (zh), Context → Compression (en) — src/agent/dsh-native-client.ts
  • Unconditional rename removes the two-identical-tabs collision without any config surface (ui.tabLabel/ui.order/ui.tab withdrawn per owner decision). Slot id (bili-context) / order (30) / locale unchanged.
  • Label pin updated: tests/dsh-settings-ui.test.ts

2. Host-plugin banner (detection notice)

  • Neutral coexistence wording in both locales: the two calibers are complementary ("where the tokens come from" vs "what actually reaches the model"), not competing — drops the old implication that the other side's numbers don't match what is sent.
  • New optional repoUrl on detected notices (dsh-context → its GitHub repo); the banner renders an escaped 仓库/repository anchor next to the plugin name. Additive: notices without repoUrl render byte-identically to before.

3. Config page note

  • One line under the config page title: the host-side segment composition / timeline view is provided by dsh-context (when installed); this page only manages the compression proxy. i18n zh+en.

4. Docs — stable host-plugin contract

Behavior change disclosure

  • Default dsh tab label: 上下文/Context → 压缩代理/Compression (all dsh users, cosmetic).
  • Banner wording changed in both locales (softer coexistence framing) + repository link added next to the plugin name.
  • Overview payload: hostPluginNotices[] items may now carry an additional repoUrl string (additive JSON field).

Validation

  • typecheck clean; build green; targeted suites green locally (tests/dsh-settings-ui.test.ts, tests/issue2861-host-plugin-notice.test.ts, tests/web-i18n.test.ts — 53/53 on the rebased head: the original 48 plus [PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238's 5 new tests). Full-suite verdict = remote CI.
  • No config surface added. No kernel changes. No wire protocol change (admin JSON additive only).

Rebase note (post-#4238 merge)

Rebased onto master after #4238 (dsh.contextTab / dsh.contextTabLabel knobs) merged; second commit aligns #4238's references with the renamed built-in tab label — its docs/tests/comments stated the built-in name 「上下文」/「Context」 as fact, now 「压缩代理」/「Compression」. The two PRs compose: default shows 压缩代理/Compression out of the box; #4238's knobs stay as escape hatches (hide the tab or set any custom name). README contract section also notes that /bili/origin bodies carry the #4237 face flags (internal, ignore).

Closes #4319

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-22_dsh-coexistence-tab-docs (74d6ef5)

Latest build — install this exact version

npm install -g billion-context@0.0.5350-pr.4327.6d6c05b

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
74d6ef5 billion-context@0.0.5350-pr.4327.6d6c05b build
2aa32c6 billion-context@0.0.5335-pr.4327.1ece4af build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4327.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重:不重复 —— 本 PR 是 #4319 的唯一实现入口(该线程五条建议全部收敛于此);本审核发现的 master 红 CI 问题已有记录在案(#4326,修复在途 #4174/#4330),未另立条目。
标签:dsh + scope/ui + p3(dsh 车道 UI 面 + 文档补齐的功能 PR,体验打磨级,无功能影响)。

审核结论摘要

代码、测试、契约文档本身通过审核,无需返工;但发现一个流程级阻塞项:与在途 PR #4238 就同一个 tab 命名问题给出互相矛盾的解法,两者不能按现状同时合入——合并顺序需要你拍板(见下)。除此之外没有缺陷。

① 方向关 —— 与 #4238 的冲突(唯一阻塞项)

同一症状(两个同名「上下文」tab)先后有两个拍板、两个 PR:

时间线 拍板 PR 状态
#4237 线程 早(10-22 凌晨) 提供改名+隐藏设置,默认不改名 #4238(dsh.contextTab + dsh.contextTabLabel,默认零变化) open,CI 全绿
#4319 线程 晚(10-22 下午) 固定改名「压缩代理」,撤掉 ui.* 配置面 本 PR #4327(无条件改名,零配置) open

矛盾点在默认标签值:两者都合入的话,后合入者必然破坏先合入者的文档化默认行为(#4238 的 CONFIGURATION.md 写明内置名「上下文」),且二者在 src/agent/dsh-native-client.ts 的同一段 i18n 上文本冲突。我的建议(供你拍板):

  1. 先合本 PR(更晚、更具体的拍板优先;报告人还本地临时改 bundle 验证过观感),随后返工 [PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238:删掉 dsh.contextTabLabel(内置名已有辨识度,该键动机消失);dsh.contextTab 隐藏开关是否保留由你定——[Feature] DSH: The top "Context" tab shares its name with another plugin. Could it be merged into the "Memory System" pa | [Feature] DSH:顶部「上下文」标签页与另一插件重名,能否并入「记忆系统」页 #4237 第 4 条「请提供一个开关」的诉求并未被 [Feature] Coexistence with dsh-context: Session tab name collision, cross-linking, and /__bili/plugin/status contract (o | [Feature] 与 dsh-context 共存:会话标签页重名、互链与 /__bili/plugin/status 契约(可选) #4319 拍板明确否决。若都不留,[PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238 以 superseded 关闭。
  2. 或先合 [PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238、再把本 PR 的改名改成其回退链上的内置默认值改动——但这与 [Feature] Coexistence with dsh-context: Session tab name collision, cross-linking, and /__bili/plugin/status contract (o | [Feature] 与 dsh-context 共存:会话标签页重名、互链与 /__bili/plugin/status 契约(可选) #4319 线程明确的「固定改名」相悖且多一轮返工,不推荐。

顺带指出一个流程缺口:#4319 分诊时的查重声明为「不重复」,但当时 #4209/#4237 + 在途 PR #4238 已在处理同一个 tab 重名症状——分诊只看到了创建该 tab 的 #3862,漏掉了处理重名的那一批。本次审核把两条线程对照补齐了。

② 回归审查(既有行为清点)

  • slot 注册:id bili-context / order 30 / locale 均不变,仅 i18n 字符串变化 → 宿主匹配逻辑不受影响 ✅
  • 不带 repoUrl 的 notice 渲染与之前逐字节一致:原转义断言测试原样通过 ✅
  • [Bug] host-plugin notice 文案过宽:实测 dsh-context 头部与 contextTokens 相符(14 ms 内),只有分段构成条是压缩前口径 #3303 措辞约束(保留「分段构成」、不得再断言对方数值不准确)保留,并被新测试加钉 ✅
  • i18n zh/en 键集对偶性:dead-key lint 通过 ✅
  • /__bili/plugin/status 路由语义与管理闸门:零代码改动,纯文档新增 ✅
  • 高危模式逐项过:无修历史问题顺带改语义、无 fail-fast 变吞错、无阈值/时序/输出格式漂移;overview payload 的 repoUrl 为增量 JSON 字段,旧客户端自然忽略 ✅

③ 代码审查(主关)

10 个文件逐行通读(+91/-17):

  • 黄条锚点渲染 href 属性与标签文本都过 escapeHtml,测试断言了 "onload=" 中性化与 <r> 标签转义——真断言,不是假测试 ✅
  • repoUrl 可选字段贯穿类型→检测→渲染全链,缺省路径与现状完全一致,「additive」声明成立 ✅
  • 4 个新测试各有牙齿:URL 携带/缺失、标签有/无、双语措辞约束,各自钉住一条回归路径 ✅

③b 契约文档 vs 代码核对(本 PR 的核心交付)

README 新增小节逐条对源码核实:

  • /bili/origin:三种响应形态(已绑定 origin / {origin:null,relay:true} relay 态 feat: support a public panel origin for remote / reverse-proxied deployments | feat: 远程/反代场景下面板不可用(headless 宿主 + 远程浏览器时 iframe 指向 127.0.0.1) #3373 / {origin:null} 启动中)与 dsh-native.ts 的 originRoute 实现逐字一致;404(更老宿主构建无此路由)情形成立 ✅
  • /__bili/plugin/status:稳定字段集(18 字段)与实际成功响应完全一致,且与 PLUGIN.md §4 文档化字段集一致(含 §4 正文说明、JSON 示例里缺席的 compressibleRanges);错误形态 400 "conversationId query parameter is required"、404 "unknown plugin conversation"、fallback=latest 的 "no session with activity since boot …"、phase: pre-first-request / chain-advisory 均与实现字符串逐字一致 ✅
  • 访问限制(loopback 连接 + loopback Host 名忽略端口 + 浏览器 Origin ∈ loopback http(s) 或 dsh-app://app + 非浏览器受信 Host + CORS 回显)与 admin.ts 闸门实现一致。一处细微差别:显式绑定到非 loopback 自定义主机名时该主机名也进受信集合——README 描述的是默认部署的一般情形,可接受,不要求改 ✅
  • 实验性/内部字段(panel / webUrl / contextView 等)正确排除在契约之外 ✅

④ 测试有效性

既有断言是更新而非删除(label pin 从「上下文」改为「压缩代理」),无恒真断言;行为变更(改名、措辞、链接渲染)都有测试钉住。

⑤ diff 整洁度

10 个文件全部服务于本 PR 目的,无跑题文件、无空白噪音、无锁文件/生成物。干净。

CI 判定

PR head 的红继承自 master 红,与本 PR 无关:head 与 master tip(aa198fe61)两次运行的失败签名逐条相同——6 个 test 分片死于 LIVE_FILES 未登记的 spawn-test 跳闸、mysql-contract 死于该 lane 未构建 kernel/dist,正是 #4326 的两个子缺陷 A/B,修复在途(#4174 + #4330,均 open)。head 上全部静态门禁绿。待两个修复 PR 合入、master 转绿后,在本分支推一次 trivial update 即可拿到干净的全量结果。

本地验证

在 PR head b6b7a50 实测:typecheck clean;定向套件 dsh-settings-ui + issue2861-host-plugin-notice + web-i18n = 48/48 通过(与 PR 声称数字一致)。全量判定以远程 CI 为准。

八问

  1. 是什么问题:bili 与 dsh-context 并存时会话顶部出现两个同名「上下文」tab,用户分不清哪个答 wire 口径;另外两条被第三方实际使用的只读路由从未写成对外契约,别的插件只能逆向。
  2. 什么原因导致的:tab 当年用了通用词「上下文」,没考虑同槽位会有同名插件;黄条文案以「解释对方数字为何对不上」的视角写;两条路由从内部需求长出来,稳定后没人接手文档。
  3. 影响范围与严重程度:tab 改名对全体 dsh 用户可见(纯视觉,PR 体已披露);黄条措辞/链接影响装了 dsh-context 的 dsh 用户;契约文档面向第三方插件开发者。严重度 = 体验混淆 + 契约缺失,无功能缺陷(p3)。
  4. 怎么修复的:无条件固定改名(slot id/order 不动);notice 携带可选 repoUrl、黄条渲染转义锚点(缺省即现状逐字节一致);配置页标题下一行说明;README 新增 Host plugin integration 小节(稳定字段集 = PLUGIN.md §4 字段集 + 错误形态 + 访问限制 + 增量演进承诺),实验字段不入契约。
  5. 是否有回归问题:未发现代码层回归(逐项清点见 ②);唯一需注意的是与 [PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238 的合并顺序冲突(流程级,非代码回归)。
  6. 是否破坏缓存:不涉及——未触碰任何压缩/前缀缓存/重试路径。
  7. 是否改了设计方向:没有。检测机制、status 路由语义、管理闸门策略全部保持原样;两条路由自此进入「契约领地」(增量演进承诺),这是刻意的边界划定。
  8. 是否引入了新的配置:没有——按拍板零配置面(ui.tabLabel/ui.order/ui.tab 已撤回)。

行为变更披露核对

PR 体披露的三项(tab 标签 上下文/Context → 压缩代理/Compression;黄条双语柔和化 + 仓库链接;overview payload hostPluginNotices[] 可携带可选 repoUrl)与我在 diff 中读到的完全一致,无未披露漂移。

收工判定

代码与文档通过审核,无需返工;合并暂缓,等你拍板与 #4238 的顺序(建议:先合本 PR,再返工 #4238——删 dsh.contextTabLabel、你定隐藏开关去留)。顺序定了之后,等 #4174+#4330 让 master 转绿,本分支推一次 trivial update 拿干净 CI 即可合入。

awork added 2 commits October 24, 2026 01:21
… link, host-plugin contract docs (#4319)

Owner decisions on #4319 (all five optional suggestions triaged):

1. Rename the dsh session tab to bili's own name — zh 压缩代理 / en
   Compression — so it stays distinguishable from dsh-context's same-purpose
   tab when both are installed. Unconditional rename; no config surface
   (ui.tabLabel/ui.order/ui.tab withdrawn per owner decision).
   BEHAVIOR CHANGE: default dsh tab label 上下文→压缩代理 / Context→Compression
   for all dsh users (cosmetic; slot id/order/locale unchanged).
2. Host-plugin banner: neutral coexistence wording (the two calibers are
   complementary, not competing) + upstream repository link next to the plugin
   name (new optional repoUrl on the notice, rendered escaped).
3. Config page: one-line note pointing at the host-side composition view
   provided by dsh-context (when installed).
4. Docs: README 'Host plugin integration' section — GET /bili/origin shapes +
   polling caveat; GET /__bili/plugin/status stable field set (the PLUGIN.md §4
   documented fields), error shapes, loopback admin gate + CORS origin echo,
   additive-evolution promise. PLUGIN.md §4 cross-ref; CLIENTS.md dsh section
   updated (tab rename + pointer).

Tests: label pin updated (dsh-settings-ui); new #4319 tests — repoUrl detection
propagation, banner link render/escape/omission, softened-wording pins; wiring
drift guard extended with t("hostplug.repo").

Closes #4319
… built-in tab label

Rebased onto master after #4238 merged (contextTab/contextTabLabel knobs
shipped). Those changes reference the tab's built-in name as fact; the
#4319 rename makes those references stale:

- readCtxTabFace comment, web quick-config row labels (zh/en), CONFIGURATION.md/
  zh-CN, website config-reference yaml seeds, LIFECYCLE.md: built-in name is
  now 「压缩代理」/「Compression」, not 「上下文」/「Context」
- tests/dsh-settings-ui.test.ts: the two contextTabLabel fallback pins now
  expect the renamed built-in label
- README Host plugin integration: /bili/origin bodies also carry the #4237
  face flags (contextTab/contextTabLabel) — documented as internal, ignore
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: vllm-qwen/qwen3.8-27b)

Scope decision from the owner in #4319: the tab-naming/hiding side of this work already shipped via merged PR #4238 (dsh.contextTab / dsh.contextTabLabel), and the issue was scoped down to the contract documentation only. That remaining part has been extracted into standalone docs PR #4447 (README "Host plugin integration" section + CLIENTS.md/PLUGIN.md cross-refs).

This PR's other content - tab rename 压缩代理/Compression, banner softening + repo link, config-page note - is dropped from the plan but preserved intact on this branch if ever wanted back. Leaving this PR open for the owner to close.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

收到范围决定。已核实两点事实并顺带把新的文档 PR #4447 审完了(该 PR 尚未有镜像 issue,故在此汇报):

核实:#4238 确已合入 master(9d7867b80,2026-10-23T14:43Z,dsh.contextTab / dsh.contextTabLabel 在位);#4447 = 纯文档 3 文件 +27/-2(README 新小节 + CLIENTS.md 指针 + PLUGIN.md §4 交叉引用),base 即当前 master tip。本 PR #4327 分支原样保留、我未做任何改动,留你关闭。

#4447 审核结论:通过,可合

契约文字 vs 当前 master 代码逐条核对(e5183631f)——全部准确:

  • /bili/origin 三种形态与 dsh-native.ts originRoute 实现一致;新增的 face-flags 说明也准确:withCtxTabFace(dsh-native.ts:1613)确实往同一 body 里加 contextTab(恒在)+ contextTabLabel(仅配置时),README「internal … ignore」的表述与实现吻合 ✅
  • status 路由稳定字段集(18 字段)== PLUGIN.md §4 文档化字段集 == 实际成功响应减去内部字段(fallback/label/windowSource/runtimeInfo/contextView/compressCreditTokens/outputBudgetDegraded/panel/webUrl 均正确排除在契约外)✅
  • 错误字符串逐字一致:400 "conversationId query parameter is required"(admin.ts:433)、404 "unknown plugin conversation" / fallback=latest "no session with activity since boot …"(plugin.ts:1608)、phase: pre-first-request / chain-advisory ✅
  • 访问限制段落与此前对 admin.ts 闸门的核实一致(loopback 连接 + loopback Host 名忽略端口 + 浏览器 Origin ∈ loopback http(s)/dsh-app://app + 非浏览器受信 Host + CORS 回显);「显式绑定非 loopback 主机名时亦受信」这一细微差别维持此前判断:描述的是默认部署一般情形,可接受 ✅
  • CLIENTS.md 指针挂在 dsh Context-tab 段落后,措辞与改名被撤后的现状自洽(tab 默认仍叫 Context)✅

CI:head ed3e8da 全绿——全部 test 分片(ubuntu 22/24、windows 22)+ static-gates + mysql-contract + 所有 guard job(含 docs-sync/docs-coverage),gated e2e 按惯例 skip。master 已转绿,无继承红的问题。

一个状态提示:GitHub 上 #4447 显示 mergeable_state=blocked,是过期状态——其 base 就是当前 master tip,本地 merge-tree 三方合并零冲突。合并时若界面仍提示冲突,先刷新/触发一次重新计算即可。

一处正文笔误(仅 PR 描述,非文档缺陷):PR 体写稳定字段集「incl. contextView」——但 contextView 既不在 PLUGIN.md §4 文档化字段里,也不在 README 契约列表里(它保持内部字段身份,文档处理是对的)。只有 PR 描述这一句措辞不准,无需改文档;如在意可由作者顺手改正文。

八问(针对 #4447)

  1. 是什么问题:第三方宿主侧 UI 插件(如 dsh-context)实际依赖的两条只读路由从未有对外契约,只能逆向。
  2. 什么原因导致的:路由从内部需求长出,稳定后无人接手文档化。
  3. 影响范围与严重程度:纯文档,零运行时影响;受益面为第三方插件开发者。p3。
  4. 怎么修复的:README 新增 Host plugin integration 小节(两条路由的稳定字段集/错误形态/访问限制/增量演进承诺),实验性字段明确不入契约;CLIENTS.md、PLUGIN.md 各加一句指向。
  5. 是否有回归问题:不涉及——零代码路径触碰,既有行为不可能被改变;docs-sync/docs-coverage 门禁绿。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有——只是把既有的两条路由正式划入契约领地(增量演进承诺),机制零变化。
  8. 是否引入了新的配置:没有。

收工判定

#4447 通过审核、CI 全绿、无冲突,随时可合(合并权在你)。#4327 按你的指示保持 open 待你关闭,分支内容完整保留、未动一行。

…n tab label

docs-sync drift: the #4238-alignment pass renamed the built-in tab
references to 「压缩代理」/「Compression」 in the EN seed, the committed
CONFIGURATION.zh-CN.md row and every other surface, but missed the ZH
seed desc (still 「顶栏上下文标签页」), so gen-config-docs regenerated a
line different from the committed doc. Align the seed with its EN twin
and the already-committed ZH doc text.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 自动修复(第 1/2 次尝试):docs-sync 红 → 已修,已推送,新 head 上 docs-sync 转绿。

结构化八问:

  1. 是什么问题:PR 的 docs-sync 检查红——配置参考块由生成器从 YAML 种子重新渲染后,与已提交的 CONFIGURATION.zh-CN.md 不一致(artifact drift)。
  2. 什么原因导致的:[PR] fix: dsh lane: rename + hide switch for the top-bar Context tab (#4237) #4238 对齐提交(2aa32c6)把内置标签页名引用从「上下文」改名为「压缩代理」时漏了一处——website/config-reference/server.yaml 里 dsh.contextTabLabel 的中文种子描述仍写「顶栏上下文标签页」,而英文种子("Compression tab")和已提交的中文文档行都已改成「压缩代理」。生成器以种子为真源,重渲染结果与已提交文档就差这一个词。
  3. 影响范围与严重程度:仅文档面,无运行时行为、wire、配置语义影响;只触发 CI 门禁。
  4. 怎么修复的:改种子(生成器读取的真源)而非手改生成物——把该条 ZH 描述「顶栏上下文标签页」对齐为其英文孪生与已提交中文文档文本「顶栏压缩代理标签页」。单行改动,独立 commit。
  5. 是否有回归问题:无。零代码改动,仅文档种子措辞;本地按 CI 同款命令验证四个产物文件(CONFIGURATION.md / CONFIGURATION.zh-CN.md / website/main.js / website/docs/index.html)重生成后逐字节一致,check-coverage 同绿。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

验证:在推送树上跑了 CI 完全相同的命令(generate + 四产物 diff --exit-code + check-coverage)全部干净;CI 于新 head 74d6ef59:docs-sync ✅、docs-coverage ✅,其余检查运行中,当前无任何失败项。

顺带观察(未动,超出本次漂移修复范围):dsh.contextTabLabel 描述里的示例从句("另一插件(dsh-context)已占用「上下文」时改为'压缩账本'")描述的冲突场景是改名前的——#4319 改名后默认已无此冲突,该例子现在略过时。EN/ZH 两侧一致存在,如需改写措辞可作小的 follow-up。

判定:修复已合入 PR 分支(commit 74d6ef59,1 行),等待其余 CI 车道收尾。

@ranxianglei

Copy link
Copy Markdown
Owner Author

已经实现了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant