dsh-sidebar-suite 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,17 +1,30 @@
1
1
  # 更新日志 / Changelog
2
2
 
3
- > 版本号以 npm registry **实际发布记录**为准(当前:`0.0.0-stage`、`0.1.3`、`0.2.4`、`0.2.5`、`0.2.6`、`0.2.7`、`0.2.8`、`0.2.9`、`0.3.0`、`0.4.0`)。
4
- > ⚠️ **`0.3.0` 已弃用 / deprecated**:它会让 DSH 卡在 `Loading plugins…` 且主窗口不显示(见 0.4.0 章节第一条)。请升级到 `0.4.0` 或更高版本。`0.3.0` hangs DSH on the loading screen; upgrade to 0.4.0 or later.
3
+ > 版本号以 npm registry **实际发布记录**为准(当前:`0.0.0-stage`、`0.1.3`、`0.2.4`、`0.2.5`、`0.2.6`、`0.2.7`、`0.2.8`、`0.2.9`、`0.3.0`、`0.4.0`、`0.4.1`)。
4
+ > ⚠️ **`0.3.0` 已弃用 / deprecated**:它会让 DSH 卡在 `Loading plugins…` 且主窗口不显示(见 0.4.0 章节「修复启动死循环」)。请升级到 `0.4.1` 或更高版本。`0.3.0` hangs DSH on the loading screen; upgrade to 0.4.1 or later.
5
5
  > `0.2.0`、`0.2.1`、`0.2.2`、`0.2.3` 是开发过程中的本地迭代号,**从未单独发布**;它们的功能一次性随 `0.2.4` 上线,所以在下面合并记录。
6
6
  >
7
7
  > Versions mirror the npm registry. `0.2.0`–`0.2.3` were local iteration numbers that were never published on their own; all of their features shipped together in `0.2.4`.
8
8
 
9
9
  ---
10
10
 
11
+ ## 0.4.1 — 适配 DSH 0.2.2-rc.2 的网格侧栏 / Fit the rc.2 grid sidebar(2026-11-12)
12
+
13
+ **这次改了客户端样式表(`lib/client.js`)**,所以**升级后要托盘退出 DSH 再重开一次**;刷新 / 热重载不算。This release changes the injected stylesheet; quit DSH from the tray and reopen once after upgrading.
14
+
15
+ > ⚠️ **npm 上的 `0.4.0` 不含这个修复。** 如果你在 DSH `0.2.2-rc.2` 上看到布局按钮压住「工作区」标题,请升级到 `0.4.1`。The published 0.4.0 does not contain this fix; upgrade to 0.4.1 if the layout buttons overlap the "Workspaces" heading on DSH 0.2.2-rc.2.
16
+
17
+ - **修正下面 0.4.0 章节里「rc.2 运行时零改动」的结论**:DOM 契约(类名、`data-slot`、节点顺序)确实没变,但**布局容器变了** —— rc.2 把 `div.wtg9ga_scrollArea` 从纵向 flex 改成了 CSS Grid(真机实测列宽 `4px 264px 6px`),并把宿主的面板显式钉在第 2 列。当时只验了节点是否注入,没验几何,所以漏掉了这一层。The class names were unchanged, but the host switched its sidebar root from a flex column to a grid.
18
+ - **修复控制栏压住「工作区」标题** — 插件注入的控制栏 / 页签条 / 插件面板用默认 `grid-column:auto` 落进只有 4px 宽的第 1 列,按钮溢出后盖到宿主「工作区」标题上,右侧还留下一条孤零零的竖分隔线。现在三者统一 `grid-column:1/-1` 独占整行,并把 grid 的 4px / 6px 装饰列还原成左右内边距,与宿主「新会话」按钮对齐。`grid-column` 在旧版 flex 侧栏里是惰性属性,老宿主不受影响。Spanning every column gives each injected header its own full-width row; the property is inert on older flex roots.
19
+ - **验证** — CDP 真机 14 项验收全通过:控制栏从 4px 恢复到 274px、`scrollWidth === clientWidth`、布局按钮与「工作区」标题的重叠面积为 0、注册第三方 tab 后页签条与面板都是全宽、dispose 后无残留、root 子节点顺序不变。`tests/test_034.mjs` 扩为 20 项,新增源码与运行时样式表断言,防止以后有人删掉这条规则。全套测试与 `npm run check` 全绿。
20
+
21
+ ---
22
+
11
23
  ## 0.4.0 — 临时会话可以「转正」或「立即删除」/ Promote or delete a temp session(2026-11-11)
12
24
 
13
25
  **这次改了运行时代码**(`lib/client.js` 与宿主半 `lib/temp-session-host.mjs`),所以**升级后要托盘退出 DSH 再重开一次**。This release touches both halves; quit DSH from the tray and reopen once after upgrading.
14
26
 
27
+ - **发布后兼容性复核(2026-11-12,运行时零改动)** — DSH 升级到 `0.2.2-rc.2` 后,用 CDP 连真机复核:`sidebarSuite` 服务正常发布(`0.4.0`)、`[data-slot="sidebar.workspaces"]` 与 `nav.wtg9ga_panelList` 仍能解析出 `div.wtg9ga_scrollArea`、控制栏 / 页签条 /「临时」按钮全部注入、第三方 tab 可注册并懒挂载、订阅通知正常、`/api/dsh-temp-session.status` 返回 200 且 9 项配置齐全、root 子节点顺序多次采样不变。**新版 DSH 没有改这些半稳定约定,因此不需要改客户端代码。** 新增 `tests/test_034.mjs`(15 项)把宿主 DOM 契约固化下来,`tests/dom-stub.mjs` 的假侧栏改用 rc.2 实测类名,`npm test` 扩为 12 套。Post-release verification on DSH 0.2.2-rc.2: the host markup contract is unchanged, no runtime fix was needed, and a new regression suite now pins it.
15
28
  - **⛔ 修复启动死循环(严重,0.3.0 起就有)** — 0.3.0 的页签条插在控制栏与宿主「扩展」面板之间,但 `ensureBar()` 仍要求控制栏的 `nextSibling` 就是那个面板,于是每次 `paint()` 把控制栏搬一次、`ensureTabStrip()` 又搬回来;root 的 childList 变化触发插件自己的 `MutationObserver` → `scheduleSync()` → `paint()`,微任务队列永不排空。表现是**渲染进程 100%、主窗口隐藏、停在 `Loading plugins…`,整个 DSH 打不开**。修复后位置判断改成「顺序在前」而不是「紧邻」,`ensureTabStrip()` 同理;并加了一道「同一宏任务内最多 16 次 sync」的熔断,将来任何重绘自激也不会再把应用锁死。三种布局、以及插件页签接管侧栏的场景都做了真机验收(窗口正常、CDP 秒回、root 子节点顺序 4 次采样不变、8 秒内各进程 CPU 增量 ≤ 0.17s)。**`0.3.0` 已在 npm 标记弃用,请升级到 0.4.0。** The 0.3.0 tab strip sat between the control bar and the panels nav while `ensureBar()` still demanded adjacency, so every repaint moved the bar and fired the plugin's own observer — an endless microtask loop that hid the window on "Loading plugins…". Position checks now compare order instead of adjacency, plus a per-macrotask sync cap. The published 0.3.0 is affected and has been deprecated on npm.
16
29
  - **测试** — 新增 `tests/test_033.mjs`(13 项):让 DOM 桩真的把 `MutationObserver` 回调投递回来,一次普通的宿主 DOM 变化就会复现自激。修复前 6 项失败(撞上 200 次变更上限,三种布局全部中招),修复后每次重绘 0 次 root 变更、节点顺序不变。`npm test` 链扩为 11 套。A new suite delivers observer callbacks the way a browser does; the old code spins past a 200-mutation cap, the fixed code settles on zero mutations.
17
30
  - **右键临时会话行,弹出「保留为正式会话 / 立即删除」** — 之前临时会话是「要么全删,要么全留」:想留下某一个,只能去把 `DELETE_ON_EXIT` 关掉,结果**所有**临时会话都变成永久。现在单个会话可以就地处理。Right-clicking a temporary row now offers both options, so one session no longer forces a global setting.
package/DETAIL.md CHANGED
@@ -126,8 +126,8 @@ export function apply(ctx) {
126
126
  dsh plugin --profile desktop add dsh-sidebar-suite
127
127
  ```
128
128
 
129
- 本地开发可把包名换成本目录路径或 `.tgz` 安装包。已在 **DSH 0.2.2-rc.1(desktop profile)** 验证。
130
- For local development, point the same command at this folder or a packed `.tgz`. Tested on **DSH 0.2.2-rc.1 (desktop profile)**.
129
+ 本地开发可把包名换成本目录路径或 `.tgz` 安装包。已在 **DSH 0.2.2-rc.2(desktop profile)** 真机验证;`0.2.2-rc.1` 同样兼容但已过时。
130
+ For local development, point the same command at this folder or a packed `.tgz`. Tested on **DSH 0.2.2-rc.2 (desktop profile)**; 0.2.2-rc.1 still works but is superseded.
131
131
 
132
132
  **升级插件包后仍需重启 / Upgrading the plugin package still needs a restart** — 安装新版或改 `lib/` 下的代码后,请完全退出并重新打开 DSH(客户端代码不热重载)。**但改配置不用重启**:0.2.8 起 `temp-session-config.txt` 的改动、以及详情页的任何开关,都在约 3 秒内原地生效。 / Config edits are the exception: from 0.2.8 they hot-reload in place within seconds.
133
133
 
@@ -136,7 +136,8 @@ For local development, point the same command at this folder or a packed `.tgz`.
136
136
 
137
137
  ## 已知限制 / Known limits
138
138
 
139
- - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是宿主的半稳定约定;若宿主改版,插件会退化成「有控制栏但无效果」而不是抛错。These host markup contracts are semi-stable; a host change degrades gracefully instead of throwing.
139
+ - `[data-slot="sidebar.workspaces"]` 与 `panelList` 是宿主的半稳定约定;若宿主改版,插件会退化成「有控制栏但无效果」而不是抛错。**0.2.2-rc.2 实测**:根节点 `wtg9ga_scrollArea`、扩展面板 `nav.wtg9ga_panelList`、工作区容器 `wtg9ga_regionArea` —— CSS-module 哈希前缀 `wtg9ga_` 会在 DSH 重新构建时变,插件只匹配 `panelList` 这个语义后缀与上面那个 `data-slot`,从不硬编码完整类名;`tests/test_034.mjs` 会验证换哈希、纯哈希类名、以及缺少 workspaces 插槽时的行为。These host markup contracts are semi-stable; a host change degrades gracefully instead of throwing. On 0.2.2-rc.2 the real classes are `wtg9ga_scrollArea` / `nav.wtg9ga_panelList` / `wtg9ga_regionArea`; only the semantic suffix and the slot are matched, never the generated prefix.
140
+ - **侧栏根节点可能是 flex,也可能是 grid(0.4.1)** — 0.2.2-rc.2 把 `wtg9ga_scrollArea` 从纵向 flex 改成三列 CSS Grid(`4px 264px 6px`),宿主的面板被显式钉在第 2 列。插件注入的控制栏 / 页签条 / 插件面板不声明 `grid-column`,就会默认落进只有 4px 宽的第 1 列,按钮溢出后盖住「工作区」标题。适配方式是三者统一 `grid-column:1/-1` 独占整行,再用 `padding-left:4px` / `padding-right:6px` 把装饰列还原成内边距、与宿主「新会话」左对齐 —— **不改宿主节点、不依赖生成类名、不做宿主版本嗅探**;`grid-column` 在旧 flex 根上是惰性属性,所以同一份样式两代宿主都能用。The host root may be a flex column (rc.1) or a three-column grid (rc.2); one spanning rule covers both without version sniffing, and the property is inert on older roots.
140
141
  - 浮层定位依赖 `:has()`,需要 Chromium 内核(DSH 桌面端即是)。Overlay positioning uses `:has()`, so it needs a Chromium-based client.
141
142
  - 标签页模式会整块隐藏工作区区域,里面的其它入口也一并隐藏 —— 这是「一组一栏」的刻意设计。Toggle mode hides the whole workspaces region, including anything else the host renders inside it.
142
143
 
@@ -147,7 +148,7 @@ For local development, point the same command at this folder or a packed `.tgz`.
147
148
 
148
149
  「临时」按钮创建的**是一个真正的 DSH 会话**,因此:在左侧栏可见、用原生会话窗口、继承当前模型和工具链、可以随意切换任务;只有「退出即删除」这一点是插件加的。
149
150
 
150
- 实现路径(全部在 `app.asar` 0.2.2-rc.1 上核实):
151
+ 实现路径(在 `app.asar` 0.2.2-rc.1 上核实,2026-11-12 在 0.2.2-rc.2 真机上复核,调用链无变化):
151
152
 
152
153
  - **创建**:Client 半调用 `ctx.get('uiWorkspace').createNamed({ workspaceId })` 再 `openSession(id)` —— 与宿主「新会话」按钮同一条链路(`dsh-client-ui-workspace` 的 `createInWorkspace` → `sessions.create` → `session/create`)。不传 `sessionId`,所以不会复用你已有的空白会话。
153
154
  - **标记**:把会话 id POST 给 Host 半,写进 `~/.dsh/dsh-sidebar-suite/temp-sessions.json`;侧栏行按 `data-row-key="session:<id>"` 打 `data-dsbs-temp-row` 属性,用 CSS `::after` 画「临时」标签(只加属性、不加节点,React 重渲染不会弄丢)。
package/README.md CHANGED
@@ -173,7 +173,8 @@ For local development, point the same command at this folder or a packed `.tgz`
173
173
  **离线安装包 / Offline archives**:[GitHub Releases](https://github.com/YONAN1269/dsh-sidebar-suite/releases) 的每个版本都附一个 `.zip` 源码包和一个 `.tgz` npm 安装包。把 `.tgz` 下到本机后执行 `dsh plugin --profile desktop add <本地 .tgz 的完整路径>` 就能离线安装;Release 页面会显示每个附件真实的下载次数。
174
174
  Every release ships a `.zip` source archive and an npm `.tgz`; point the install command at the downloaded `.tgz` for an offline install. GitHub counts downloads of these attached files.
175
175
 
176
- **已在 DSH 0.2.2-rc.1(desktop profile)验证 / Tested on DSH 0.2.2-rc.1 (desktop profile).**
176
+ **已在 DSH 0.2.2-rc.2(desktop profile)真机验证 / Tested on DSH 0.2.2-rc.2 (desktop profile).**
177
+ 2026-11-12 用 CDP 连上真机复核:服务发布、`[data-slot="sidebar.workspaces"]` 与 `nav.wtg9ga_panelList` 解析、控制栏 / 页签条 /「临时」按钮注入、第三方 tab 注册与懒挂载、Host 配置路由返回 200、root 子节点顺序稳定 —— **DOM 契约未变**。但 rc.2 把侧栏根节点从纵向 flex 换成了 CSS Grid(列宽 `4px 264px 6px`),只验节点是否注入、不验几何就会漏掉布局重叠:**0.4.1 已让注入的控制栏 / 页签条 / 插件面板 `grid-column:1/-1` 独占整行**。`0.2.2-rc.1` 也兼容(该属性在旧 flex 根上是惰性的),但已是旧版本。Verified against a live 0.2.2-rc.2 renderer: the markup contract is unchanged, but the host switched its sidebar root to CSS Grid, which 0.4.1 now spans correctly. The property is inert on the older flex root, so 0.2.2-rc.1 remains compatible but is superseded.
177
178
  本包刻意不声明 `engines.dsh`:当前 DSH 是预发布版,semver 默认规则会把常规版本范围误判为不兼容。
178
179
  This bundle deliberately omits `engines.dsh`: DSH is currently a prerelease, and semver's default rules would reject any ordinary range.
179
180
 
package/lib/client.js CHANGED
@@ -21,7 +21,7 @@ window.__ModuleLoader__.load({
21
21
  var ENTRY = 'dsh-sidebar-suite'
22
22
  // Reported to tab consumers so they can feature-detect. Kept in lockstep
23
23
  // with package.json by tests/test_030.mjs.
24
- var VERSION = '0.4.0'
24
+ var VERSION = '0.4.1'
25
25
  var NS = 'sidebar-suite'
26
26
  var LS_KEY = 'dsh-sidebar-suite:state'
27
27
  // Where the third-party tab choice lives. Kept out of LS_KEY on purpose:
@@ -432,6 +432,19 @@ window.__ModuleLoader__.load({
432
432
  'html[data-dsbs-narrow="true"] [data-dsbs-tabs] button[data-dsbs-hasicon] [data-dsbs-tabbadge]{display:none}',
433
433
  'html[data-dsbs-rail="true"] [data-dsbs-tabs]{padding:2px 2px 0}',
434
434
  'html[data-dsbs-rail="true"] [data-dsbs-tabs] button{max-width:40px;padding:4px 5px}',
435
+
436
+ // ---- grid-based sidebar roots (DSH 0.2.2-rc.2) --------------------
437
+ // rc.2 turns the sidebar scroll area into a CSS grid with explicit
438
+ // columns (sampled on a real renderer: "4px 264px 6px") and pins the
439
+ // host's panels nav and region to column 2. Any child we inject with
440
+ // the default `grid-column:auto` lands in that 4px first column: the
441
+ // control bar becomes 4px wide while its buttons still need ~99px, so
442
+ // they overflow on top of the host's "工作区" heading. Spanning every
443
+ // column gives each injected header its own full-width row. On older
444
+ // flex-column roots `grid-column` is inert, so both host layouts work.
445
+ // The 4px/6px padding gives those two decorative grid columns back, so
446
+ // the header lines up with the host's New Session button and groups.
447
+ '[data-dsbs-bar],[data-dsbs-tabs],[data-dsbs-tabpanel]{grid-column:1/-1;min-width:0;max-width:100%;box-sizing:border-box;padding-left:4px;padding-right:6px}',
435
448
  ].join('\n')
436
449
 
437
450
  function assign(target) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-sidebar-suite",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "license": "MIT",
5
5
  "author": "Yonan",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "type": "module",
29
29
  "scripts": {
30
- "test": "node tests/test_020.mjs && node tests/test_022.mjs && node tests/test_023.mjs && node tests/test_024.mjs && node tests/test_025.mjs && node tests/test_028.mjs && node tests/test_029.mjs && node tests/test_030.mjs && node tests/test_031.mjs && node tests/test_032.mjs && node tests/test_033.mjs",
30
+ "test": "node tests/test_020.mjs && node tests/test_022.mjs && node tests/test_023.mjs && node tests/test_024.mjs && node tests/test_025.mjs && node tests/test_028.mjs && node tests/test_029.mjs && node tests/test_030.mjs && node tests/test_031.mjs && node tests/test_032.mjs && node tests/test_033.mjs && node tests/test_034.mjs",
31
31
  "check": "node --check lib/index.js && node --check lib/client.js && node --check lib/temp-session-host.mjs && npm pack --dry-run"
32
32
  },
33
33
  "main": "lib/index.js",
@@ -1,6 +1,8 @@
1
1
  # dsh-sidebar-suite 使用说明
2
2
 
3
- **适用版本:v0.2.8**(最后更新 2026-11-11)
3
+ **适用插件版本:v0.4.1**(最后更新 2026-11-12)
4
+
5
+ **已验证的 DSH:0.2.2-rc.2(当前最新)**;`0.2.2-rc.1` 也兼容,但已是旧版本。DSH 从 rc.2 起把侧栏根节点换成了 CSS Grid,**v0.4.1 已做好样式适配**;如果你在 rc.2 上还用着 v0.4.0,会看到布局按钮压住「工作区」标题 —— 升级到 v0.4.1 并从托盘彻底退出 DSH 再打开一次即可。
4
6
 
5
7
  **这是一款专门针对改进 DSH 左侧栏体验的插件** —— 只管左侧栏,不碰会话内容、不换模型;设计上既要「强实用性」(少点几下、少滚几屏),也要「美观性」(沿用 DSH 原生观感,不另起一套皮肤)。
6
8