Compare commits

...
Author SHA1 Message Date
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 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 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
wangheng 8aae2953d4 Merge pull request 'fix(ui): 边缘细条在 DS Bot 全屏页不可见 (v0.5.3-local.12)' (#13) from fix/v0.5.3-local.12-edge-visibility into main
[v0.5.3-local.12] 边缘细条 DS Bot 可见性
2026-12-03 16:17:58 +08:00
wangheng 6bffa6477e fix(ui): 边缘细条在 DS Bot 全屏页不可见 (v0.5.3-local.12)
现象:DS Bot 全屏页里工作台入口(左缘细条)看不到,切回经典布局才可见。

1. 层级:细条 z-index 65 被宿主全屏页容器盖住 → 提到 2147483000,
   面板 2147483001;细条默认底色与右边框对比度提高。
2. fixed 包含块:祖先带 transform / perspective / filter / contain 时,
   position: fixed 的参照系从视口变成该祖先,细条整体偏移甚至移出可视区。
   新增 fixedOrigin() 测出包含块原点,edgeLeft 换算为相对坐标,
   并夹到 [0, 视口宽-12];无常规侧栏时贴包含块左缘。
3. 自诊断:挂载 800ms 后细条宽高为 0 时 console.warn 输出左侧位置与
   最多 8 层祖先的 display / transform,便于定位宿主槽位被隐藏的情况。

验证:npm run pack 全绿(含 edge-panel 4 组回归),双资产同源 6a18b101…。
2026-12-03 16:17:46 +08:00
wangheng 5cca08d3bb Merge pull request 'feat(ui): 停靠态改为左缘细条 + hover 滑出面板 (v0.5.3-local.11)' (#12) from feat/v0.5.3-local.11-edge-panel into main
[v0.5.3-local.11] 左缘细条 + hover 滑出面板
2026-12-03 15:56:52 +08:00
wangheng 8255ad604c feat(ui): 停靠态改为左缘细条 + hover 滑出面板 (v0.5.3-local.11)
停靠态原先把整个工作台面板常驻挂在 footer 槽位,占用侧栏纵向空间。
改为 12px 左缘细条 + 悬停滑出 250px 面板:

- 自动隐藏(默认):悬停细条滑出,移开 180ms 自动收回
- 固定常开:面板常显,可点右侧 « 手柄收成细条,之后仅点击展开
- 任一弹窗打开期间保持展开,避免误收回
- measureFloatGeo 新增细条左缘测量:优先 footerActions/footArea 左缘 −8,
  链断裂回退侧栏左缘,避免旧兜底 64 的残带
- footer 槽位只留零尺寸锚点,不再占位
- 浮动态(dock=float)保持原浮动卡片,不渲染细条

新增 04_test/edge-panel.test.mjs 并纳入 pack 兼容回归,覆盖默认自动隐藏、
设置开关持久化、固定常开 + « 收起、浮动态不受影响。

验证:npm run pack 全绿,双资产同源 sha256 faed3889…。
2026-12-03 15:56:42 +08:00
wangheng bdae7f8a06 Merge pull request 'fix(update): 复制 AI 提示词可用性、按钮对比度与升级命令版本 (v0.5.3-local.10)' (#11) from fix/v0.5.3-local.10-copy-upgrade into main
[v0.5.3-local.10] 复制与升级命令修复
2026-12-02 17:52:03 +08:00
wangheng 468b0cebec fix(update): 复制 AI 提示词可用性与升级命令版本 (v0.5.3-local.10)
三个问题一起修:

1. 复制不生效:copyText 只试 navigator.clipboard.writeText,在 webview
   (非安全上下文/权限未授予)会抛错直接返回 false,且按钮仍显示原样 →
   表现为「点了没反应」。改为三级降级:Clipboard API → execCommand('copy')
   → 再次 Clipboard API;并新增 update.copyFailed 失败态提示(3s)。

2. 按钮颜色太浅:.dsh-wt_updateBtnCopy 原为 rgba(79,142,247,.18) 半透明底
   + #cfe0ff 浅蓝字,在浅色主题上几乎看不见。改为实心强调色 + 白字 + 加粗,
   并补 hover/active 反馈。

3. 升级命令用的是当前版本:UPDATE_TGZ 写死 v0.5.3-local.9,不随检测结果变化,
   「有新版本」提示里给的却是自己这一版的地址。改为
   worktableUpgrade(tag) 按目标版本生成;index.tsx / split.tsx 两个调用点
   均传 updateInfo.latest。

测试:
- host-transport.test.mjs 调用签名补 tag 参数
- 新增断言:命令必须指向目标版本(local.10 与 local.9 各验一次)

验证:npm run pack 全绿,双资产同源 sha256 2ff7d45a…。
2026-12-02 17:51:52 +08:00
wangheng f2ef7655dd Merge pull request 'feat(ui): 控制室图标改内联 SVG,替代系统 emoji (v0.5.3-local.9)' (#10) from fix/v0.5.3-local.9-svg-icon into main
[v0.5.3-local.9] 控制室图标改 SVG
2026-12-02 17:44:09 +08:00
wangheng 6aa0d3dce4 feat(ui): 控制室图标改内联 SVG,替代系统 emoji (v0.5.3-local.9)
emoji 的渲染完全取决于系统字体(Windows Segoe UI Emoji / macOS Apple Color
Emoji 的形状与配色都不同),同一份代码在不同机器上长得不一样,观感也偏旧
(截图里的 🖥️ 呈老式 CRT 显示器样式)。

- 新增 ICON_CONSOLE 内联 SVG(显示器 + 支架,stroke=currentColor)
- 侧栏控制室卡片改用该图标
- .dsh-wt_layoutIcon 改为定尺寸 flex 容器;新增 .dsh-wt_layoutSvg 跟随主题色,
  选中态取强调色

用户自定义图标选择器(EMOJI_SET)保留不动 —— 那是功能,不是默认值。

验证:npm run pack 全绿,双资产同源 sha256 888d4e8f…。
2026-12-02 17:43:58 +08:00
wangheng b917f0e0ed Merge pull request 'fix(update): 更新检查改走宿主中转,修复 CORS 拦截 (v0.5.3-local.8)' (#9) from fix/v0.5.3-local.8-update-cors into main
[v0.5.3-local.8] 更新检查走宿主中转
2026-12-02 17:30:46 +08:00
wangheng 1b053e5577 fix(update): 更新检查改走宿主中转,修复 Gitea 无 CORS 导致请求被拦 (v0.5.3-local.8)
0.5.3-local.6 把更新检查从上游 GitHub 改到自建 Gitea API,但仍不通:
页面来源是 http://127.0.0.1:<随机端口>,请求 https://gitea.ququclean.com/api/...
属跨源,而 Gitea 不返回 Access-Control-Allow-Origin,浏览器直接拦截 fetch。
表现为「立即检查」无反应、长期显示「上次检查未成功」。

改为宿主中转:
- src/index.ts 新增 /api/worktable/update-check 路由,服务端(Node 无 CORS
  约束)代取 Gitea releases/latest,客户端只请求同源路径
- updateCheck.ts / index.tsx 的 fetch 改指向该同源路由
- 该路由沿既有约定需要鉴权(request-auth.test.mjs 要求除 health/preview-static
  外所有路由都必须拒绝未鉴权请求),未传 publicAsset

测试:sidebar-popup.test.mjs 的 releaseUrl 改为 /api/worktable/update-check。

验证:npm run pack 全绿,双资产同源 sha256 225e8568…。
2026-12-02 17:30:41 +08:00
wangheng 6b8349073d Merge pull request 'fix(styles): 恢复 DS Bot 侧栏「返回 bot」按钮显示 (v0.5.3-local.7)' (#8) from fix/v0.5.3-local.7-restore-bt-return into main
[v0.5.3-local.7] 恢复返回 bot 按钮
2026-12-02 17:25:03 +08:00
wangheng 65b99b8cf3 fix(styles): 恢复 DS Bot 侧栏「返回 bot」按钮显示 (v0.5.3-local.7)
按用户要求,撤回 [data-slot="sidebar.footer.action"] .bt-return 的隐藏规则。
其余三条保留:duet 语音记录开关、nav.bt-home-nav(首页/消息/待办)、连接插件。

验证:npm run pack 全绿,双资产同源 sha256 8c30d35f…。
2026-12-02 17:24:54 +08:00
wangheng 071507e53f Merge pull request 'fix(update): 更新检查改查本仓 Gitea,修复查不到新版 (v0.5.3-local.6)' (#7) from fix/v0.5.3-local.6-update-source into main
[v0.5.3-local.6] 更新检查改查本仓 Gitea
2026-12-02 17:01:11 +08:00
wangheng f65694516f fix(update): 更新检查改查本仓 Gitea,修复查不到新版 (v0.5.3-local.6)
本仓从上游 fork 后,更新检查仍查上游 GitHub,导致:
- 上游只发官方版(无本地补丁),本仓 -local.* 版本它不知道
- 国内网络访问 api.github.com 常失败,显示「上次检查未成功」
- 安装命令也指向上游 github.com

三处改动:
- updateCheck.ts(控制室):改为 Gitea API /api/v1/repos/xiaoqu/dsh-worktable/releases/latest
- index.tsx(设置面板,独立实现):同样改 Gitea API
- hostTransport.ts:安装命令改为带具体 tag 的本仓 tgz

注意 Gitea 不支持 /releases/latest/download 简写(实测 404),
安装命令必须带具体 tag,UPDATE_TGZ 每次发版需同步更新。

版本比较无需改动:cmpVer('v0.5.2-local.6','0.5.3-local.5') = -1,
core 段 0.5.2 < 0.5.3 已能正确判定有新版。

测试同步:sidebar-popup.test.mjs 的 releaseUrl 断言改为新 API 地址。

验证:npm run pack 全绿,双资产同源 sha256 95b2b6b1…。
2026-12-02 17:00:56 +08:00
17 changed files with 1145 additions and 81 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "dsh-worktable",
"description": "工作台:DSH 侧边栏的 agent 级项目容器,收纳如 TravelAtlas 等自装项目",
"version": "0.5.3-local.5",
"version": "0.5.3-local.16",
"entry": {
"name": "dsh-worktable",
"inject": []
+323 -25
View File
@@ -7986,7 +7986,10 @@ var css = xterm_default + "\n" + [
".dsh-wt_layout:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}",
".dsh-wt_layout[data-on=true]{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}",
".dsh-wt_layout[data-on=true] .dsh-wt_layoutName{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}",
".dsh-wt_layoutIcon{flex:none;font-size:15px}",
".dsh-wt_layoutIcon{flex:none;font-size:15px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}",
// 内联 SVG 图标:跟随文字色,两平台渲染一致(emoji 依赖系统字体,形状/配色不统一)
".dsh-wt_layoutSvg{width:15px;height:15px;display:block;flex:none;color:var(--dsw-alias-label-secondary,#9aa4b2)}",
".dsh-wt_layout[data-on=true] .dsh-wt_layoutSvg{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}",
".dsh-wt_layoutText{flex:1;min-width:0;display:flex;flex-direction:column;gap:0}",
".dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
@@ -8404,7 +8407,11 @@ var css = xterm_default + "\n" + [
".dsh-wt_updateBtn svg{width:12px;height:12px;flex:none}",
".dsh-wt_updateBadge svg{width:12px;height:12px;flex:none}",
".dsh-wt_updateBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}",
".dsh-wt_updateBtnCopy{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:rgba(79,142,247,.18);color:#cfe0ff}",
// 「复制 AI 提示词」主按钮:原来用 rgba(...,.18) 半透明底 + 浅蓝字,在实际主题上
// 对比度极低(截图里几乎看不见)。改为实心强调色 + 白字,hover/active 明确反馈。
".dsh-wt_updateBtnCopy{border-color:transparent;background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff;font-weight:600}",
".dsh-wt_updateBtnCopy:hover{background:var(--dsw-alias-state-accent-primary-hover,#3f7de0);color:#fff}",
".dsh-wt_updateBtnCopy:active{transform:translateY(.5px)}",
".dsh-wt_updateHint{font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
".dsh-wt_versionRow{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
".dsh-wt_updateToggle{display:flex;align-items:center;gap:6px;cursor:pointer;user-select:none}",
@@ -8423,11 +8430,24 @@ var css = xterm_default + "\n" + [
".dsh-wt_foldBtnGhost{cursor:default;pointer-events:none}",
".dsh-wt_layoutHasKids .dsh-wt_layoutArrow{margin-right:0}",
".dsh-wt_manageRowSub{margin-left:20px}",
// 停靠态:左缘细条 + 滑出面板
".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;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_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;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_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:hover{background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff}",
".dsh-wt_edgeSettings{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);font-size:11.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}",
".dsh-wt_edgeSettingsLabel{user-select:none;-webkit-user-select:none}",
".dsh-wt_edgeSettingsToggle{display:inline-flex;align-items:center;cursor:pointer}",
// DS Bot 侧栏元素隐藏(迁移自「改 ds-bot/client.js 插 return null」的做法)。
// 动机:ds-bot 是随应用升级的 .bundled-plugins tgz 安装,升级/重装必丢改;
// 改为由本插件注入 CSS,只要工作台装着,ds-bot 随便升级都不丢。
// 注意:nav.bt-home-nav 必须带 nav 标签选择器 —— BotHome 错误面板有同名 div,不能误伤。
'[data-slot="sidebar.footer.action"] .bt-return{display:none!important}',
// 「返回 bot」按钮([data-slot="sidebar.footer.action"] .bt-return)按用户要求保留显示,不隐藏。
'[data-testid="duet-transcript-toggle"]{display:none!important}',
"nav.bt-home-nav{display:none!important}",
".bt-connect-wrap{display:none!important}"
@@ -8490,6 +8510,8 @@ var zh = {
"manage.deleteProject": "\u5220\u9664\u9879\u76EE",
"manage.changeView": "\u53D8\u66F4\u89C6\u56FE",
"manage.addPage": "\u65B0\u589E\u4E8C\u7EA7\u9875\u9762",
"edge.autoHide": "\u81EA\u52A8\u9690\u85CF\u4FA7\u8FB9\u680F",
"edge.collapse": "\u6536\u8D77\u4FA7\u8FB9\u680F",
"tree.fold": "\u6298\u53E0\u4E8C\u7EA7\u9875\u9762",
"tree.expand": "\u5C55\u5F00\u4E8C\u7EA7\u9875\u9762",
"viewPick.title": "\u9009\u62E9\u65B0\u89C6\u56FE\uFF08\u5185\u5BB9\u7A97\u81EA\u52A8\u8FC1\u5165\uFF09",
@@ -8659,6 +8681,7 @@ var zh = {
"update.available": "\u65B0\u7248\u672C\u53EF\u7528",
"update.current": "\u5F53\u524D\u7248\u672C",
"update.copyAi": "\u590D\u5236 AI \u63D0\u793A\u8BCD",
"update.copyFailed": "\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u9009\u4E2D\u547D\u4EE4",
"update.skip": "\u5FFD\u7565\u6B64\u7248\u672C",
"update.autoCheck": "\u81EA\u52A8\u68C0\u67E5\u66F4\u65B0",
"update.checkNow": "\u7ACB\u5373\u68C0\u67E5",
@@ -8727,6 +8750,8 @@ var en = {
"manage.deleteProject": "Delete project",
"manage.changeView": "Change layout",
"manage.addPage": "Add sub page",
"edge.autoHide": "Auto-hide sidebar",
"edge.collapse": "Collapse sidebar",
"tree.fold": "Collapse sub pages",
"tree.expand": "Expand sub pages",
"viewPick.title": "Pick a new layout (panes migrate automatically)",
@@ -8896,6 +8921,7 @@ var en = {
"update.available": "New version available",
"update.current": "Current version",
"update.copyAi": "Copy AI prompt",
"update.copyFailed": "Copy failed, select the command manually",
"update.skip": "Skip this version",
"update.autoCheck": "Auto-check updates",
"update.checkNow": "Check now",
@@ -8967,9 +8993,17 @@ function hostPreviewUrl(path, surface = {
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Unsupported Host preview protocol");
return url.href;
}
function worktableUpgrade(protocol = typeof location === "undefined" ? "http:" : location.protocol) {
var UPDATE_BASE = "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download";
function upgradeCommandFor(tag, protocol = typeof location === "undefined" ? "http:" : location.protocol) {
const desktop = protocol === "dsh-app:";
const command = "dsh plugin --profile " + (desktop ? "desktop" : "web") + ' add "https://github.com/Aisland-SJL/dsh-worktable/releases/latest/download/dsh-worktable.tgz"';
const clean = String(tag || "").trim().replace(/^v/, "");
const t = clean ? "v" + clean : "";
const url = t ? UPDATE_BASE + "/" + t + "/dsh-worktable.tgz" : UPDATE_BASE + "/";
return "dsh plugin --profile " + (desktop ? "desktop" : "web") + ' add "' + url + '"';
}
function worktableUpgrade(tag, protocol = typeof location === "undefined" ? "http:" : location.protocol) {
const desktop = protocol === "dsh-app:";
const command = upgradeCommandFor(tag, protocol);
const prompt = desktop ? "\u5E2E\u6211\u5347\u7EA7 dsh-worktable\u3002\u6211\u5F53\u524D\u4F7F\u7528\u5B98\u65B9\u684C\u9762\u7AEF\uFF1A\u5148\u5B9A\u4F4D\u8BE5\u684C\u9762\u7AEF\u81EA\u5E26\u7684 dsh CLI \u5E76\u51C6\u5907\u66F4\u65B0\uFF0C\u518D\u63D0\u9192\u6211\u5B8C\u6574\u9000\u51FA\u684C\u9762\u7AEF\u3002\u786E\u8BA4\u9000\u51FA\u540E\u4F7F\u7528\u8BE5 CLI \u6267\u884C " + command + "\u3002\u4E0D\u8981\u4F7F\u7528\u7F51\u9875\u7AEF CLI\uFF0C\u4E0D\u8981\u4FEE\u6539 web profile\uFF0C\u4E0D\u8981\u81EA\u52A8\u6740\u8FDB\u7A0B\u6216\u91CD\u542F\uFF1B\u5B8C\u6210\u540E\u63D0\u9192\u6211\u624B\u52A8\u91CD\u65B0\u6253\u5F00\u684C\u9762\u7AEF\u3002" : "\u5E2E\u6211\u5347\u7EA7 dsh-worktable\uFF1A\u6267\u884C " + command + "\uFF0C\u5B8C\u6210\u540E\u63D0\u9192\u6211\u91CD\u542F dsh web \u5E76\u5237\u65B0\u9875\u9762";
return { command, prompt, desktop };
}
@@ -9199,8 +9233,8 @@ 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.5";
var UPDATE_REPO = "Aisland-SJL/dsh-worktable";
var LOCAL_VERSION = false ? "dev" : "0.5.3-local.16";
var UPDATE_API = "/api/worktable/update-check";
var K_UPDATE_CHECK = "dsh.worktable.updateCheck.v1";
var K_LAST_CHECK = "dsh.worktable.lastUpdateCheck.v1";
var K_SKIP = "dsh.worktable.skipVersion.v1";
@@ -9304,7 +9338,7 @@ async function checkUpdate(force = false) {
const ctrl = new AbortController();
const timer2 = setTimeout(() => ctrl.abort(), 8e3);
try {
const r = await fetch("https://api.github.com/repos/" + UPDATE_REPO + "/releases/latest", { headers: { Accept: "application/vnd.github+json" }, cache: "no-store", signal: ctrl.signal });
const r = await fetch(UPDATE_API, { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
if (r.ok) d = await r.json();
else if (r.status === 403 || r.status === 404) break;
} catch {
@@ -17360,7 +17394,6 @@ function boxPayload(x0, y0, x1, y1) {
}
return { primary, line, candidates, limited, src };
}
var { prompt: UPGRADE_AI } = worktableUpgrade();
async function copyTextSafe(text2) {
try {
if (navigator.clipboard?.writeText) {
@@ -18641,7 +18674,8 @@ function ConsolePane() {
};
const [updCopied, setUpdCopied] = (0, import_react2.useState)(false);
const onCopyUpgrade = async () => {
const ok = await copyTextSafe(UPGRADE_AI);
const { prompt } = worktableUpgrade(updInfo?.latest ?? LOCAL_VERSION);
const ok = await copyTextSafe(prompt);
if (ok) {
setUpdCopied(true);
window.setTimeout(() => setUpdCopied(false), 2200);
@@ -20869,8 +20903,8 @@ function flushHostSave() {
// src/client/index.tsx
var import_jsx_runtime3 = require("react/jsx-runtime");
var UPDATE_REPO2 = "Aisland-SJL/dsh-worktable";
var { command: UPGRADE_CMD, prompt: UPGRADE_AI2, desktop: DESKTOP_HOST } = worktableUpgrade();
var UPDATE_API2 = "/api/worktable/update-check";
var DESKTOP_HOST = typeof location !== "undefined" && location.protocol === "dsh-app:";
var ICON_SYNC = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { viewBox: "0 0 16 16", "aria-hidden": true, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", d: "M1.5 8a6.5 6.5 0 0 1 11.1-4.6L14.5 5" }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", d: "M14.5 1.5V5h-3.5" }),
@@ -20882,6 +20916,26 @@ var ICON_SPARK = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { viewBox:
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12.6 11.2l.5 1.3 1.3.5-1.3.5-.5 1.3-.5-1.3-1.3-.5 1.3-.5z", fill: "currentColor" })
] });
async function copyText(text2) {
try {
if (navigator.clipboard?.writeText && window.isSecureContext !== false) {
await navigator.clipboard.writeText(text2);
return true;
}
} catch {
}
try {
const ta = document.createElement("textarea");
ta.value = text2;
ta.setAttribute("readonly", "");
ta.style.cssText = "position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none";
document.body.appendChild(ta);
ta.select();
ta.setSelectionRange(0, ta.value.length);
const ok = typeof document.execCommand === "function" ? document.execCommand("copy") : false;
document.body.removeChild(ta);
if (ok) return true;
} catch {
}
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(text2);
@@ -21077,6 +21131,7 @@ function normalizeView(raw) {
dock: p.dock === "float" ? "float" : "footer",
floatTop: typeof p.floatTop === "number" ? p.floatTop : null,
foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x) => typeof x === "string") : [],
edgeAutoHide: p.edgeAutoHide !== false,
consoleTheme: p.consoleTheme === "dark" || p.consoleTheme === "light" || p.consoleTheme === "system" ? p.consoleTheme : "system",
consoleCols: typeof p.consoleCols === "number" && p.consoleCols >= 1 && p.consoleCols <= 5 ? Math.round(p.consoleCols) : 3,
consoleShape: p.consoleShape === "circle" ? "circle" : "square",
@@ -21161,6 +21216,15 @@ function findSidebar(start) {
if (typeof el.className === "string" && /SidebarRoot|sidebar/i.test(el.className)) return el;
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;
}
var registryStore = { ids: [], listeners: /* @__PURE__ */ new Set() };
@@ -21287,6 +21351,11 @@ async function ensureSessionModel(sessionId) {
}
var CONSOLE_ID = "wt-console";
var CONSOLE_ICON = "\u{1F5A5}\uFE0F";
var ICON_CONSOLE = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { className: "dsh-wt_layoutSvg", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "1.6", y: "2.2", width: "12.8", height: "8.6", rx: "1.5", stroke: "currentColor", strokeWidth: "1.3" }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5.2 13.4h5.6", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M8 10.8v2.6", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
] });
function specHasConsoleTab(spec) {
return !!spec?.main?.[0]?.tabs?.some((t) => t.content?.kind === "builtin" && t.content.type === "console");
}
@@ -21744,8 +21813,9 @@ function RenameInput(props) {
);
}
function WorktableSection(props) {
const slotRole = props.slotRole === "overlay" ? "overlay" : "sidebar";
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 {
@@ -21769,6 +21839,7 @@ function WorktableSection(props) {
const updateInfo = newerUpdateInfo(rawUpdateInfo);
const [updateCheckOn, setUpdateCheckOn] = (0, import_react3.useState)(() => localStorage.getItem("dsh.worktable.updateCheck.v1") !== "0");
const [updateCopied, setUpdateCopied] = (0, import_react3.useState)(false);
const [updateCopyFailed, setUpdateCopyFailed] = (0, import_react3.useState)(false);
const [updateStatus, setUpdateStatus] = (0, import_react3.useState)("idle");
const updateCheckingRef = (0, import_react3.useRef)(false);
const updateAliveRef = (0, import_react3.useRef)(true);
@@ -21793,7 +21864,7 @@ function WorktableSection(props) {
const ctrl = new AbortController();
const timer2 = setTimeout(() => ctrl.abort(), 8e3);
try {
const r = await fetch("https://api.github.com/repos/" + UPDATE_REPO2 + "/releases/latest", { headers: { Accept: "application/vnd.github+json" }, cache: "no-store", signal: ctrl.signal });
const r = await fetch(UPDATE_API2, { headers: { Accept: "application/json" }, cache: "no-store", signal: ctrl.signal });
if (r.ok) d = await r.json();
else if (r.status === 403 || r.status === 404) break;
} catch {
@@ -21829,11 +21900,19 @@ function WorktableSection(props) {
(0, import_react3.useEffect)(() => {
if (updateCheckOn) void checkUpdates();
}, [updateCheckOn, checkUpdates]);
const upgrade = (0, import_react3.useMemo)(
() => worktableUpgrade(updateInfo?.latest ?? LOCAL_VERSION),
[updateInfo?.latest]
);
const copyUpgradeAi = async () => {
const ok = await copyText(UPGRADE_AI2);
const ok = await copyText(upgrade.prompt);
if (ok) {
setUpdateCopyFailed(false);
setUpdateCopied(true);
setTimeout(() => setUpdateCopied(false), 2200);
} else {
setUpdateCopyFailed(true);
setTimeout(() => setUpdateCopyFailed(false), 3e3);
}
};
const skipUpdate = () => {
@@ -21892,6 +21971,11 @@ function WorktableSection(props) {
const [bottomInset, setBottomInset] = (0, import_react3.useState)(0);
const bottomInsetRef = (0, import_react3.useRef)(0);
const [floatGeo, setFloatGeo] = (0, import_react3.useState)(null);
const [edgeLeft, setEdgeLeft] = (0, import_react3.useState)(64);
const stripRef = (0, import_react3.useRef)(null);
const [edgeOpen, setEdgeOpen] = (0, import_react3.useState)(false);
const [edgeDismissed, setEdgeDismissed] = (0, import_react3.useState)(false);
const edgeCloseTimer = (0, import_react3.useRef)(null);
const [sidebarRight, setSidebarRight] = (0, import_react3.useState)(null);
const [activeSplitId, setActiveSplitId] = (0, import_react3.useState)(
() => splitStore.active && splitStore.spec ? splitStore.spec.id : null
@@ -22276,10 +22360,28 @@ function WorktableSection(props) {
};
}
}, [wide, measureRailRect]);
const fixedOrigin = (0, import_react3.useCallback)(() => {
let el = rootRef.current?.parentElement ?? null;
while (el && el !== document.body && el !== document.documentElement) {
const cs = getComputedStyle(el);
const transform = cs.transform && cs.transform !== "none";
const perspective = cs.perspective && cs.perspective !== "none";
const filter = cs.filter && cs.filter !== "none";
const contain = /paint|layout|strict|content/i.test(cs.contain || "");
if (transform || perspective || filter || contain) {
const r = el.getBoundingClientRect();
return { left: r.left + el.scrollLeft, top: r.top + el.scrollTop };
}
el = el.parentElement;
}
return { left: 0, top: 0 };
}, []);
const measureFloatGeo = (0, import_react3.useCallback)(() => {
const origin = fixedOrigin();
const sidebar = findSidebar(rootRef.current);
if (!sidebar) {
setFloatGeo({ left: 14, width: null });
setEdgeLeft(Math.round(Math.max(0, -origin.left)));
return;
}
const rect = sidebar.getBoundingClientRect();
@@ -22289,12 +22391,31 @@ function WorktableSection(props) {
const margin = 20;
const width = rect.width - padLeft - padRight - margin * 2;
setSidebarRight(Math.round(rect.right));
setEdgeLeft((() => {
let el = rootRef.current;
let viewportLeft = null;
while (el) {
if (typeof el.className === "string" && /footerActions|footArea/i.test(el.className)) {
const r = el.getBoundingClientRect();
if (r.width > 120) {
viewportLeft = Math.round(r.left) - 8;
break;
}
break;
}
el = el.parentElement;
}
const base2 = viewportLeft ?? Math.round(rect.left);
const relative = base2 - Math.round(origin.left);
const maxLeft = Math.max(0, (typeof window !== "undefined" ? window.innerWidth : 1280) - 12);
return Math.min(maxLeft, Math.max(0, relative));
})());
if (width > 0) {
setFloatGeo({ left: Math.round(rect.left + padLeft + margin), width: Math.round(width) });
} else {
setFloatGeo({ left: 14, width: null });
}
}, []);
}, [fixedOrigin]);
(0, import_react3.useLayoutEffect)(() => {
measureFloatGeo();
const sidebar = findSidebar(rootRef.current);
@@ -22697,11 +22818,11 @@ function WorktableSection(props) {
if (!mountedRef.current || !raw || widgetReadSeqRef.current[binding.bindingId] !== readSeq) return;
const resolved = widgetRegistry.resolve(binding, raw, current.spec, current.folder);
if (!resolved || !force && mountedWidgetRef.current[binding.bindingId] === raw) return;
const content = buildMountContent(binding.folder, resolved.item);
if (!content) return;
const content2 = buildMountContent(binding.folder, resolved.item);
if (!content2) return;
const open = splitStore.active && splitStore.spec?.id === binding.projectId;
if (open) {
splitStore.lockPane(resolved.target.row, resolved.target.index, content);
splitStore.lockPane(resolved.target.row, resolved.target.index, content2);
recordMountedWidget(binding.bindingId, raw);
delete pendingMountRef.current[binding.bindingId];
persistPendingWidgets();
@@ -23214,6 +23335,41 @@ function WorktableSection(props) {
}
return out;
}, [visibleLayouts, effectiveOrder, view.foldedProjects]);
const cancelEdgeClose = (0, import_react3.useCallback)(() => {
if (edgeCloseTimer.current != null) {
window.clearTimeout(edgeCloseTimer.current);
edgeCloseTimer.current = null;
}
}, []);
const openEdge = (0, import_react3.useCallback)(() => {
cancelEdgeClose();
setEdgeDismissed(false);
setEdgeOpen(true);
}, [cancelEdgeClose]);
const scheduleEdgeClose = (0, import_react3.useCallback)(() => {
cancelEdgeClose();
edgeCloseTimer.current = window.setTimeout(() => setEdgeOpen(false), 180);
}, [cancelEdgeClose]);
(0, import_react3.useEffect)(() => () => cancelEdgeClose(), [cancelEdgeClose]);
const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null || iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null;
(0, import_react3.useEffect)(() => {
const id = window.setTimeout(() => {
const el = stripRef.current;
if (!el) return;
const r = el.getBoundingClientRect();
if (r.width > 0 && r.height > 0) return;
let chain = [];
let node = el.parentElement;
while (node && node !== document.body && chain.length < 8) {
const cs = getComputedStyle(node);
chain.push(node.tagName.toLowerCase() + "." + (node.className || "") + ":display=" + cs.display + ",transform=" + cs.transform);
node = node.parentElement;
}
console.warn("[dsh-worktable] \u8FB9\u7F18\u7EC6\u6761\u4E0D\u53EF\u89C1\uFF08\u5BBD\u9AD8\u4E3A 0 \u6216\u88AB\u9690\u85CF\uFF09", { left: el.style.left, rect: { w: r.width, h: r.height }, chain });
}, 800);
return () => window.clearTimeout(id);
}, []);
const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : edgeOpen || anyPopupOpen;
const isFloat = float != null;
const floatStyle = isFloat ? {
position: "fixed",
@@ -23462,9 +23618,9 @@ function WorktableSection(props) {
updateInfo.latest
] }),
updateInfo.notes && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateNotes", children: updateInfo.notes }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateCmd", children: UPGRADE_CMD }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_updateCmd", children: upgrade.command }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_updateBtns", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_updateBtn dsh-wt_updateBtnCopy", onClick: () => void copyUpgradeAi(), children: updateCopied ? "\u2713 " + t("update.copied") : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "dsh-wt_updateBtn dsh-wt_updateBtnCopy", onClick: () => void copyUpgradeAi(), children: updateCopied ? "\u2713 " + t("update.copied") : updateCopyFailed ? "\u26A0 " + t("update.copyFailed") : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
ICON_SPARK,
" ",
t("update.copyAi")
@@ -23919,8 +24075,8 @@ function WorktableSection(props) {
popupLayer
] });
}
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section" + (isFloat ? " dsh-wt_float" : ""), style: isFloat ? floatStyle : dockedStyle, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }),
if (slotRole === "overlay" ? !wide : wide) 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)(
"button",
@@ -24045,7 +24201,7 @@ function WorktableSection(props) {
title: t("console.name"),
onClick: (e) => clickConsoleCard(e.currentTarget),
children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutIcon", children: CONSOLE_ICON }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutIcon", children: ICON_CONSOLE }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutText", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_layoutName", children: t("console.name") }) }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"span",
@@ -24163,11 +24319,147 @@ function WorktableSection(props) {
]
},
s.id
)) })
)) }),
!isFloat && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dsh-wt_edgeSettings", children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_edgeSettingsLabel", children: t("edge.autoHide") }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"span",
{
className: "dsh-wt_edgeSettingsToggle",
role: "switch",
"aria-checked": view.edgeAutoHide !== false,
"aria-label": t("edge.autoHide"),
tabIndex: 0,
onClick: () => {
setEdgeDismissed(false);
persistView({ edgeAutoHide: view.edgeAutoHide === false });
},
onKeyDown: (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
setEdgeDismissed(false);
persistView({ edgeAutoHide: view.edgeAutoHide === false });
}
},
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_updateSwitch", "data-off": view.edgeAutoHide === false ? "true" : void 0 })
}
)
] })
] });
if (isFloat) {
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_float", style: floatStyle, children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_divider" }),
content
] });
}
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: rootRef, className: "dsh-wt_section dsh-wt_edgeAnchor", style: dockedStyle, "aria-hidden": true }),
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"div",
{
ref: stripRef,
className: "dsh-wt_edgeStrip" + (edgeVisible ? " dsh-wt_edgeStripOn" : ""),
style: { left: edgeLeft },
role: "button",
tabIndex: 0,
"aria-label": t("title"),
title: t("title"),
onMouseEnter: view.edgeAutoHide === false ? void 0 : openEdge,
onMouseLeave: scheduleEdgeClose,
onClick: openEdge,
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dsh-wt_edgeStripGlyph", "aria-hidden": true, children: "\xBB" })
}
),
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
"div",
{
className: "dsh-wt_edgePanelWrap" + (edgeVisible ? " dsh-wt_edgePanelWrapOn" : ""),
style: { left: edgeLeft },
onMouseEnter: cancelEdgeClose,
onMouseLeave: scheduleEdgeClose,
children: [
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "dsh-wt_section dsh-wt_edgePanel", children: content }),
view.edgeAutoHide === false && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
"button",
{
type: "button",
className: "dsh-wt_edgeHandle",
"aria-label": t("edge.collapse"),
title: t("edge.collapse"),
onClick: () => setEdgeDismissed(true),
children: "\xAB"
}
)
]
}
)
] });
}
var inject = ["slots", "locale", "sessions", "conversation", "workspaces"];
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 };
clientCtx = ctx;
try {
@@ -24281,6 +24573,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:
+51 -1
View File
@@ -382,7 +382,7 @@ function resolveDshHomeSafe() {
cachedDshHome = baseDshHome();
return cachedDshHome;
}
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.5";
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.16";
var name = "dsh-worktable";
var inject = ["webServer", "sessions"];
var HEALTH_PATH = "/api/worktable/health";
@@ -743,6 +743,35 @@ function apply(ctx) {
json(res, 200, { plugin: "dsh-worktable", version: PLUGIN_VERSION, ok: true });
}
});
register({
kind: "exact",
path: "/api/worktable/update-check",
handler: async (_req, res) => {
const upstream = "https://gitea.ququclean.com/api/v1/repos/xiaoqu/dsh-worktable/releases/latest";
const ctrl = new AbortController();
const timer = setTimeout(() => ctrl.abort(), 8e3);
try {
const r = await fetch(upstream, {
headers: { Accept: "application/json", "user-agent": "dsh-worktable/" + PLUGIN_VERSION },
signal: ctrl.signal
});
if (!r.ok) {
json(res, 502, { error: "upstream status " + r.status });
return;
}
const d = await r.json();
json(res, 200, {
tag_name: typeof d?.tag_name === "string" ? d.tag_name : "",
body: typeof d?.body === "string" ? d.body : "",
html_url: typeof d?.html_url === "string" ? d.html_url : ""
});
} catch (err) {
json(res, 502, { error: "upstream unreachable: " + String(err?.message ?? err) });
} finally {
clearTimeout(timer);
}
}
});
register({
kind: "exact",
path: "/api/worktable/file",
@@ -1112,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);
}
export {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "dsh-worktable",
"description": "工作台 Worktable:DeepSeek Harness 侧边栏的 agent 级项目容器(应用抽屉)",
"version": "0.5.3-local.5",
"version": "0.5.3-local.16",
"repository": {
"type": "git",
"url": "https://github.com/Aisland-SJL/dsh-worktable.git",
+1 -1
View File
@@ -83,7 +83,7 @@ if (!patchOk) process.exit(1)
console.log('[release-prep] identity check passed (' + IDENTITY + ', cordis.patch.yml strict)')
// ---------- 2. 会话/输入兼容回归 + 构建 + 语法检查 ----------
const compatTests = ['host-input.test.mjs', 'session-compat.test.mjs', 'session-details.test.mjs', 'host-transport.test.mjs', 'widget-mount.test.mjs', 'request-auth.test.mjs', 'preview-files.test.mjs', 'sandboxed-frame.test.mjs', 'update-check.test.mjs']
const compatTests = ['host-input.test.mjs', 'session-compat.test.mjs', 'session-details.test.mjs', 'host-transport.test.mjs', 'widget-mount.test.mjs', 'request-auth.test.mjs', 'preview-files.test.mjs', 'sandboxed-frame.test.mjs', 'update-check.test.mjs', 'edge-panel.test.mjs']
.map((file) => join(HERE, '..', '04_test', file))
const compatRun = spawnSync(process.execPath, ['--test', ...compatTests], { cwd: HERE, stdio: 'inherit' })
if (compatRun.status !== 0) { console.error('[release-prep] FAIL: session/input compatibility tests'); process.exit(1) }
+15 -2
View File
@@ -36,9 +36,22 @@ export function hostPreviewUrl(
}
/** Keep update instructions on the active profile; Desktop must use its bundled CLI. */
export function worktableUpgrade(protocol = typeof location === 'undefined' ? 'http:' : location.protocol) {
// 本仓发布在自建 Gitea:它不支持 GitHub 的 /releases/latest/download 简写,
// 安装命令必须带具体 tag。tag 由调用方传入(等于检查到的新版本),
// 不再写死当前版本——否则「有新版本」提示里给的却是自己这一版的地址。
const UPDATE_BASE = 'https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download'
export function upgradeCommandFor(tag: string, protocol = typeof location === 'undefined' ? 'http:' : location.protocol): string {
const desktop = protocol === 'dsh-app:'
const command = 'dsh plugin --profile ' + (desktop ? 'desktop' : 'web') + ' add "https://github.com/Aisland-SJL/dsh-worktable/releases/latest/download/dsh-worktable.tgz"'
const clean = String(tag || '').trim().replace(/^v/, '')
const t = clean ? 'v' + clean : ''
const url = t ? UPDATE_BASE + '/' + t + '/dsh-worktable.tgz' : UPDATE_BASE + '/'
return 'dsh plugin --profile ' + (desktop ? 'desktop' : 'web') + ' add "' + url + '"'
}
export function worktableUpgrade(tag: string, protocol = typeof location === 'undefined' ? 'http:' : location.protocol) {
const desktop = protocol === 'dsh-app:'
const command = upgradeCommandFor(tag, protocol)
const prompt = desktop
? '帮我升级 dsh-worktable。我当前使用官方桌面端:先定位该桌面端自带的 dsh CLI 并准备更新,再提醒我完整退出桌面端。确认退出后使用该 CLI 执行 ' + command + '。不要使用网页端 CLI,不要修改 web profile,不要自动杀进程或重启;完成后提醒我手动重新打开桌面端。'
: '帮我升级 dsh-worktable:执行 ' + command + ',完成后提醒我重启 dsh web 并刷新页面'
+308 -16
View File
@@ -30,9 +30,14 @@ import { loadHostState, queueHostSave, markHydrated, staysReadOnly, flushHostSav
type OrderBy = 'manual' | 'recent'
type DockMode = 'footer' | 'float'
// ── 更新检查(客户端直连 GitHub Releases API,只读 GET;失败静默)──
const UPDATE_REPO = 'Aisland-SJL/dsh-worktable'
const { command: UPGRADE_CMD, prompt: UPGRADE_AI, desktop: DESKTOP_HOST } = worktableUpgrade()
// ── 更新检查(客户端直连本仓 Gitea Releases API,只读 GET;失败静默)──
// 本仓是内部补丁分发仓:上游只发官方版(无本地补丁),
// 查上游既看不到本仓版本,国内网络也常失败。
// 走宿主中转:页面来源是随机端口 127.0.0.1,直连 Gitea 跨源且无 CORS 头会被拦截
const UPDATE_API = '/api/worktable/update-check'
// 升级命令必须在「检测到新版本」后按该版本生成(见下方 upgrade 系列 useMemo),
// 不能用模块级常量——否则提示里给的是当前已装版本的地址。
const DESKTOP_HOST = typeof location !== 'undefined' && location.protocol === 'dsh-app:'
// 更新提示图标(手绘 SVG,避免 emoji 跨平台渲染差异)
const ICON_SYNC = (
<svg viewBox="0 0 16 16" aria-hidden>
@@ -48,10 +53,33 @@ const ICON_SPARK = (
<path d="M12.6 11.2l.5 1.3 1.3.5-1.3.5-.5 1.3-.5-1.3-1.3-.5 1.3-.5z" fill="currentColor" />
</svg>
)
/**
* 复制文案:优先 Clipboard API;不可用(webview 非安全上下文、权限未授予、
* 或 API 存在但调用被拒)时回退到 execCommand('copy'),再不行用隐藏 textarea + 选区。
* 只返回 true 表示「文本确实进了剪贴板」,避免按钮显示 ✓ 却什么都没复制。
*/
async function copyText(text: string): Promise<boolean> {
try {
if (navigator.clipboard?.writeText && window.isSecureContext !== false) {
await navigator.clipboard.writeText(text)
return true
}
} catch { /* 继续降级 */ }
try {
const ta = document.createElement('textarea')
ta.value = text
ta.setAttribute('readonly', '')
ta.style.cssText = 'position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none'
document.body.appendChild(ta)
ta.select()
ta.setSelectionRange(0, ta.value.length)
const ok = typeof document.execCommand === 'function' ? document.execCommand('copy') : false
document.body.removeChild(ta)
if (ok) return true
} catch { /* 继续降级 */ }
try {
if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(text); return true }
} catch { /* fallthrough */ }
} catch { /* 全部失败 */ }
return false
}
@@ -63,6 +91,8 @@ type ViewState = {
floatTop: number | null
/** 折叠中的项目 id(这些项目不展开显示其二级页面;缺省 = 全部展开)*/
foldedProjects?: string[]
/** 停靠态边缘面板:自动隐藏(默认 true = 悬停细条滑出、移开收回;false = 常开,手动点 « 收起)*/
edgeAutoHide?: boolean
/** 控制室面板主题:dark/light/system(system = 跟随宿主 color-scheme,即 DSH 深色/白色/跟随系统设置) */
consoleTheme?: 'dark' | 'light' | 'system'
/** 控制室每行显示项目数(1-5,默认 3)*/
@@ -331,6 +361,7 @@ function normalizeView(raw: any): ViewState {
dock: p.dock === 'float' ? 'float' : 'footer',
floatTop: typeof p.floatTop === 'number' ? p.floatTop : null,
foldedProjects: Array.isArray(p.foldedProjects) ? p.foldedProjects.filter((x: unknown): x is string => typeof x === 'string') : [],
edgeAutoHide: p.edgeAutoHide !== false,
consoleTheme: p.consoleTheme === 'dark' || p.consoleTheme === 'light' || p.consoleTheme === 'system' ? p.consoleTheme : 'system',
consoleCols: typeof p.consoleCols === 'number' && p.consoleCols >= 1 && p.consoleCols <= 5 ? Math.round(p.consoleCols) : 3,
consoleShape: p.consoleShape === 'circle' ? 'circle' : 'square',
@@ -427,6 +458,15 @@ function findSidebar(start: HTMLElement | null): HTMLElement | null {
if (typeof el.className === 'string' && /SidebarRoot|sidebar/i.test(el.className)) return el
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
}
@@ -563,6 +603,20 @@ async function ensureSessionModel(sessionId: string): Promise<void> {
const CONSOLE_ID = 'wt-console'
const CONSOLE_ICON = '🖥️'
/**
* 控制室图标:内联 SVG 替代 emoji。
* emoji 的渲染完全取决于系统字体(Windows Segoe UI Emoji / macOS Apple Color Emoji
* 形状与配色都不同),同一份代码在不同机器上长得不一样,看起来也偏旧。
* 用 currentColor 描边图标可跟随主题色,两平台一致。
*/
const ICON_CONSOLE = (
<svg className="dsh-wt_layoutSvg" viewBox="0 0 16 16" fill="none" aria-hidden="true">
<rect x="1.6" y="2.2" width="12.8" height="8.6" rx="1.5" stroke="currentColor" strokeWidth="1.3" />
<path d="M5.2 13.4h5.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
<path d="M8 10.8v2.6" stroke="currentColor" strokeWidth="1.3" strokeLinecap="round" />
</svg>
)
/** 控制室布局是否健全:主窗格首格存在 console 类型标签(旧版关标签的坏存档没有它) */
function specHasConsoleTab(spec: LayoutSpec | undefined): boolean {
return !!spec?.main?.[0]?.tabs?.some((t) => t.content?.kind === 'builtin' && t.content.type === 'console')
@@ -1044,8 +1098,10 @@ function RenameInput(props: { initial: string; placeholder: string; onCommit: (v
}
function WorktableSection(props: any) {
const slotRole: 'sidebar' | 'overlay' = props.slotRole === 'overlay' ? 'overlay' : 'sidebar'
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, string>): string => {
if (typeof props.t === 'function') {
@@ -1075,6 +1131,7 @@ function WorktableSection(props: any) {
const updateInfo = newerUpdateInfo(rawUpdateInfo)
const [updateCheckOn, setUpdateCheckOn] = useState<boolean>(() => localStorage.getItem('dsh.worktable.updateCheck.v1') !== '0')
const [updateCopied, setUpdateCopied] = useState(false)
const [updateCopyFailed, setUpdateCopyFailed] = useState(false)
const [updateStatus, setUpdateStatus] = useState<'idle' | 'checking' | 'uptodate' | 'failed'>('idle')
const updateCheckingRef = useRef(false)
const updateAliveRef = useRef(true)
@@ -1094,7 +1151,7 @@ function WorktableSection(props: any) {
const ctrl = new AbortController()
const timer = setTimeout(() => ctrl.abort(), 8000) // 单次 8s 超时,计入下一轮重试
try {
const r = await fetch('https://api.github.com/repos/' + UPDATE_REPO + '/releases/latest', { headers: { Accept: 'application/vnd.github+json' }, cache: 'no-store', signal: ctrl.signal })
const r = await fetch(UPDATE_API, { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
if (r.ok) d = await r.json() as { tag_name?: string; body?: string; html_url?: string }
else if (r.status === 403 || r.status === 404) break // 限流/不存在:不再重试
} catch { /* 网络抖动/超时:下一轮重试 */ }
@@ -1114,9 +1171,22 @@ function WorktableSection(props: any) {
}
}, [])
useEffect(() => { if (updateCheckOn) void checkUpdates() }, [updateCheckOn, checkUpdates])
// 升级命令/提示按「检测到的新版本」生成:给出的是要装的版本,而不是当前已装版本。
const upgrade = useMemo(
() => worktableUpgrade(updateInfo?.latest ?? LOCAL_VERSION),
[updateInfo?.latest],
)
const copyUpgradeAi = async () => {
const ok = await copyText(UPGRADE_AI)
if (ok) { setUpdateCopied(true); setTimeout(() => setUpdateCopied(false), 2200) }
const ok = await copyText(upgrade.prompt)
if (ok) {
setUpdateCopyFailed(false)
setUpdateCopied(true)
setTimeout(() => setUpdateCopied(false), 2200)
} else {
// 复制失败要让用户看见,否则就是「点了没反应」
setUpdateCopyFailed(true)
setTimeout(() => setUpdateCopyFailed(false), 3000)
}
}
const skipUpdate = () => {
if (updateInfo) {
@@ -1184,6 +1254,15 @@ function WorktableSection(props: any) {
const [bottomInset, setBottomInset] = useState(0)
const bottomInsetRef = useRef(0)
const [floatGeo, setFloatGeo] = useState<{ left: number; width: number | null } | null>(null)
// ── 停靠态:左缘细条 + hover 滑出面板 ──
// 细条常驻左缘;hover 展开面板,移开延迟 180ms 收回(防抖动);
// 任何弹窗打开期间保持展开;「自动隐藏」关掉后常开,可手动点 « 收成细条。
const [edgeLeft, setEdgeLeft] = useState(64)
const stripRef = useRef<HTMLDivElement | null>(null)
const [edgeOpen, setEdgeOpen] = useState(false)
const [edgeDismissed, setEdgeDismissed] = useState(false)
const edgeCloseTimer = useRef<number | null>(null)
const [sidebarRight, setSidebarRight] = useState<number | null>(null)
const [activeSplitId, setActiveSplitId] = useState<string | null>(() =>
splitStore.active && splitStore.spec ? splitStore.spec.id : null,
@@ -1560,10 +1639,37 @@ function WorktableSection(props: any) {
// dockWidth = sidebar 宽 − paddingLeft − paddingRight − 40(每边内缩 20)
// left = sidebar 左边缘视口坐标 + paddingLeft + 20
// 降级:找不到 sidebar 或宽度 ≤0 → left 固定 14px,宽度不设内联(交 CSS min/max 处理)
/**
* position:fixed 的包含块原点。
* 任何祖先带 transform / perspective / filter / contain(paint|layout|strict|content)
* 都会把 fixed 的参照系从视口改成该祖先 —— DS Bot 等全屏页面常带 transform,
* 直接用视口坐标会让细条和面板整体偏移甚至移出可视区。
* 这里返回该包含块的实际原点(视口坐标),供调用方把期望坐标换算成相对值。
*/
const fixedOrigin = useCallback((): { left: number; top: number } => {
let el: HTMLElement | null = rootRef.current?.parentElement ?? null
while (el && el !== document.body && el !== document.documentElement) {
const cs = getComputedStyle(el)
const transform = cs.transform && cs.transform !== 'none'
const perspective = cs.perspective && cs.perspective !== 'none'
const filter = cs.filter && cs.filter !== 'none'
const contain = /paint|layout|strict|content/i.test(cs.contain || '')
if (transform || perspective || filter || contain) {
const r = el.getBoundingClientRect()
return { left: r.left + el.scrollLeft, top: r.top + el.scrollTop }
}
el = el.parentElement
}
return { left: 0, top: 0 }
}, [])
const measureFloatGeo = useCallback(() => {
const origin = fixedOrigin()
const sidebar = findSidebar(rootRef.current)
if (!sidebar) {
// 宿主没有常规侧栏(如 DS Bot 全屏页):细条贴包含块左缘,保证入口可见
setFloatGeo({ left: 14, width: null })
setEdgeLeft(Math.round(Math.max(0, -origin.left)))
return
}
const rect = sidebar.getBoundingClientRect()
@@ -1573,12 +1679,33 @@ function WorktableSection(props: any) {
const margin = 20
const width = rect.width - padLeft - padRight - margin * 2
setSidebarRight(Math.round(rect.right))
// 细条贴左缘:优先从 footerActions/footArea 容器实测左缘 − 栏内边距 8;
// 链断裂时回退实测侧栏左缘(webview 内浅色栏左缘即原生 rail 右缘,xiaoquai 为 0)。
// 旧兜底 64 会在隐藏态留出 64px 残带。
// 结果再减去 fixed 包含块原点,换算成相对定位祖先的坐标。
setEdgeLeft((() => {
let el: HTMLElement | null = rootRef.current
let viewportLeft: number | null = null
while (el) {
if (typeof el.className === 'string' && /footerActions|footArea/i.test(el.className)) {
const r = el.getBoundingClientRect()
if (r.width > 120) { viewportLeft = Math.round(r.left) - 8; break }
break
}
el = el.parentElement
}
const base = viewportLeft ?? Math.round(rect.left)
const relative = base - Math.round(origin.left)
// 夹到 [0, 视口宽 - 12]:定位祖先尺寸异常时不至于把细条推出可视区
const maxLeft = Math.max(0, (typeof window !== 'undefined' ? window.innerWidth : 1280) - 12)
return Math.min(maxLeft, Math.max(0, relative))
})())
if (width > 0) {
setFloatGeo({ left: Math.round(rect.left + padLeft + margin), width: Math.round(width) })
} else {
setFloatGeo({ left: 14, width: null })
}
}, [])
}, [fixedOrigin])
useLayoutEffect(() => {
measureFloatGeo()
@@ -2532,6 +2659,42 @@ function buildCustomLayoutPrompt(req: string): string {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [visibleLayouts, effectiveOrder, view.foldedProjects])
// ── 边缘面板开关:hover 打开/移开延迟收回;弹窗期间保持展开 ──
const cancelEdgeClose = useCallback(() => {
if (edgeCloseTimer.current != null) { window.clearTimeout(edgeCloseTimer.current); edgeCloseTimer.current = null }
}, [])
const openEdge = useCallback(() => { cancelEdgeClose(); setEdgeDismissed(false); setEdgeOpen(true) }, [cancelEdgeClose])
const scheduleEdgeClose = useCallback(() => {
cancelEdgeClose()
edgeCloseTimer.current = window.setTimeout(() => setEdgeOpen(false), 180)
}, [cancelEdgeClose])
useEffect(() => () => cancelEdgeClose(), [cancelEdgeClose])
const anyPopupOpen = addOpen || viewOptionsOpen || customOpen || requestDelete != null
|| iconPick != null || bindPick != null || viewPickFor != null || consoleBind != null
// 边缘面板可见性自诊断:宿主把 footer 槽位 display:none / 祖先带 transform 时,
// fixed 细条可能整块不渲染。只在不可见时 warn 一次,便于现场定位。
useEffect(() => {
const id = window.setTimeout(() => {
const el = stripRef.current
if (!el) return
const r = el.getBoundingClientRect()
if (r.width > 0 && r.height > 0) return
let chain: string[] = []
let node: HTMLElement | null = el.parentElement
while (node && node !== document.body && chain.length < 8) {
const cs = getComputedStyle(node)
chain.push(node.tagName.toLowerCase() + '.' + (node.className || '') + ':display=' + cs.display + ',transform=' + cs.transform)
node = node.parentElement
}
console.warn('[dsh-worktable] 边缘细条不可见(宽高为 0 或被隐藏)', { left: el.style.left, rect: { w: r.width, h: r.height }, chain })
}, 800)
return () => window.clearTimeout(id)
}, [])
/** 自动隐藏模式看 hover 状态;常开模式看是否被手动收起 */
const edgeVisible = view.edgeAutoHide === false ? !edgeDismissed : (edgeOpen || anyPopupOpen)
const isFloat = float != null
const floatStyle = isFloat
? {
@@ -2732,10 +2895,10 @@ function buildCustomLayoutPrompt(req: string): string {
<div className="dsh-wt_updateHead"><span className="dsh-wt_updateDot" />{t('update.available')} · v{updateInfo.latest}</div>
<div className="dsh-wt_updateVers">{t('update.current')} v{LOCAL_VERSION} → v{updateInfo.latest}</div>
{updateInfo.notes && <div className="dsh-wt_updateNotes">{updateInfo.notes}</div>}
<div className="dsh-wt_updateCmd">{UPGRADE_CMD}</div>
<div className="dsh-wt_updateCmd">{upgrade.command}</div>
<div className="dsh-wt_updateBtns">
<button type="button" className="dsh-wt_updateBtn dsh-wt_updateBtnCopy" onClick={() => void copyUpgradeAi()}>
{updateCopied ? '✓ ' + t('update.copied') : <>{ICON_SPARK} {t('update.copyAi')}</>}
{updateCopied ? '✓ ' + t('update.copied') : updateCopyFailed ? '⚠ ' + t('update.copyFailed') : <>{ICON_SPARK} {t('update.copyAi')}</>}
</button>
<button type="button" className="dsh-wt_updateBtn" onClick={skipUpdate}>{t('update.skip')}</button>
</div>
@@ -3145,9 +3308,14 @@ function buildCustomLayoutPrompt(req: string): string {
)
}
return (
<div ref={rootRef} className={'dsh-wt_section' + (isFloat ? ' dsh-wt_float' : '')} style={isFloat ? floatStyle : dockedStyle}>
<div className="dsh-wt_divider" />
// 角色分流(不依赖宿主视图探测):
// - 宽屏面板:只由 overlay 实例渲染。ds-bot 在 DS Bot 页 shadow 掉 sidebar.footer.action
// 座位,侧栏实例在该页不会挂载;overlay 层不受影响,两个视图都能渲染。
// - 窄屏 rail:仍由侧栏实例渲染(overlay 里没有侧栏几何可用)。
if (slotRole === 'overlay' ? !wide : wide) return null
const content = (
<>
<div className="dsh-wt_header">
<button
type="button"
@@ -3238,7 +3406,7 @@ function buildCustomLayoutPrompt(req: string): string {
title={t('console.name')}
onClick={(e) => clickConsoleCard(e.currentTarget as HTMLElement)}
>
<span className="dsh-wt_layoutIcon">{CONSOLE_ICON}</span>
<span className="dsh-wt_layoutIcon">{ICON_CONSOLE}</span>
<span className="dsh-wt_layoutText">
<span className="dsh-wt_layoutName">{t('console.name')}</span>
</span>
@@ -3331,13 +3499,128 @@ function buildCustomLayoutPrompt(req: string): string {
))}
</div>
)}
</div>
{/* 侧边栏控制(仅停靠态展示;浮动态无意义) */}
{!isFloat && (
<div className="dsh-wt_edgeSettings">
<span className="dsh-wt_edgeSettingsLabel">{t('edge.autoHide')}</span>
<span
className="dsh-wt_edgeSettingsToggle"
role="switch"
aria-checked={view.edgeAutoHide !== false}
aria-label={t('edge.autoHide')}
tabIndex={0}
onClick={() => { setEdgeDismissed(false); persistView({ edgeAutoHide: view.edgeAutoHide === false }) }}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setEdgeDismissed(false); persistView({ edgeAutoHide: view.edgeAutoHide === false }) }
}}
>
<span className="dsh-wt_updateSwitch" data-off={view.edgeAutoHide === false ? 'true' : undefined} />
</span>
</div>
)}
</>
)
// 浮动态:保留原浮动卡片(含分隔线)
if (isFloat) {
return (
<div ref={rootRef} className="dsh-wt_section dsh-wt_float" style={floatStyle}>
<div className="dsh-wt_divider" />
{content}
</div>
)
}
// 停靠态 = 左缘细条 + hover 滑出面板:footer 槽位只留零尺寸锚点(不占位),
// 细条贴左缘,面板从该缘滑出盖住浅色栏,移开自动收回。
return (
<>
<div ref={rootRef} className="dsh-wt_section dsh-wt_edgeAnchor" style={dockedStyle} aria-hidden />
<div
ref={stripRef}
className={'dsh-wt_edgeStrip' + (edgeVisible ? ' dsh-wt_edgeStripOn' : '')}
style={{ left: edgeLeft }}
role="button"
tabIndex={0}
aria-label={t('title')}
title={t('title')}
onMouseEnter={view.edgeAutoHide === false ? undefined : openEdge}
onMouseLeave={scheduleEdgeClose}
onClick={openEdge}
><span className="dsh-wt_edgeStripGlyph" aria-hidden>»</span></div>
<div
className={'dsh-wt_edgePanelWrap' + (edgeVisible ? ' dsh-wt_edgePanelWrapOn' : '')}
style={{ left: edgeLeft }}
onMouseEnter={cancelEdgeClose}
onMouseLeave={scheduleEdgeClose}
>
<div className="dsh-wt_section dsh-wt_edgePanel">{content}</div>
{view.edgeAutoHide === false && (
<button
type="button"
className="dsh-wt_edgeHandle"
aria-label={t('edge.collapse')}
title={t('edge.collapse')}
onClick={() => setEdgeDismissed(true)}
>«</button>
)}
</div>
</>
)
}
export const inject = ['slots', 'locale', 'sessions', 'conversation', 'workspaces']
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 服务引用(模块级)
sessionBridge = { sessions: ctx.sessions ?? null, conversation: ctx.conversation ?? null, list: ctx.sessions?.list ?? null, workspaces: ctx.workspaces ?? null }
clientCtx = ctx
@@ -3447,6 +3730,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 }
+6
View File
@@ -61,6 +61,8 @@ export const zh = {
'manage.deleteProject': '删除项目',
'manage.changeView': '变更视图',
'manage.addPage': '新增二级页面',
'edge.autoHide': '自动隐藏侧边栏',
'edge.collapse': '收起侧边栏',
'tree.fold': '折叠二级页面',
'tree.expand': '展开二级页面',
'viewPick.title': '选择新视图(内容窗自动迁入)',
@@ -230,6 +232,7 @@ export const zh = {
'update.available': '新版本可用',
'update.current': '当前版本',
'update.copyAi': '复制 AI 提示词',
'update.copyFailed': '复制失败,请手动选中命令',
'update.skip': '忽略此版本',
'update.autoCheck': '自动检查更新',
'update.checkNow': '立即检查',
@@ -303,6 +306,8 @@ export const en = {
'manage.deleteProject': 'Delete project',
'manage.changeView': 'Change layout',
'manage.addPage': 'Add sub page',
'edge.autoHide': 'Auto-hide sidebar',
'edge.collapse': 'Collapse sidebar',
'tree.fold': 'Collapse sub pages',
'tree.expand': 'Expand sub pages',
'viewPick.title': 'Pick a new layout (panes migrate automatically)',
@@ -472,6 +477,7 @@ export const en = {
'update.available': 'New version available',
'update.current': 'Current version',
'update.copyAi': 'Copy AI prompt',
'update.copyFailed': 'Copy failed, select the command manually',
'update.skip': 'Skip this version',
'update.autoCheck': 'Auto-check updates',
'update.checkNow': 'Check now',
+5 -3
View File
@@ -492,8 +492,8 @@ function boxPayload(x0: number, y0: number, x1: number, y1: number): { primary:
return { primary, line, candidates, limited, src }
}
/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启) */
const { prompt: UPGRADE_AI } = worktableUpgrade()
/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启)。
* 命令按「检测到的新版本」生成 —— 见下方 onCopyUpgrade 里的 worktableUpgrade(tag)。 */
async function copyTextSafe(text: string): Promise<boolean> {
try { if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(text); return true } } catch {}
@@ -1764,7 +1764,9 @@ function ConsolePane() {
}
const [updCopied, setUpdCopied] = useState(false)
const onCopyUpgrade = async () => {
const ok = await copyTextSafe(UPGRADE_AI)
// 按检测到的新版本生成命令;没有新版本时退回当前版本(保持原有可复制行为)
const { prompt } = worktableUpgrade(updInfo?.latest ?? LOCAL_VERSION)
const ok = await copyTextSafe(prompt)
if (ok) { setUpdCopied(true); window.setTimeout(() => setUpdCopied(false), 2200) }
}
const onSkipVersion = () => {
+23 -3
View File
@@ -234,7 +234,10 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_layout:hover{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
'.dsh-wt_layout[data-on=true]{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:var(--dsw-alias-fill-l1,rgba(255,255,255,.05))}',
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutName{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
'.dsh-wt_layoutIcon{flex:none;font-size:15px}',
'.dsh-wt_layoutIcon{flex:none;font-size:15px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px}',
// 内联 SVG 图标:跟随文字色,两平台渲染一致(emoji 依赖系统字体,形状/配色不统一)
'.dsh-wt_layoutSvg{width:15px;height:15px;display:block;flex:none;color:var(--dsw-alias-label-secondary,#9aa4b2)}',
'.dsh-wt_layout[data-on=true] .dsh-wt_layoutSvg{color:var(--dsw-alias-state-accent-primary,#4f8ef7)}',
'.dsh-wt_layoutText{flex:1;min-width:0;display:flex;flex-direction:column;gap:0}',
'.dsh-wt_layoutName{font-size:12px;font-weight:400;line-height:17px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
// 箭头与项目名同一行高 + 字面中心对齐;› 墨迹在字面框内偏下,整体上移 1px 使视觉居中
@@ -653,7 +656,11 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_updateBtn svg{width:12px;height:12px;flex:none}',
'.dsh-wt_updateBadge svg{width:12px;height:12px;flex:none}',
'.dsh-wt_updateBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}',
'.dsh-wt_updateBtnCopy{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:rgba(79,142,247,.18);color:#cfe0ff}',
// 「复制 AI 提示词」主按钮:原来用 rgba(...,.18) 半透明底 + 浅蓝字,在实际主题上
// 对比度极低(截图里几乎看不见)。改为实心强调色 + 白字,hover/active 明确反馈。
'.dsh-wt_updateBtnCopy{border-color:transparent;background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff;font-weight:600}',
'.dsh-wt_updateBtnCopy:hover{background:var(--dsw-alias-state-accent-primary-hover,#3f7de0);color:#fff}',
'.dsh-wt_updateBtnCopy:active{transform:translateY(.5px)}',
'.dsh-wt_updateHint{font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
'.dsh-wt_versionRow{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
'.dsh-wt_updateToggle{display:flex;align-items:center;gap:6px;cursor:pointer;user-select:none}',
@@ -672,11 +679,24 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_foldBtnGhost{cursor:default;pointer-events:none}',
'.dsh-wt_layoutHasKids .dsh-wt_layoutArrow{margin-right:0}',
'.dsh-wt_manageRowSub{margin-left:20px}',
// 停靠态:左缘细条 + 滑出面板
'.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;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_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;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_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:hover{background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff}',
'.dsh-wt_edgeSettings{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);font-size:11.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
'.dsh-wt_edgeSettingsLabel{user-select:none;-webkit-user-select:none}',
'.dsh-wt_edgeSettingsToggle{display:inline-flex;align-items:center;cursor:pointer}',
// DS Bot 侧栏元素隐藏(迁移自「改 ds-bot/client.js 插 return null」的做法)。
// 动机:ds-bot 是随应用升级的 .bundled-plugins tgz 安装,升级/重装必丢改;
// 改为由本插件注入 CSS,只要工作台装着,ds-bot 随便升级都不丢。
// 注意:nav.bt-home-nav 必须带 nav 标签选择器 —— BotHome 错误面板有同名 div,不能误伤。
'[data-slot="sidebar.footer.action"] .bt-return{display:none!important}',
// 「返回 bot」按钮([data-slot="sidebar.footer.action"] .bt-return)按用户要求保留显示,不隐藏。
'[data-testid="duet-transcript-toggle"]{display:none!important}',
'nav.bt-home-nav{display:none!important}',
'.bt-connect-wrap{display:none!important}',
+6 -2
View File
@@ -1,7 +1,11 @@
/** 更新检查核心(控制室公告页使用;设置面板保留自身实现,后续版本统一去重)。键与设置面板共用。 */
declare const __WT_VERSION__: string
export const LOCAL_VERSION = typeof __WT_VERSION__ === 'undefined' ? 'dev' : __WT_VERSION__
const UPDATE_REPO = 'Aisland-SJL/dsh-worktable'
// 本仓是内部补丁分发仓,更新源必须是自己的 Gitea,而不是上游 GitHub:
// 上游只发布官方版(无本地补丁),查它既看不到本仓版本,国内网络也常失败。
// 走宿主中转(/api/worktable/update-check):页面来源是随机端口的 127.0.0.1,
// 直连 Gitea 属跨源且 Gitea 无 CORS 头,浏览器会拦截请求。
const UPDATE_API = '/api/worktable/update-check'
export type UpdateStatus = 'idle' | 'checking' | 'uptodate' | 'failed'
export type UpdateInfo = { latest: string; notes: string; url: string }
@@ -92,7 +96,7 @@ export async function checkUpdate(force = false): Promise<{ status: UpdateStatus
const ctrl = new AbortController()
const timer = setTimeout(() => ctrl.abort(), 8000)
try {
const r = await fetch('https://api.github.com/repos/' + UPDATE_REPO + '/releases/latest', { headers: { Accept: 'application/vnd.github+json' }, cache: 'no-store', signal: ctrl.signal })
const r = await fetch(UPDATE_API, { headers: { Accept: 'application/json' }, cache: 'no-store', signal: ctrl.signal })
if (r.ok) d = (await r.json()) as { tag_name?: string; body?: string; html_url?: string }
else if (r.status === 403 || r.status === 404) break
} catch { /* 网络抖动/超时:下一轮重试 */ }
+51
View File
@@ -368,6 +368,36 @@ export function apply(ctx: Context) {
},
})
// 更新检查中转:客户端页面来源是 http://127.0.0.1:<随机端口>,直接 fetch
// 自建 Gitea 属跨源请求;Gitea 不返回 Access-Control-Allow-Origin,浏览器会拦截
// (表现为「立即检查」无反应 / 「上次检查未成功」)。改由宿主服务端代取,同源无 CORS。
register({
kind: 'exact',
path: '/api/worktable/update-check',
handler: async (_req: any, res: any) => {
const upstream = 'https://gitea.ququclean.com/api/v1/repos/xiaoqu/dsh-worktable/releases/latest'
const ctrl = new AbortController()
const timer = setTimeout(() => ctrl.abort(), 8000)
try {
const r = await fetch(upstream, {
headers: { Accept: 'application/json', 'user-agent': 'dsh-worktable/' + PLUGIN_VERSION },
signal: ctrl.signal,
})
if (!r.ok) { json(res, 502, { error: 'upstream status ' + r.status }); return }
const d: any = await r.json()
json(res, 200, {
tag_name: typeof d?.tag_name === 'string' ? d.tag_name : '',
body: typeof d?.body === 'string' ? d.body : '',
html_url: typeof d?.html_url === 'string' ? d.html_url : '',
})
} catch (err: any) {
json(res, 502, { error: 'upstream unreachable: ' + String(err?.message ?? err) })
} finally {
clearTimeout(timer)
}
},
})
// 本地文件读取(资源管理器点击 .html 后浏览器标签内打开)
register({
kind: 'exact',
@@ -687,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)
}
+122 -15
View File
@@ -4,9 +4,9 @@
> 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build`
> 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。
当前版本:**0.5.3-local.5**(2026-12-02)
产物:`01_content/dist/v0.5.3-local.5/dsh-worktable.tgz`,485007 字节,
sha256 `cf633ad71d175a7125d4d49da1732515f32e6d02dc8ae4b7786379e8f712a31d`
当前版本:**0.5.3-local.16**(2026-12-04)
产物:`01_content/dist/v0.5.3-local.16/dsh-worktable.tgz`,489153 字节,
sha256 `fd6af73a7e6c4620b86b021c480c63cca0e0dc4b397b7ee482d20a8dde07c9e8`
---
@@ -33,7 +33,69 @@ sha256 `cf633ad71d175a7125d4d49da1732515f32e6d02dc8ae4b7786379e8f712a31d`
---
## 二、孤儿路由防护(0.5.3-local.5,2026-12-02)
## 二、停靠态边缘面板:左缘细条 + hover 滑出(0.5.3-local.11,2026-12-03)
**动机**:停靠态原先直接把整个工作台面板挂在 footer 槽位常驻,占用侧栏纵向空间。
改为「左缘 12px 细条 + 悬停滑出 250px 面板」,可用时收起、需要时滑出。
**两种模式**(面板底部「自动隐藏侧边栏」开关,存 `view.edgeAutoHide`):
| 模式 | 行为 |
|---|---|
| **自动隐藏**(默认,开关 ON) | 悬停细条 → 面板滑出;移开 180ms → 自动收回 |
| **固定常开**(开关 OFF) | 面板常显;点右侧 « 手柄收成细条,之后仅点击细条重新展开(不随 hover) |
**关键实现**:
| 位置 | 内容 |
|---|---|
| `src/client/index.tsx` `ViewState.edgeAutoHide` | 视图状态,normalize 缺省 `true` |
| 同文件 `edgeOpen` / `edgeDismissed` / `edgeCloseTimer` | 展开态、手动收起态、180ms 防抖关闭定时器 |
| 同文件 `edgeVisible` | 自动隐藏看 `edgeOpen \|\| anyPopupOpen`;常开看 `!edgeDismissed` |
| 同文件 `anyPopupOpen` | 任一弹窗(添加/设置/自定义/删除确认/图标/绑定/视图/控制室绑定)打开期间保持展开 |
| 同文件 `measureFloatGeo` | 新增 `setEdgeLeft(...)`:优先 footerActions/footArea 容器左缘 −8,链断裂回退侧栏左缘;**避免旧兜底 64 留下的残带** |
| 渲染 `dsh-wt_edgeAnchor` | footer 槽位只留零尺寸锚点,不再占位 |
| 渲染 `dsh-wt_edgeStrip` / `dsh-wt_edgePanelWrap` | 细条 + 滑出包裹层(`transform: translateX(-100%)` → `0`) |
| `src/client/styles.ts` | `.dsh-wt_edgeStrip/.edgePanelWrap/.edgePanel/.edgeHandle/.edgeSettings` |
| `src/client/locales.ts` | `edge.autoHide` / `edge.collapse` 中英 |
**浮动态不受影响**:`dock === 'float'` 仍走原浮动卡片分支,不渲染细条。
**回归**:`04_test/edge-panel.test.mjs`(已纳入 `npm run pack` 的兼容回归),覆盖
默认自动隐藏、设置开关持久化、固定常开 + « 收起、浮动态不受影响 4 组场景。
**0.5.3-local.12 修正(2026-12-03):DS Bot 界面看不到入口**
现象:DS Bot 全屏页里边缘细条不可见,切回经典布局才看得到。
两个原因都修了:
1. **层级**:细条 被宿主全屏页的容器盖住 → 提到 (面板 ),并加大细条默认底色/边框对比度。
2. **fixed 包含块**:祖先带 时, 的参照系会从视口变成该祖先,导致整体偏移甚至移出可视区。新增 测出该祖先原点, 换算成相对坐标,并夹到 ;找不到常规侧栏时细条贴包含块左缘。
诊断:挂载 800ms 后若细条宽高为 0, 打印左侧位置与最多 8 层祖先的 ,便于定位「槽位被 display:none」这类宿主侧问题。
---
**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 热重载后,侧边栏工作台抽屉整个消失,
日志报 `webserver: duplicate exact route "/api/worktable/health"`。
@@ -67,7 +129,7 @@ const register = (route: any, publicAsset = false) => {
---
## 三、iframe 全屏(0.5.3-local.5,2026-12-02)
## 四、iframe 全屏(0.5.3-local.5,2026-12-02)
**动机**:项目窗格里的看板(HTML 单文件)自带全屏按钮,缺 `allowFullScreen`
会被浏览器拒绝。
@@ -80,7 +142,7 @@ return <iframe className="dsh-wt_paneFrame" src={fileUrl} title={basenameOf(prop
---
## 四、二级页面(父子项目树,0.5.3-local.5,2026-12-02)
## 五、二级页面(父子项目树,0.5.3-local.5,2026-12-02)
**能力**:项目下可挂独立布局页,侧栏按树形展示(仅一级嵌套)。
@@ -105,7 +167,7 @@ return <iframe className="dsh-wt_paneFrame" src={fileUrl} title={basenameOf(prop
---
## 五、DS Bot 侧栏元素隐藏(0.5.3-local.5,2026-12-02)
## 六、DS Bot 侧栏元素隐藏(0.5.3-local.5,2026-12-02)
**背景**:原先通过改 `ds-bot/client.js`(组件开头插 `return null`)实现隐藏。
ds-bot 是随应用升级的 `.bundled-plugins` tgz 安装,**升级/重装必丢**。
@@ -115,18 +177,63 @@ ds-bot 是随应用升级的 `.bundled-plugins` tgz 安装,**升级/重装必
**改动**:`src/client/styles.ts` 末尾四条:
```css
[data-slot="sidebar.footer.action"] .bt-return{display:none!important} /* ds-bot「返回 bot」按钮 */
[data-testid="duet-transcript-toggle"]{display:none!important} /* duet 语音记录开关 */
nav.bt-home-nav{display:none!important} /* 首页/消息/待办 */
.bt-connect-wrap{display:none!important} /* 连接插件 */
[data-testid="duet-transcript-toggle"]{display:none!important} /* duet 语音记录开关 */
nav.bt-home-nav{display:none!important} /* 首页/消息/待办 */
.bt-connect-wrap{display:none!important} /* 连接插件 */
```
**0.5.3-local.7 起**:侧栏底部的「返回 bot」按钮(`[data-slot="sidebar.footer.action"] .bt-return`)
按用户要求**恢复显示**,不再隐藏。
**注意**:`nav.bt-home-nav` 必须带 `nav` 标签选择器 —— BotHome 错误面板有同名
`div.bt-home-nav`,不能误伤。
---
## 六、工具链修复(0.5.3-local.5,2026-12-02)
## 七、更新检查改指本仓 Gitea(0.5.3-local.6,2026-12-02)
**现象**:控制室/设置里点「立即检查」,查不到本仓新发布的版本,还常显示「上次检查未成功」。
**根因**:本仓从上游 fork 后,更新检查仍查上游 GitHub:
```ts
fetch('https://api.github.com/repos/Aisland-SJL/dsh-worktable/releases/latest')
```
三重问题:
1. 上游只发**官方版**(无本地补丁),本仓的 `-local.*` 版本它根本不知道
2. 国内网络访问 `api.github.com` 常失败 → 「检查未成功」
3. 安装命令也指向上游 `github.com/.../releases/latest/download/`
**改动**(三处):
| 文件 | 改动 |
|---|---|
| `src/client/updateCheck.ts` | 控制室用:`UPDATE_HOST` + Gitea API `/api/v1/repos/xiaoqu/dsh-worktable/releases/latest` |
| `src/client/index.tsx` | 设置面板用(独立实现):同样改 Gitea API |
| `src/client/hostTransport.ts` | `worktableUpgrade()` 的安装命令改为带具体 tag 的本仓 tgz |
**注意**:Gitea **不支持** GitHub 的 `/releases/latest/download/<asset>` 简写(实测 404),
安装命令必须带具体 tag,所以 `UPDATE_TGZ` 是固定 URL,每次发版要同步更新。
**测试**:`04_test/sidebar-popup.test.mjs` 的 `releaseUrl` 断言同步改为新 API 地址。
**0.5.3-local.8 修正(2026-12-02)**:直连 Gitea API 仍不通 —— 页面来源是
`http://127.0.0.1:<随机端口>`,请求 `https://gitea.ququclean.com/api/...` 属跨源,
而 **Gitea 不返回 `Access-Control-Allow-Origin`**,浏览器直接拦截 fetch
(表现为「立即检查」无反应、长期显示「上次检查未成功」)。
改为**宿主中转**:`src/index.ts` 新增 `/api/worktable/update-check` 路由,
由服务端(Node,无 CORS 约束)代取 Gitea 的 `releases/latest`,客户端只请求同源路径。
该路由沿既有约定**需要鉴权**(`request-auth.test.mjs` 要求除 health/preview-static 外
所有路由都必须拒绝未鉴权请求)。
**版本比较无需改动**:`cmpVer('v0.5.2-local.6', '0.5.3-local.5') = -1`,
core 段 0.5.2 < 0.5.3 已能正确判定「有新版」。
---
## 八、工具链修复(0.5.3-local.5,2026-12-02)
三个 Windows 兼容缺陷,不修则 `npm run pack` 门禁过不去:
@@ -141,7 +248,7 @@ nav.bt-home-nav{display:none!important} /* 首
---
## 七、安装 / 重启
## 九、安装 / 重启
- 发布版安装:`dsh plugin --profile web add "<release tgz URL>"`
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开。
@@ -151,7 +258,7 @@ nav.bt-home-nav{display:none!important} /* 首
---
## 八、回归入口
## 十、回归入口
```bash
cd 01_content
@@ -170,7 +277,7 @@ sidebar/control-room/update 呈现 → 真实 Chromium 分栏边距(5 场景
---
## 九、已知边界
## 十一、已知边界
1. **同 tag 资产不可覆盖**:坏包处理 = 发新版本号 + 旧 Release 正文标注问题。
2. 平台边界:Windows 网页端为已测范围;macOS 为核心路径已做跨平台适配、
+215
View File
@@ -0,0 +1,215 @@
// 边缘面板(左缘细条 + hover 滑出)行为验证:针对实际构建产物。
import { readFileSync } from 'node:fs'
import { createContext, runInNewContext } from 'node:vm'
import { fileURLToPath } from 'node:url'
import { dirname, join, resolve } from 'node:path'
const BUNDLE = resolve(process.argv[2] ?? join(dirname(fileURLToPath(import.meta.url)), '..', '01_content', 'lib', 'client.js'))
const source = readFileSync(BUNDLE, 'utf8')
const assert = (c, m) => { if (!c) throw new Error(m) }
const Fragment = Symbol('test.fragment')
const jsx = (type, props, key) => ({ type, props: props ?? {}, key: key ?? props?.key ?? null })
function makeHooks() {
const slots = []
let cursor = 0
const useState = (initial) => {
const i = cursor++
if (!(i in slots)) slots[i] = typeof initial === 'function' ? initial() : initial
return [slots[i], (next) => { slots[i] = typeof next === 'function' ? next(slots[i]) : next }]
}
const useRef = (initial) => {
const i = cursor++
if (!(i in slots)) slots[i] = { current: initial }
return slots[i]
}
const pass = (a, b) => b ?? undefined
const React = {
createElement: (type, props, ...children) => ({ type, props: { ...(props ?? {}), children: children.length > 1 ? children : children[0] }, key: props?.key ?? null }),
Fragment, useState, useRef,
useMemo: (fn) => fn(),
useCallback: (fn) => fn,
useEffect: () => {},
useLayoutEffect: () => {},
useContext: () => undefined,
useReducer: (r, initial) => [initial, () => {}],
memo: (c) => c,
forwardRef: (c) => c,
createContext: () => ({ Provider: Fragment, Consumer: Fragment }),
version: 'test',
}
return { React, render: (component, props) => { cursor = 0; return component(props) } }
}
function fakeElement(tag = 'div') {
const el = {
tagName: String(tag).toUpperCase(),
className: '', style: {}, children: [], dataset: {},
classList: { add() {}, remove() {}, contains: () => false },
getBoundingClientRect: () => ({ left: 0, right: 1280, top: 0, bottom: 0, width: 1280, height: 0 }),
appendChild(c) { el.children.push(c); return c },
removeChild() {}, remove() {},
setAttribute() {}, getAttribute: () => null, removeAttribute() {},
addEventListener() {}, removeEventListener() {},
focus() {}, blur() {}, click() {},
querySelector: () => null, querySelectorAll: () => [],
parentElement: null, parentNode: null,
scrollIntoView() {},
getContext: () => ({ globalCompositeOperation: '', createLinearGradient() { return { addColorStop() {} } }, fillRect() {}, getImageData() { return { data: [0, 0, 0, 255] } } }),
}
return el
}
function loadComponent({ stored = {} } = {}) {
const values = new Map([['dsh.worktable.updateCheck.v1', '0']])
for (const [key, value] of Object.entries(stored)) values.set(key, String(value))
const localStorage = {
getItem: (key) => values.has(key) ? values.get(key) : null,
setItem: (key, value) => values.set(key, String(value)),
removeItem: (key) => values.delete(key),
}
const body = fakeElement('body')
const head = fakeElement('head')
const document = {
body, head, documentElement: fakeElement('html'),
querySelector: () => null, querySelectorAll: () => [],
createElement: (tag) => fakeElement(tag),
addEventListener() {}, removeEventListener() {},
}
const window = {
innerWidth: 1280, innerHeight: 900, localStorage, document,
__ModuleLoader__: { load: (definition) => { window.captured = definition } },
addEventListener() {}, removeEventListener() {}, dispatchEvent() {},
matchMedia: () => ({ matches: false, addEventListener() {}, removeEventListener() {} }),
setTimeout: () => 1, clearTimeout() {}, setInterval: () => 1, clearInterval() {},
requestAnimationFrame: () => 1, cancelAnimationFrame() {}, open() {},
}
const hooks = makeHooks()
const jsxRuntime = { Fragment, jsx, jsxs: jsx }
const sandbox = {
window, document, localStorage, self: window,
location: { href: 'http://localhost/', protocol: 'http:' },
navigator: { userAgent: 'node edge regression', platform: 'Win32', language: 'en-US' },
console, atob, btoa,
fetch: async () => ({ ok: false, status: 404, json: async () => ({}) }),
setTimeout: window.setTimeout, clearTimeout: window.clearTimeout,
setInterval: window.setInterval, clearInterval: window.clearInterval,
requestAnimationFrame: window.requestAnimationFrame, cancelAnimationFrame: window.cancelAnimationFrame,
MutationObserver: class { observe() {} disconnect() {} },
ResizeObserver: class { observe() {} unobserve() {} disconnect() {} },
IntersectionObserver: class { observe() {} unobserve() {} disconnect() {} },
CustomEvent: class { constructor(type, init) { this.type = type; this.detail = init?.detail } },
URL, Blob, AbortController, indexedDB: undefined,
}
createContext(sandbox)
runInNewContext(source, sandbox, { filename: BUNDLE, timeout: 20000 })
const requireExternal = (id) => {
if (id === 'react') return hooks.React
if (id === 'react/jsx-runtime') return jsxRuntime
if (id === 'react-dom') return { createPortal: (child) => child }
if (id === 'scheduler') return {}
throw new Error('unexpected external: ' + id)
}
const exports = window.captured.factory(requireExternal)
assert(typeof exports.WorktableSection === 'function', 'no WorktableSection export')
return { component: exports.WorktableSection, hooks, values }
}
function walk(node, pred, out = []) {
if (Array.isArray(node)) { for (const c of node) walk(c, pred, out); return out }
if (!node || typeof node !== 'object') return out
if (typeof node.type !== 'undefined' && pred(node)) out.push(node)
walk(node.props?.children, pred, out)
return out
}
const classHas = (node, name) => String(node.props?.className ?? '').split(/\s+/).includes(name)
const byClass = (tree, name) => walk(tree, (n) => classHas(n, name))
function run() {
// 1) 默认(edgeAutoHide 未设置 = 自动隐藏):停靠态渲染细条,面板默认收起
{
const { component, hooks } = loadComponent()
const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render()
assert(byClass(tree, 'dsh-wt_edgeStrip').length === 1, '未渲染左缘细条')
assert(byClass(tree, 'dsh-wt_anchor' + 'x').length === 0, 'sanity')
assert(byClass(tree, 'dsh-wt_edgeAnchor').length === 1, '未渲染零尺寸锚点')
assert(byClass(tree, 'dsh-wt_edgePanelWrap').length === 1, '未渲染面板包裹层')
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 0, '自动隐藏模式下默认应是收起')
// 细条上有 hover 打开
const strip = byClass(tree, 'dsh-wt_edgeStrip')[0]
assert(typeof strip.props.onMouseEnter === 'function', '细条缺少 hover 打开')
strip.props.onMouseEnter({})
tree = render()
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, 'hover 后应展开')
// 移开 → 调度关闭(定时器在夹具里不执行,验证 handler 存在)
const wrap = byClass(tree, 'dsh-wt_edgePanelWrap')[0]
assert(typeof wrap.props.onMouseLeave === 'function', '面板缺少移开收回')
// 自动隐藏模式不显示 « 手柄
assert(byClass(tree, 'dsh-wt_edgeHandle').length === 0, '自动隐藏模式不应出现收起手柄')
console.log('PASS 1: 默认自动隐藏 — 细条常驻、默认收起、hover 展开、无手柄')
}
// 2) 设置开关存在且可切换
{
const { component, hooks, values } = loadComponent()
const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render()
assert(byClass(tree, 'dsh-wt_edgeSettings').length === 1, '设置里缺少侧边栏控制项')
const toggle = byClass(tree, 'dsh-wt_edgeSettingsToggle')[0]
assert(toggle?.props?.role === 'switch', '开关 role 不是 switch')
assert(toggle.props['aria-checked'] === true, '默认应为开启')
toggle.props.onClick({})
tree = render()
const raw = values.get('dsh.worktable.view.v1')
assert(raw && JSON.parse(raw).edgeAutoHide === false, '切换后未持久化 edgeAutoHide=false')
console.log('PASS 2: 设置开关存在、默认开启、点击持久化为 false')
}
// 3) 固定常开(edgeAutoHide=false):面板常显 + 出现 « 手柄;细条无 hover 展开
{
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ edgeAutoHide: false }) } })
const render = () => hooks.render(component, { wide: true, slotRole: 'overlay', t: (k) => k })
let tree = render()
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 1, '固定常开模式下应直接展开')
assert(byClass(tree, 'dsh-wt_edgeHandle').length === 1, '固定常开模式应出现 « 手柄')
const strip = byClass(tree, 'dsh-wt_edgeStrip')[0]
assert(strip.props.onMouseEnter === undefined, '固定常开模式细条不应 hover 展开')
// 点 « 收起
const handle = byClass(tree, 'dsh-wt_edgeHandle')[0]
handle.props.onClick({})
tree = render()
assert(byClass(tree, 'dsh-wt_edgePanelWrapOn').length === 0, '点 « 后应收起')
console.log('PASS 3: 固定常开 — 常显、有 « 手柄、细条不 hover、点 « 可收起')
}
// 4) 浮动态不受影响
{
const { component, hooks } = loadComponent({ stored: { 'dsh.worktable.view.v1': JSON.stringify({ dock: 'float', floatTop: 100 }) } })
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_edgeStrip').length === 0, '浮动态不应渲染细条')
console.log('PASS 4: 浮动态保持原行为,不渲染细条')
}
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()
+7 -2
View File
@@ -38,14 +38,19 @@ test('Unknown stream protocols are rejected', () => {
})
test('Web update instructions retain the web profile', () => {
const { command, prompt, desktop } = worktableUpgrade('https:')
const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'https:')
assert.equal(desktop, false)
assert.match(command, /--profile web add/)
assert.match(prompt, /重启 dsh web/)
// 命令必须指向「要装的版本」,不能是当前已装版本(否则提示与命令自相矛盾)
assert.match(command, /\/releases\/download\/v0\.5\.3-local\.10\/dsh-worktable\.tgz/)
const older = worktableUpgrade('0.5.3-local.9', 'https:').command
assert.match(older, /v0\.5\.3-local\.9/)
assert.doesNotMatch(older, /v0\.5\.3-local\.10/)
})
test('Desktop update instructions require its bundled CLI and manual restart', () => {
const { command, prompt, desktop } = worktableUpgrade('dsh-app:')
const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'dsh-app:')
assert.equal(desktop, true)
assert.match(command, /--profile desktop add/)
assert.doesNotMatch(command, /--profile web/)
+4 -3
View File
@@ -184,7 +184,7 @@ const click = (node, rect = fakeElement()) => {
async function main() {
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)
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')
@@ -304,7 +304,8 @@ function testConsolePresentation() {
}
async function testUpdatePresentation() {
const releaseUrl = 'https://api.github.com/repos/Aisland-SJL/dsh-worktable/releases/latest'
// 更新源是本仓 Gitea(内部补丁分发仓),不是上游 GitHub
const releaseUrl = '/api/worktable/update-check'
for (const outcome of ['older', 'same', 'forbidden', 'invalid', 'invalid-prefix', 'skip']) {
let response = { status: 200, tag: 'v9.0.0' }
let requests = 0
@@ -315,7 +316,7 @@ async function testUpdatePresentation() {
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')
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()
click(walk(tree, (node) => node.type === 'button' && node.props?.['aria-label'] === 'menu.viewOptions')[0])
tree = render()
+6 -6
View File
@@ -2,7 +2,7 @@
> ## 📦 本仓库是内部补丁分发仓,不是上游源码仓
>
> 上游:<https://github.com/Aisland-SJL/dsh-worktable> | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.5`)。
> 上游:<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)。
### 要不要装
@@ -16,16 +16,16 @@
### 安装
当前版本 **v0.5.3-local.5**:
当前版本 **v0.5.3-local.16**:
```bash
dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.5/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,再执行命令**,装完手动重开;不要在宿主运行时安装。
- `--profile web` 按你自己的 profile 名字改。
- 资产 `dsh-worktable.tgz`,485007 字节,sha256:
`cf633ad71d175a7125d4d49da1732515f32e6d02dc8ae4b7786379e8f712a31d`
- 资产 `dsh-worktable.tgz`,489153 字节,sha256:
`fd6af73a7e6c4620b86b021c480c63cca0e0dc4b397b7ee482d20a8dde07c9e8`
(下载后可 `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.5` 后,插件不会提示升级到 0.5.1。
- 装上 `0.5.3-local.14` 后,插件不会提示升级到 0.5.1。
- 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。
- 回退官方版:
```bash