Skip to content

feat: dsh 设置面板嵌入真正的 Web UI(标签页 + iframe embed 模式) (#2321) - #2342

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-07_dsh-embedded-settings-panel
Oct 9, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-07_dsh-embedded-settings-panel

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #2321

做了什么

按 owner 拍板的方案 B(「先b」):dsh「bili设置」位置从跳转 URL 按钮升级为内嵌真正的 Web UI。

dsh 侧(src/agent/dsh-native-client.ts):

bili 侧:

  • /__bili/ 路由容忍 query(?embed=1&lang=…)——安全门禁(loopback/trusted-origin/tunnel)在该路由之前,全部照旧;
  • Web UI 新增 embed 形态:<body class="embed">,CSS 隐藏 topbar、透明底、半透明灰边框、8px 圆角、无阴影(贴 dsh 观感),文本色继续跟随明暗主题;topbar DOM 保留,零 SPA 逻辑风险;
  • 客户端支持 ?lang=zh|en 显式钉住语言(优先于 localStorage 与浏览器默认);语言切换按钮在有 pin 时自动去掉 pin 再导航,避免 pin 静默回灌旧语言。

行为变更披露

  1. /__bili/ 从精确匹配扩展为允许 query——纯放宽,门禁不变;
  2. Web UI 出现新的 URL 参数面 ?embed=1 / ?lang=(内部 UI 路由参数;非 config-file/env/CLI 新字段,未新增配置面);
  3. dsh 设置区交互:跳转按钮 → 内嵌面板 + 备用按钮。

已知残留风险

dsh web app 若对 iframe 设了 CSP frame-src 限制,嵌入会被浏览器拦截(宿主 CSP 无法从本仓库验证);届时备用「打开 Web UI」按钮仍是兜底路径。

验证

typecheck ✅ / tests/dsh-settings-ui.test.ts + tests/web-i18n.test.ts 15/15 ✅(新增 embed 标记、tab 切换、lang pin、备用按钮断言)/ build ✅。全量回归交 CI。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,开始 review:拉取分支核对代码 + 检查 CI 状态,稍后按七问体例给出结论。

@ranxianglei
ranxianglei force-pushed the 2026-10-07_dsh-embedded-settings-panel branch from 9da56f0 to 38b129f Compare October 7, 2026 13:32
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-07_dsh-embedded-settings-panel (580f9ff)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2624-pr.2342.5af46f5

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei force-pushed the 2026-10-07_dsh-embedded-settings-panel branch 3 times, most recently from d648df4 to 60c5fe8 Compare October 7, 2026 14:57
@ranxianglei

Copy link
Copy Markdown
Owner Author

解决冲突

@ranxianglei
ranxianglei force-pushed the 2026-10-07_dsh-embedded-settings-panel branch from 60c5fe8 to 57af5f4 Compare October 8, 2026 14:17
@ranxianglei
ranxianglei force-pushed the 2026-10-07_dsh-embedded-settings-panel branch from 57af5f4 to 580f9ff Compare October 8, 2026 14:39
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 冲突已解决,且这轮 rebase 又抓出并修复了我引入的第二类回归。按七问:

1. 是什么问题
owner 要求解冲突:master 在我上一版 base(4268c7b94)之后又落了一批提交(#2375/#2382/#2378/#2414/#2418 等),PR 重新变 dirty。rebase 核对过程中还发现我上一版的 ?lang= 修复只覆盖了两类测试 harness,漏了第三类,导致 CI test 矩阵再次红。

2. 什么原因导致的

  • 冲突层:master 新窗口里 src/web/index.ts 把 renderUI 改成传 `${VERSION} (${BUILD_COMMIT})`(与我的 embed 参数改动撞在同一行);admin.ts/client.ts/page.ts 有相邻改动但不同行;
  • 回归层:我把 lang pin 解析从 URLSearchParams 换成 regex 后,代码仍直接引用 location.search。而 tests/conflict-remediation.test.ts(feat: add per-client remediation hints to compression-conflict surfaces (web banner / acp_status) #2219 web hint block)用 new Function 在宿主 Node 上下文执行 WEB_CLIENT 头部切片——那里根本没有 location 全局 → ReferenceError 被 try/catch 吞掉 → locale 静默回落 zh-CN,英文断言失败(CI 三平台同一处红)。根因同上一类:该 IIFE 必须能在三种环境(浏览器 / vm 沙箱 / 无 location 的宿主上下文)执行,我的守卫只做了一半。

3. 怎么修复的

  • 冲突 union-of-intent:index.ts 合并为 renderPage(origin, \${VERSION} (${BUILD_COMMIT})`, opts?.embed === true)`——master 的 commit 后缀与我的 embed 标志共存;其余文件自动合并,已逐 hunk 验证双方意图都在;
  • 回归补全守卫:typeof location !== "undefined" ? location.search || "" : ""——无 location 环境下降级为空串,pin 检查跳过、原有 saved→navigator 解析链照跑(行为与改动前完全一致)。

4. 是否有回归问题
无——逐项审过:origin 未绑定降级路径不变;#2289 live-follow 保留;/__bili/ 安全门禁未动;语言默认链 5 组合验证 + #2219 hint block 测试(正是这次的检测器)通过;持久化/线协议/缓存零触碰。CI 26/26 全绿(含 test 矩阵 ×4 OS、e2e、registry e2e、kernel-guard、全部 real-client lane;唯一一次红的 codex overlay job 是 Windows runner 上 node.exe spawn ETIMEDOUT 的基础设施抖动,与本 diff 无关,rerun 即绿)。

5. 是否破坏缓存:不涉及。
6. 是否改了设计方向:无变化,仍是方案 B。
7. 是否引入新配置:无(?embed=1/?lang= 为 iframe 内部 UI 参数)。

最终状态:分支 @ 580f9ffa3,单线性 commit(8 files,+340/-60),落在 cc368fe4b;此后 master 又推进到 a00b28f10,我已核对该窗口与本 PR 八字节级文件零重叠,无需再 rebase,GitHub mergeable 标记重算中(前几轮均为 True)。本地对 base 零冲突应用 + CI 全绿双证据。

判定:可合并,等人工 merge。

@ranxianglei
ranxianglei merged commit bee055d into master Oct 9, 2026
28 of 29 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.166-master.bee055d (rolling master tag).

npm install -g billion-context@0.0.166-master.bee055d  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dsh设置位置提供真的设置面板

1 participant