From 80c1db576a110fe25312ec0a4002a47f589bc860 Mon Sep 17 00:00:00 2001 From: wangheng Date: Thu, 3 Dec 2026 17:06:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20DS=20Bot=20=E9=A1=B5=E9=87=8C?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E5=85=A5=E5=8F=A3=E4=B8=8D=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E2=80=94=E2=80=94=E6=94=B9=E6=8C=82=20shell.overlay?= =?UTF-8?q?=20(v0.5.3-local.13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实测 DevTools:DS Bot 页下 `document.querySelectorAll('.dsh-wt_edgeStrip').length === 0`, 组件根本没有挂载。原因:ds-bot 0.4.5 用 shadow("sidebar.footer.action", ...) 接管了侧栏 footer 座位(bot-account / bot-return),我们的注册在该页不渲染。 修法:同一组件再注册一份到 shell.overlay(ds-bot 不接管该层),用 slotRole 分流: - sidebar 实例:非 DS Bot 视图渲染(经典布局,保持原行为) - overlay 实例:检测到 DS Bot 左栏时渲染(800ms 轮询 [class*="bt-leftcol"] 等) 两实例互斥,不会重复或同时消失。 已知取舍:overlay 实例拿不到 sidebar.worktable.project 的宿主项目列表 (跨座位 children 不可见),DS Bot 页里这部分入驻条目不显示; 工作台自身项目、二级页面、设置等不受影响。 验证:npm run pack 全绿,双资产同源 8f093ee7…。 --- 01_content/dsh.plugin.json | 2 +- 01_content/lib/client.js | 31 ++++++++++++++++++++++-- 01_content/lib/index.js | 2 +- 01_content/package.json | 2 +- 01_content/src/client/index.tsx | 43 ++++++++++++++++++++++++++++++++- 02_process/LOCAL-CHANGES.md | 25 ++++++++++++++++--- README.md | 12 ++++----- 7 files changed, 102 insertions(+), 15 deletions(-) diff --git a/01_content/dsh.plugin.json b/01_content/dsh.plugin.json index c1c593e..2064d1a 100644 --- a/01_content/dsh.plugin.json +++ b/01_content/dsh.plugin.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目", - "version": "0.5.3-local.12", + "version": "0.5.3-local.13", "entry": { "name": "dsh-worktable", "inject": [] diff --git a/01_content/lib/client.js b/01_content/lib/client.js index 5255ec1..13434e4 100644 --- a/01_content/lib/client.js +++ b/01_content/lib/client.js @@ -9233,7 +9233,7 @@ var CHANGELOG_V030 = `\u66F4\u65B0\u516C\u544A \xB7 v0.5.1 \u30103.1 \u6587\u5B57\u4E0E\u7EC6\u8282\u6253\u78E8\u3011\u5168\u5C40\u5B57\u4F53\u4E0E\u5B57\u53F7\u7EDF\u4E00\u4F18\u5316\u3001\u4E0B\u62C9\u9762\u677F\u73BB\u7483\u5316\u4E0E\u5BF9\u9F50\u3001\u83DC\u5355\u70B9\u9009\u540E\u4FDD\u6301\u6253\u5F00\u4FBF\u4E8E\u8FDE\u7EED\u9884\u89C8\u3001\u6309\u94AE\u63CF\u8FB9\u4E0E\u60AC\u505C\u53CD\u9988\u7B49\u4EA4\u4E92\u7EC6\u8282\uFF1B\u540C\u65F6\u4FEE\u590D\u4E86\u591A\u9879\u4F53\u9A8C\u95EE\u9898\uFF08\u7167\u7247\u4E0A\u4F20\u6E05\u6670\u5EA6\u3001\u80CC\u666F\u7F51\u683C\u7EBF\u5728\u7167\u7247\u6A21\u5F0F\u4E0B\u4E0D\u751F\u6548\u3001\u6D45\u8272\u4E3B\u9898\u4E0B\u5DE5\u4F5C\u72B6\u6001\u5149\u6548\u4E0D\u53EF\u89C1\u7B49\uFF09\u3002`; // src/client/updateCheck.ts -var LOCAL_VERSION = false ? "dev" : "0.5.3-local.12"; +var LOCAL_VERSION = false ? "dev" : "0.5.3-local.13"; var UPDATE_API = "/api/worktable/update-check"; var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1"; var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1"; @@ -21803,9 +21803,29 @@ function RenameInput(props) { } ); } +function useDsBotView() { + const probe = () => { + try { + return !!document.querySelector('[class*="bt-leftcol"], .bt-home-nav, [class*="bt-home"]'); + } catch { + return false; + } + }; + const [active, setActive] = (0, import_react3.useState)(probe); + (0, import_react3.useEffect)(() => { + const id = window.setInterval(() => { + const next = probe(); + setActive((prev) => prev === next ? prev : next); + }, 800); + return () => window.clearInterval(id); + }, []); + return active; +} function WorktableSection(props) { + const slotRole = props.slotRole === "overlay" ? "overlay" : "sidebar"; + const dsBotView = useDsBotView(); const wide = props.wide !== false; - const renderProjectSlot = typeof props.renderSlot === "function" ? props.renderSlot : null; + const renderProjectSlot = slotRole === "sidebar" && typeof props.renderSlot === "function" ? props.renderSlot : null; const t = (key, params) => { if (typeof props.t === "function") { try { @@ -24065,6 +24085,7 @@ function WorktableSection(props) { popupLayer ] }); } + if (slotRole === "overlay" ? !dsBotView : dsBotView) return null; const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_header", children: [ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)( @@ -24499,6 +24520,12 @@ function apply(ctx) { } } }, WorktableSection), "dsh-worktable: worktable section"); + const WorktableOverlaySection = (p) => WorktableSection({ ...p, slotRole: "overlay", wide: true }); + ctx.slots.inject("shell.overlay", () => ctx.slots.register({ + name: "shell.overlay", + id: "dsh-worktable-edge", + order: 110 + }, WorktableOverlaySection), "dsh-worktable: edge overlay fallback"); } /*! Bundled license information: diff --git a/01_content/lib/index.js b/01_content/lib/index.js index aaf56f6..39dfc73 100644 --- a/01_content/lib/index.js +++ b/01_content/lib/index.js @@ -382,7 +382,7 @@ function resolveDshHomeSafe() { cachedDshHome = baseDshHome(); return cachedDshHome; } -var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.12"; +var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.13"; var name = "dsh-worktable"; var inject = ["webServer", "sessions"]; var HEALTH_PATH = "/api/worktable/health"; diff --git a/01_content/package.json b/01_content/package.json index be907f9..32c3681 100644 --- a/01_content/package.json +++ b/01_content/package.json @@ -1,7 +1,7 @@ { "name": "dsh-worktable", "description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)", - "version": "0.5.3-local.12", + "version": "0.5.3-local.13", "repository": { "type": "git", "url": "https://github.com/Aisland-SJL/dsh-worktable.git", diff --git a/01_content/src/client/index.tsx b/01_content/src/client/index.tsx index c044222..b1acca6 100644 --- a/01_content/src/client/index.tsx +++ b/01_content/src/client/index.tsx @@ -1088,9 +1088,37 @@ function RenameInput(props: { initial: string; placeholder: string; onCommit: (v ) } +/** + * DS Bot 全屏页是否接管左侧栏。 + * ds-bot 0.4.5 会 shadow 掉 sidebar.footer.action 座位(bot-account / bot-return), + * 我们的侧栏挂载在该座位,因此 DS Bot 页里组件根本不会挂载(DOM 里查不到 edgeStrip)。 + * 兜底:同一个组件再注册到 shell.overlay;overlay 座位在检测到 DS Bot 左栏时接管渲染。 + */ +function useDsBotView(): boolean { + const probe = () => { + try { + return !!document.querySelector('[class*="bt-leftcol"], .bt-home-nav, [class*="bt-home"]') + } catch { + return false + } + } + const [active, setActive] = useState(probe) + useEffect(() => { + const id = window.setInterval(() => { + const next = probe() + setActive((prev) => (prev === next ? prev : next)) + }, 800) + return () => window.clearInterval(id) + }, []) + return active +} + function WorktableSection(props: any) { + const slotRole: 'sidebar' | 'overlay' = props.slotRole === 'overlay' ? 'overlay' : 'sidebar' + const dsBotView = useDsBotView() const wide = props.wide !== false - const renderProjectSlot = typeof props.renderSlot === 'function' ? props.renderSlot : null + // 侧栏座位拿不到别的座位的 children,overlay 里调用 sidebar.worktable.project 会抛错 + const renderProjectSlot = slotRole === 'sidebar' && typeof props.renderSlot === 'function' ? props.renderSlot : null /** locale 座席 t;宿主未安装 locale 服务时回退 zh 词典(保持独立可用)。 */ const t = (key: WorktableKey, params?: Record): string => { if (typeof props.t === 'function') { @@ -3297,6 +3325,10 @@ function buildCustomLayoutPrompt(req: string): string { ) } + // 角色分流:DS Bot 页由 overlay 实例渲染;经典布局由侧栏实例渲染。 + // 两处都不渲染的窗口不会出现,避免重复或消失。 + if (slotRole === 'overlay' ? !dsBotView : dsBotView) return null + const content = ( <>
@@ -3664,6 +3696,15 @@ export function apply(ctx: any) { }, }, }, WorktableSection), 'dsh-worktable: worktable section') + + // DS Bot 页接管侧栏座位时不渲染上面的注册;同一组件在 overlay 层保留一份, + // 由 slotRole 判断只在 DS Bot 视图生效(经典布局仍走侧栏实例)。 + const WorktableOverlaySection = (p: any) => WorktableSection({ ...p, slotRole: 'overlay', wide: true }) + ctx.slots.inject('shell.overlay', () => ctx.slots.register({ + name: 'shell.overlay', + id: 'dsh-worktable-edge', + order: 110, + }, WorktableOverlaySection), 'dsh-worktable: edge overlay fallback') } export { WorktableSection } diff --git a/02_process/LOCAL-CHANGES.md b/02_process/LOCAL-CHANGES.md index 5dbf26e..4a7ce8e 100644 --- a/02_process/LOCAL-CHANGES.md +++ b/02_process/LOCAL-CHANGES.md @@ -4,9 +4,9 @@ > 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build` > 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。 -当前版本:**0.5.3-local.12**(2026-12-03) -产物:`01_content/dist/v0.5.3-local.12/dsh-worktable.tgz`,488199 字节, -sha256 `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` +当前版本:**0.5.3-local.13**(2026-12-03) +产物:`01_content/dist/v0.5.3-local.13/dsh-worktable.tgz`,488523 字节, +sha256 `8f093ee793ce1ac5cf9372d2249dd5b3377704909600a0ee51fa188244d128fd` --- @@ -76,6 +76,25 @@ sha256 `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` --- +**0.5.3-local.13 修正(2026-12-03):DS Bot 页里组件根本没挂载** + +实测(DevTools):DS Bot 页下 `document.querySelectorAll('.dsh-wt_edgeStrip').length === 0`。 +原因:ds-bot 0.4.5 用 `shadow("sidebar.footer.action", ...)` 接管了侧栏 footer 座位 +(`bot-account` / `bot-return`),我们的侧栏注册在该页不渲染。 + +修法:同一组件再注册一份到 **`shell.overlay`**(ds-bot 不接管该层),用 `slotRole` 分流: + +| slotRole | 渲染条件 | +|---|---| +| `sidebar` | 非 DS Bot 视图(经典布局) | +| `overlay` | 检测到 DS Bot 左栏(`[class*="bt-leftcol"]` 等,800ms 轮询) | + +两实例互斥,不会重复或同时消失。已知取舍:overlay 实例拿不到 +`sidebar.worktable.project` 的宿主项目条目(跨座位 children 不可见), +DS Bot 页里这部分入驻条目不显示;工作台自身项目、二级页面、设置不受影响。 + +--- + ## 三、孤儿路由防护(0.5.3-local.5,2026-12-02) **现象**:安装/升级其他插件触发 profile 热重载后,侧边栏工作台抽屉整个消失, diff --git a/README.md b/README.md index e5d2a80..2405ac2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > ## 📦 本仓库是内部补丁分发仓,不是上游源码仓 > -> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.12`)。 +> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.13`)。 > 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。 ### 要不要装 @@ -16,16 +16,16 @@ ### 安装 -当前版本 **v0.5.3-local.12**: +当前版本 **v0.5.3-local.13**: ```bash -dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.12/dsh-worktable.tgz" +dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.13/dsh-worktable.tgz" ``` - **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。 - `--profile web` 按你自己的 profile 名字改。 -- 资产 `dsh-worktable.tgz`,488199 字节,sha256: - `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` +- 资产 `dsh-worktable.tgz`,488523 字节,sha256: + `8f093ee793ce1ac5cf9372d2249dd5b3377704909600a0ee51fa188244d128fd` (下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对) - 声明兼容的 DSH 版本:`0.2.0-rc.2` / `0.2.1-rc.3` / `0.2.1-rc.5` / `0.2.2-alpha.2`。 宿主不在这个列表里时,安装会被兼容性检查直接拒绝并回滚。 @@ -50,7 +50,7 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r ### 升级与回退 -- 装上 `0.5.3-local.12` 后,插件不会提示升级到 0.5.1。 +- 装上 `0.5.3-local.13` 后,插件不会提示升级到 0.5.1。 - 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。 - 回退官方版: ```bash -- 2.54.0