Compare commits

..
8 Commits
Author SHA1 Message Date
wangheng 398a0d3df6 Merge pull request 'fix(ui): 抬高宿主 overlay 层层级 (v0.5.3-local.16)' (#17) from fix/v0.5.3-local.16-overlay-layer-z into main
[v0.5.3-local.16] overlay 层层级
2026-12-04 09:34:56 +08:00
wangheng b6986101ad fix(ui): 抬高宿主 overlay 层层级,细条不再被侧栏盖住 (v0.5.3-local.16)
诊断日志(<DSH_HOME>/logs/worktable-diag.log)显示:DS Bot 视图里
styles=1、sections=3、strips=1、overlayHost=true —— 细条在 DOM 里,只是看不见。

宿主 ui-layout 的 overlayLayer 样式为:
  { z-index: 20; pointer-events: none; position: absolute; inset: 0 }
我们的细条 z-index 再高也困在这个 z-index:20 的层内,与侧栏(ds-bot 左栏)
比较时被整体盖住。

修法:客户端在 apply 后把 [data-shell-overlay] 的 z-index 抬到 2147483000,
并做 300ms/1.5s 补偿与 3s 低频兜底(宿主重渲染会重建节点)。
overlay 内其它浮层(配额提示等)一并受益。

诊断同时补充 overlayZ 与 stripRect(left/top/w/h/z),便于复核。

验证:npm run pack 全绿,双资产同源 fd6af73a…。
2026-12-04 09:34:47 +08:00
wangheng 805138678d Merge pull request 'feat(diag): 现场诊断上报通道 (v0.5.3-local.15)' (#16) from fix/v0.5.3-local.15-diag into main
[v0.5.3-local.15] 诊断上报通道
2026-12-04 09:19:58 +08:00
wangheng 3e7e2799c4 feat(diag): 增加现场诊断上报通道 (v0.5.3-local.15)
内嵌视图(DS Bot 等)没有 DevTools,无法读取插件运行现场。新增:
- 服务端 /api/worktable/diag(需鉴权):把客户端上报的 JSON 追加到
  <DSH_HOME>/logs/worktable-diag.log
- 客户端 apply() 在 1.5s/5s 各上报一次:href、__ModuleLoader__ 类型、
  style[data-dsh-plugin] 数量、.dsh-wt_section/.dsh-wt_edgeStrip 数量、
  sidebar/overlayHost 是否存在、body 子元素数、窗口宽度、最近 5 条 window 错误

用途:确认 DS Bot 视图里插件 client 是否加载、哪个座位渲染,据此再修复。
验证:npm run pack 全绿,双资产同源 aafb7ab2…。
2026-12-04 09:19:49 +08:00
wangheng 9f7975aa14 Merge pull request 'fix(ui): 宽屏面板统一由 shell.overlay 渲染 (v0.5.3-local.14)' (#15) from fix/v0.5.3-local.14-overlay-always into main
[v0.5.3-local.14] 宽屏面板统一走 overlay
2026-12-03 17:47:53 +08:00
wangheng 64a1d46b46 fix(ui): 宽屏面板统一由 shell.overlay 渲染,不再依赖视图探测 (v0.5.3-local.14)
local.13 用 bt-leftcol 等选择器探测 DS Bot 视图,实测未命中,overlay 实例仍不渲染
(DS Bot 页 dsh-wt_edgeStrip 仍为 0)。改为不依赖探测:
- 宽屏面板只由 overlay 实例渲染(sidebar 实例只在窄屏渲染 rail)
- overlay 实例补 pointer-events:auto,避免 overlay 容器拦截点击
- findSidebar 增加全局兜底(overlay 里向上找不到侧栏时取第一个可见左栏),
  保证细条贴在正确左缘

取舍:sidebar.worktable.project 的宿主项目条目在宽屏下不再渲染(跨座位不可见)。

验证:npm run pack 全绿(edge-panel 6 组 + sidebar-popup 全过),双资产同源 c28cba75…。
2026-12-03 17:47:43 +08:00
wangheng f5bbc7cd57 Merge pull request 'fix(ui): DS Bot 页里工作台入口不渲染——改挂 shell.overlay (v0.5.3-local.13)' (#14) from fix/v0.5.3-local.13-overlay-fallback into main
[v0.5.3-local.13] DS Bot 页 overlay 兜底
2026-12-03 17:07:22 +08:00
wangheng 80c1db576a fix(ui): DS Bot 页里工作台入口不渲染——改挂 shell.overlay (v0.5.3-local.13)
实测 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…。
2026-12-03 17:07:14 +08:00
11 changed files with 257 additions and 25 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "dsh-worktable", "name": "dsh-worktable",
"description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目", "description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目",
"version": "0.5.3-local.12", "version": "0.5.3-local.16",
"entry": { "entry": {
"name": "dsh-worktable", "name": "dsh-worktable",
"inject": [] "inject": []
+84 -4
View File
@@ -8432,10 +8432,10 @@ var css = xterm_default + "\n" + [
".dsh-wt_manageRowSub{margin-left:20px}", ".dsh-wt_manageRowSub{margin-left:20px}",
// 停靠态:左缘细条 + 滑出面板 // 停靠态:左缘细条 + 滑出面板
".dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}", ".dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}",
".dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:2147483000;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.14));border-right:1px solid var(--dsw-alias-border-l1,rgba(125,125,125,.18));transition:background .15s,border-color .15s}", ".dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:2147483000;pointer-events:auto;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.14));border-right:1px solid var(--dsw-alias-border-l1,rgba(125,125,125,.18));transition:background .15s,border-color .15s}",
".dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}", ".dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}",
".dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}", ".dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}",
".dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:2147483001;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}", ".dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:2147483001;pointer-events:auto;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}",
".dsh-wt_edgePanelWrapOn{transform:translateX(0)}", ".dsh-wt_edgePanelWrapOn{transform:translateX(0)}",
".dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}", ".dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}",
".dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}", ".dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}",
@@ -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`; \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 // src/client/updateCheck.ts
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.12"; var LOCAL_VERSION = false ? "dev" : "0.5.3-local.16";
var UPDATE_API = "/api/worktable/update-check"; var UPDATE_API = "/api/worktable/update-check";
var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1"; var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1";
var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1"; var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1";
@@ -21216,6 +21216,15 @@ function findSidebar(start) {
if (typeof el.className === "string" && /SidebarRoot|sidebar/i.test(el.className)) return el; if (typeof el.className === "string" && /SidebarRoot|sidebar/i.test(el.className)) return el;
el = el.parentElement; el = el.parentElement;
} }
try {
const candidates = document.querySelectorAll('aside, nav, [class*="SidebarRoot"], [class*="sidebar"]');
for (let i = 0; i < candidates.length; i++) {
const node = candidates[i];
const r = node.getBoundingClientRect();
if (r.width > 40 && r.height > 100 && r.left < (typeof window !== "undefined" ? window.innerWidth : 1280) / 2) return node;
}
} catch {
}
return null; return null;
} }
var registryStore = { ids: [], listeners: /* @__PURE__ */ new Set() }; var registryStore = { ids: [], listeners: /* @__PURE__ */ new Set() };
@@ -21804,8 +21813,9 @@ function RenameInput(props) {
); );
} }
function WorktableSection(props) { function WorktableSection(props) {
const slotRole = props.slotRole === "overlay" ? "overlay" : "sidebar";
const wide = props.wide !== false; 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) => { const t = (key, params) => {
if (typeof props.t === "function") { if (typeof props.t === "function") {
try { try {
@@ -24065,6 +24075,7 @@ function WorktableSection(props) {
popupLayer popupLayer
] }); ] });
} }
if (slotRole === "overlay" ? !wide : wide) return null;
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [ 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.jsxs)("div", { className: "dsh-wt_header", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)( /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -24386,6 +24397,69 @@ function WorktableSection(props) {
} }
var inject = ["slots", "locale", "sessions", "conversation", "workspaces"]; var inject = ["slots", "locale", "sessions", "conversation", "workspaces"];
function apply(ctx) { function apply(ctx) {
try {
const sendDiag = (tag) => {
try {
void fetch("/api/worktable/diag", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
tag,
href: String(location.href),
loader: typeof window.__ModuleLoader__,
styles: document.querySelectorAll("style[data-dsh-plugin]").length,
sections: document.querySelectorAll(".dsh-wt_section").length,
strips: document.querySelectorAll(".dsh-wt_edgeStrip").length,
sidebar: !!document.querySelector('aside, nav, [class*="SidebarRoot"], [class*="sidebar"]'),
overlayHost: !!document.querySelector("[data-shell-overlay]"),
bodyKids: document.body ? document.body.children.length : -1,
wide: window.innerWidth,
overlayZ: (() => {
try {
const l = document.querySelector("[data-shell-overlay]");
return l ? getComputedStyle(l).zIndex : "none";
} catch {
return "err";
}
})(),
stripRect: (() => {
try {
const el = document.querySelector(".dsh-wt_edgeStrip");
if (!el) return null;
const r = el.getBoundingClientRect();
return { left: Math.round(r.left), top: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height), z: getComputedStyle(el).zIndex };
} catch {
return "err";
}
})(),
errors: diagErrors.slice(-5)
})
});
} catch {
}
};
const diagErrors = [];
window.addEventListener("error", (e) => {
try {
diagErrors.push(String(e?.message ?? e?.error ?? "error"));
} catch {
}
});
window.setTimeout(() => sendDiag("t1500"), 1500);
window.setTimeout(() => sendDiag("t5000"), 5e3);
const raiseOverlayLayer = () => {
try {
const layer = document.querySelector("[data-shell-overlay]");
if (layer && layer.style.zIndex !== "2147483000") layer.style.zIndex = "2147483000";
} catch {
}
};
raiseOverlayLayer();
window.setTimeout(raiseOverlayLayer, 300);
window.setTimeout(raiseOverlayLayer, 1500);
window.setInterval(raiseOverlayLayer, 3e3);
} catch {
}
sessionBridge = { sessions: ctx.sessions ?? null, conversation: ctx.conversation ?? null, list: ctx.sessions?.list ?? null, workspaces: ctx.workspaces ?? null }; sessionBridge = { sessions: ctx.sessions ?? null, conversation: ctx.conversation ?? null, list: ctx.sessions?.list ?? null, workspaces: ctx.workspaces ?? null };
clientCtx = ctx; clientCtx = ctx;
try { try {
@@ -24499,6 +24573,12 @@ function apply(ctx) {
} }
} }
}, WorktableSection), "dsh-worktable: worktable section"); }, 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: /*! Bundled license information:
+22 -1
View File
@@ -382,7 +382,7 @@ function resolveDshHomeSafe() {
cachedDshHome = baseDshHome(); cachedDshHome = baseDshHome();
return cachedDshHome; return cachedDshHome;
} }
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.12"; var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.16";
var name = "dsh-worktable"; var name = "dsh-worktable";
var inject = ["webServer", "sessions"]; var inject = ["webServer", "sessions"];
var HEALTH_PATH = "/api/worktable/health"; var HEALTH_PATH = "/api/worktable/health";
@@ -1141,6 +1141,27 @@ function apply(ctx) {
} }
} }
}); });
register({
kind: "exact",
path: "/api/worktable/diag",
handler: async (req, res) => {
if (req.method !== "POST") {
json(res, 405, { error: "method not allowed" });
return;
}
try {
const body = await readJsonBody(req);
const line = (/* @__PURE__ */ new Date()).toISOString() + " " + JSON.stringify(body ?? null).slice(0, 4e3);
const fsx = await import("node:fs/promises");
const dir = pathResolve(resolveDshHomeSafe(), "logs");
await fsx.mkdir(dir, { recursive: true });
await fsx.appendFile(pathResolve(dir, "worktable-diag.log"), line + String.fromCharCode(10), "utf8");
json(res, 200, { ok: true });
} catch (err) {
json(res, 500, { error: String(err?.message ?? err) });
}
}
});
setupTerminal(webServer, ctx); setupTerminal(webServer, ctx);
} }
export { export {
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "dsh-worktable", "name": "dsh-worktable",
"description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)", "description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)",
"version": "0.5.3-local.12", "version": "0.5.3-local.16",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/Aisland-SJL/dsh-worktable.git", "url": "https://github.com/Aisland-SJL/dsh-worktable.git",
+76 -1
View File
@@ -458,6 +458,15 @@ function findSidebar(start: HTMLElement | null): HTMLElement | null {
if (typeof el.className === 'string' && /SidebarRoot|sidebar/i.test(el.className)) return el if (typeof el.className === 'string' && /SidebarRoot|sidebar/i.test(el.className)) return el
el = el.parentElement el = el.parentElement
} }
// 挂在 shell.overlay 时向上找不到侧栏,退回全局查找(取第一个可见候选)
try {
const candidates = document.querySelectorAll<HTMLElement>('aside, nav, [class*="SidebarRoot"], [class*="sidebar"]')
for (let i = 0; i < candidates.length; i++) {
const node = candidates[i]
const r = node.getBoundingClientRect()
if (r.width > 40 && r.height > 100 && r.left < (typeof window !== 'undefined' ? window.innerWidth : 1280) / 2) return node
}
} catch { /* ignore */ }
return null return null
} }
@@ -1089,8 +1098,10 @@ function RenameInput(props: { initial: string; placeholder: string; onCommit: (v
} }
function WorktableSection(props: any) { function WorktableSection(props: any) {
const slotRole: 'sidebar' | 'overlay' = props.slotRole === 'overlay' ? 'overlay' : 'sidebar'
const wide = props.wide !== false 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 词典(保持独立可用)。 */ /** locale 座席 t;宿主未安装 locale 服务时回退 zh 词典(保持独立可用)。 */
const t = (key: WorktableKey, params?: Record<string, string>): string => { const t = (key: WorktableKey, params?: Record<string, string>): string => {
if (typeof props.t === 'function') { if (typeof props.t === 'function') {
@@ -3297,6 +3308,12 @@ function buildCustomLayoutPrompt(req: string): string {
) )
} }
// 角色分流(不依赖宿主视图探测):
// - 宽屏面板:只由 overlay 实例渲染。ds-bot 在 DS Bot 页 shadow 掉 sidebar.footer.action
// 座位,侧栏实例在该页不会挂载;overlay 层不受影响,两个视图都能渲染。
// - 窄屏 rail:仍由侧栏实例渲染(overlay 里没有侧栏几何可用)。
if (slotRole === 'overlay' ? !wide : wide) return null
const content = ( const content = (
<> <>
<div className="dsh-wt_header"> <div className="dsh-wt_header">
@@ -3555,6 +3572,55 @@ function buildCustomLayoutPrompt(req: string): string {
export const inject = ['slots', 'locale', 'sessions', 'conversation', 'workspaces'] export const inject = ['slots', 'locale', 'sessions', 'conversation', 'workspaces']
export function apply(ctx: any) { export function apply(ctx: any) {
// 现场诊断上报:内嵌视图没有 DevTools,把关键事实 POST 到宿主 /api/worktable/diag,
// 直接落到 <DSH_HOME>/logs/worktable-diag.log。上线稳定后可删。
try {
const sendDiag = (tag: string) => {
try {
void fetch('/api/worktable/diag', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
tag,
href: String(location.href),
loader: typeof (window as any).__ModuleLoader__,
styles: document.querySelectorAll('style[data-dsh-plugin]').length,
sections: document.querySelectorAll('.dsh-wt_section').length,
strips: document.querySelectorAll('.dsh-wt_edgeStrip').length,
sidebar: !!document.querySelector('aside, nav, [class*="SidebarRoot"], [class*="sidebar"]'),
overlayHost: !!document.querySelector('[data-shell-overlay]'),
bodyKids: document.body ? document.body.children.length : -1,
wide: (window as any).innerWidth,
overlayZ: (() => { try { const l = document.querySelector('[data-shell-overlay]') as HTMLElement | null; return l ? getComputedStyle(l).zIndex : 'none' } catch { return 'err' } })(),
stripRect: (() => { try { const el = document.querySelector('.dsh-wt_edgeStrip') as HTMLElement | null; if (!el) return null; const r = el.getBoundingClientRect(); return { left: Math.round(r.left), top: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height), z: getComputedStyle(el).zIndex } } catch { return 'err' } })(),
errors: diagErrors.slice(-5),
}),
})
} catch { /* ignore */ }
}
const diagErrors: string[] = []
window.addEventListener('error', (e: any) => {
try { diagErrors.push(String(e?.message ?? e?.error ?? 'error')) } catch {}
})
window.setTimeout(() => sendDiag('t1500'), 1500)
window.setTimeout(() => sendDiag('t5000'), 5000)
// 宿主 overlay 层的默认样式是 z-index:20 + pointer-events:none(见 ui-layout 的 overlayLayer)。
// 我们的细条/面板挂在这层里,即使自身 z-index 再高,也会被 z-index 更高的侧栏(DS Bot 左栏)
// 整体盖住。把该层抬到顶层,overlay 内其它浮层(配额提示等)一并受益。
const raiseOverlayLayer = () => {
try {
const layer = document.querySelector<HTMLElement>('[data-shell-overlay]')
if (layer && layer.style.zIndex !== '2147483000') layer.style.zIndex = '2147483000'
} catch { /* ignore */ }
}
raiseOverlayLayer()
window.setTimeout(raiseOverlayLayer, 300)
window.setTimeout(raiseOverlayLayer, 1500)
// 宿主重渲染可能重建该节点,低频兜底保持
window.setInterval(raiseOverlayLayer, 3000)
} catch { /* ignore */ }
// 自定义窗口 → 宿主会话桥:保存 sessions/conversation/list 服务引用(模块级) // 自定义窗口 → 宿主会话桥:保存 sessions/conversation/list 服务引用(模块级)
sessionBridge = { sessions: ctx.sessions ?? null, conversation: ctx.conversation ?? null, list: ctx.sessions?.list ?? null, workspaces: ctx.workspaces ?? null } sessionBridge = { sessions: ctx.sessions ?? null, conversation: ctx.conversation ?? null, list: ctx.sessions?.list ?? null, workspaces: ctx.workspaces ?? null }
clientCtx = ctx clientCtx = ctx
@@ -3664,6 +3730,15 @@ export function apply(ctx: any) {
}, },
}, },
}, WorktableSection), 'dsh-worktable: worktable section') }, 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 } export { WorktableSection }
+2 -2
View File
@@ -681,10 +681,10 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_manageRowSub{margin-left:20px}', '.dsh-wt_manageRowSub{margin-left:20px}',
// 停靠态:左缘细条 + 滑出面板 // 停靠态:左缘细条 + 滑出面板
'.dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}', '.dsh-wt_edgeAnchor{width:0;height:0;overflow:hidden;flex:none}',
'.dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:2147483000;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.14));border-right:1px solid var(--dsw-alias-border-l1,rgba(125,125,125,.18));transition:background .15s,border-color .15s}', '.dsh-wt_edgeStrip{position:fixed;top:0;bottom:0;width:12px;z-index:2147483000;pointer-events:auto;display:flex;align-items:center;justify-content:center;cursor:pointer;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.14));border-right:1px solid var(--dsw-alias-border-l1,rgba(125,125,125,.18));transition:background .15s,border-color .15s}',
'.dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}', '.dsh-wt_edgeStrip:hover,.dsh-wt_edgeStripOn{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05));border-right-color:var(--dsw-alias-border-l1,#262b36)}',
'.dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}', '.dsh-wt_edgeStripGlyph{font-size:11px;line-height:1;color:var(--dsw-alias-label-tertiary,#6e7683);user-select:none;-webkit-user-select:none}',
'.dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:2147483001;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}', '.dsh-wt_edgePanelWrap{position:fixed;top:0;bottom:0;width:250px;z-index:2147483001;pointer-events:auto;transform:translateX(-100%);transition:transform .18s ease;box-shadow:14px 0 30px rgba(0,0,0,.18)}',
'.dsh-wt_edgePanelWrapOn{transform:translateX(0)}', '.dsh-wt_edgePanelWrapOn{transform:translateX(0)}',
'.dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}', '.dsh-wt_edgePanel{position:absolute;inset:0;box-sizing:border-box;padding:10px 10px 14px;background:var(--dsw-alias-bg-base,#0b0e14);border-right:1px solid var(--dsw-alias-border-l2,#3a4150);overflow-y:auto;overscroll-behavior:contain}',
'.dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}', '.dsh-wt_edgeHandle{position:absolute;right:0;top:50%;transform:translateY(-50%);width:17px;height:64px;display:flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--dsw-alias-border-l2,#3a4150);border-right:none;border-radius:8px 0 0 8px;background:var(--dsw-alias-fill-l1,rgba(125,125,125,.10));color:var(--dsw-alias-state-accent-primary,#4f8ef7);font-size:13px;line-height:1;cursor:pointer;box-shadow:-4px 0 10px rgba(0,0,0,.14)}',
+21
View File
@@ -717,6 +717,27 @@ export function apply(ctx: Context) {
} }
}, },
}) })
// 诊断通道:内嵌视图(DS Bot 等)没有 DevTools,客户端把现场信息 POST 到这里落盘,
// 便于直接读 <DSH_HOME>/logs/worktable-diag.log。只在显式上报时写入。
register({
kind: 'exact',
path: '/api/worktable/diag',
handler: async (req: any, res: any) => {
if (req.method !== 'POST') { json(res, 405, { error: 'method not allowed' }); return }
try {
const body = await readJsonBody(req)
const line = new Date().toISOString() + ' ' + JSON.stringify(body ?? null).slice(0, 4000)
const fsx = await import('node:fs/promises')
const dir = pathResolve(resolveDshHomeSafe(), 'logs')
await fsx.mkdir(dir, { recursive: true })
await fsx.appendFile(pathResolve(dir, 'worktable-diag.log'), line + String.fromCharCode(10), 'utf8')
json(res, 200, { ok: true })
} catch (err: any) {
json(res, 500, { error: String(err?.message ?? err) })
}
},
})
setupTerminal(webServer, ctx) setupTerminal(webServer, ctx)
} }
+22 -3
View File
@@ -4,9 +4,9 @@
> 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build` > 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build`
> 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。 > 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。
当前版本:**0.5.3-local.12**(2026-12-03) 当前版本:**0.5.3-local.16**(2026-12-04)
产物:`01_content/dist/v0.5.3-local.12/dsh-worktable.tgz`,488199 字节, 产物:`01_content/dist/v0.5.3-local.16/dsh-worktable.tgz`,489153 字节,
sha256 `6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` sha256 `fd6af73a7e6c4620b86b021c480c63cca0e0dc4b397b7ee482d20a8dde07c9e8`
--- ---
@@ -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) ## 三、孤儿路由防护(0.5.3-local.5,2026-12-02)
**现象**:安装/升级其他插件触发 profile 热重载后,侧边栏工作台抽屉整个消失, **现象**:安装/升级其他插件触发 profile 热重载后,侧边栏工作台抽屉整个消失,
+20 -4
View File
@@ -130,7 +130,7 @@ function run() {
// 1) 默认(edgeAutoHide 未设置 = 自动隐藏):停靠态渲染细条,面板默认收起 // 1) 默认(edgeAutoHide 未设置 = 自动隐藏):停靠态渲染细条,面板默认收起
{ {
const { component, hooks } = loadComponent() const { component, hooks } = loadComponent()
const render = () => hooks.render(component, { wide: true, t: (k) => k }) const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render() let tree = render()
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 1, '未渲染左缘细条') assert(byClass(tree, 'dsh-wt_edgeStrip').length === 1, '未渲染左缘细条')
assert(byClass(tree, 'dsh-wt_anchor' + 'x').length === 0, 'sanity') assert(byClass(tree, 'dsh-wt_anchor' + 'x').length === 0, 'sanity')
@@ -154,7 +154,7 @@ function run() {
// 2) 设置开关存在且可切换 // 2) 设置开关存在且可切换
{ {
const { component, hooks, values } = loadComponent() const { component, hooks, values } = loadComponent()
const render = () => hooks.render(component, { wide: true, t: (k) => k }) const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render() let tree = render()
assert(byClass(tree, 'dsh-wt_edgeSettings').length === 1, '设置里缺少侧边栏控制项') assert(byClass(tree, 'dsh-wt_edgeSettings').length === 1, '设置里缺少侧边栏控制项')
const toggle = byClass(tree, 'dsh-wt_edgeSettingsToggle')[0] const toggle = byClass(tree, 'dsh-wt_edgeSettingsToggle')[0]
@@ -170,7 +170,7 @@ function run() {
// 3) 固定常开(edgeAutoHide=false):面板常显 + 出现 « 手柄;细条无 hover 展开 // 3) 固定常开(edgeAutoHide=false):面板常显 + 出现 « 手柄;细条无 hover 展开
{ {
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ edgeAutoHide: false }) } }) const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ edgeAutoHide: false }) } })
const render = () => hooks.render(component, { wide: true, t: (k) => k }) const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render() let tree = render()
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, '固定常开模式下应直接展开') assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, '固定常开模式下应直接展开')
assert(byClass(tree, 'dsh-wt_edgeHandle').length === 1, '固定常开模式应出现 « 手柄') assert(byClass(tree, 'dsh-wt_edgeHandle').length === 1, '固定常开模式应出现 « 手柄')
@@ -187,7 +187,7 @@ function run() {
// 4) 浮动态不受影响 // 4) 浮动态不受影响
{ {
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ dock: 'float', floatTop: 100 }) } }) const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ dock: 'float', floatTop: 100 }) } })
const tree = hooks.render(component, { wide: true, t: (k) => k }) const tree = hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
assert(byClass(tree, 'dsh-wt_float').length >= 1, '浮动态应保留浮动卡片') assert(byClass(tree, 'dsh-wt_float').length >= 1, '浮动态应保留浮动卡片')
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 0, '浮动态不应渲染细条') assert(byClass(tree, 'dsh-wt_edgeStrip').length === 0, '浮动态不应渲染细条')
console.log('PASS 4: 浮动态保持原行为,不渲染细条') console.log('PASS 4: 浮动态保持原行为,不渲染细条')
@@ -196,4 +196,20 @@ function run() {
console.log('\nALL EDGE PANEL CHECKS PASSED') console.log('\nALL EDGE PANEL CHECKS PASSED')
} }
// 5) 侧栏实例在宽屏下不渲染(宽屏面板只由 overlay 实例负责)
{
const { component, hooks } = loadComponent()
const tree = hooks.render(component, { wide: true, t: (k) => k })
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 0, '侧栏实例在宽屏不应渲染细条')
console.log('PASS 5: 侧栏实例宽屏不渲染,避免与 overlay 重复')
}
// 6) 窄屏仍由侧栏实例渲染 rail
{
const { component, hooks } = loadComponent()
const tree = hooks.render(component, { wide: false, t: (k) => k })
assert(byClass(tree, 'dsh-wt_rail').length >= 1, '窄屏 rail 应由侧栏实例渲染')
console.log('PASS 6: 窄屏 rail 由侧栏实例渲染')
}
run() run()
+2 -2
View File
@@ -184,7 +184,7 @@ const click = (node, rect = fakeElement()) => {
async function main() { async function main() {
const { component, hooks, window, values } = loadComponent() const { component, hooks, window, values } = loadComponent()
const render = (wide) => hooks.render(component, { wide, t: (key) => key }) const render = (wide) => hooks.render(component, { wide, slotRole: wide ? 'overlay' : 'sidebar', t: (key) => key })
let tree = render(false) let tree = render(false)
assert(byClass(tree, 'dsh-wt_rail').length === 1, 'collapsed rail was not rendered') assert(byClass(tree, 'dsh-wt_rail').length === 1, 'collapsed rail was not rendered')
assert(byClass(tree, 'dsh-wt_add').length === 0, 'add popup unexpectedly started open') assert(byClass(tree, 'dsh-wt_add').length === 0, 'add popup unexpectedly started open')
@@ -316,7 +316,7 @@ async function testUpdatePresentation() {
json: async () => ({ tag_name: response.tag, body: 'Fixture release', html_url: 'https://example.invalid/release' }) } json: async () => ({ tag_name: response.tag, body: 'Fixture release', html_url: 'https://example.invalid/release' }) }
} }) } })
assert(api.cmpVer('0.5.0', api.LOCAL_VERSION) < 0, 'bundled comparator does not reject the old release') assert(api.cmpVer('0.5.0', api.LOCAL_VERSION) < 0, 'bundled comparator does not reject the old release')
const render = () => hooks.render(component, { wide: true, t: (key) => key }) const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (key) => key })
let tree = render() let tree = render()
click(walk(tree, (node) => node.type === 'button' && node.props?.['aria-label'] === 'menu.viewOptions')[0]) click(walk(tree, (node) => node.type === 'button' && node.props?.['aria-label'] === 'menu.viewOptions')[0])
tree = render() tree = render()
+6 -6
View File
@@ -2,7 +2,7 @@
> ## 📦 本仓库是内部补丁分发仓,不是上游源码仓 > ## 📦 本仓库是内部补丁分发仓,不是上游源码仓
> >
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.12`)。 > 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.16`)。
> 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。 > 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。
### 要不要装 ### 要不要装
@@ -16,16 +16,16 @@
### 安装 ### 安装
当前版本 **v0.5.3-local.12**: 当前版本 **v0.5.3-local.16**:
```bash ```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.16/dsh-worktable.tgz"
``` ```
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。 - **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。
- `--profile web` 按你自己的 profile 名字改。 - `--profile web` 按你自己的 profile 名字改。
- 资产 `dsh-worktable.tgz`,488199 字节,sha256: - 资产 `dsh-worktable.tgz`,489153 字节,sha256:
`6a18b10171c1ebbbe3bf081ab50f8715c5a4d681286dbc323c1f4158719299bb` `fd6af73a7e6c4620b86b021c480c63cca0e0dc4b397b7ee482d20a8dde07c9e8`
(下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对) (下载后可 `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`。 - 声明兼容的 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.14` 后,插件不会提示升级到 0.5.1。
- 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。 - 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。
- 回退官方版: - 回退官方版:
```bash ```bash