release: merge dev for v0.30.1 (settings nav icon via the shell's icon slot)
This commit is contained in:
commit
0b6293f051
14 files changed
+105
-309
No files matched your search
@@ -2,6 +2,11 @@
|
||||
|
||||
> 本文档收录 dsh-better-sidebar 的完整发布历史(最新版摘要见 [README](README_ZH.md);同步发布于 [GitHub Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases))。
|
||||
|
||||
### v0.30.1
|
||||
|
||||
- 🎯 **设置页「侧边卡片」的导航图标不再叠成两个**:插件此前按"宿主设置导航还没有图标通道"的老假设,用 CSS 把兜底齿轮藏起来、再画自己的图标;宿主早已提供按 section id 寻址的 `settings.section.icon` 插槽,而且图标的 DOM 外面多了一层 span,老选择器失效后兜底 SVG 露了出来,与插件图标并排显示。现在改为**走宿主插槽**提供图标,删掉标记 + CSS 遮罩那一套(顺带去掉了一个监听整个 document 的 MutationObserver)。
|
||||
- 🧪 测试:`tests/settings-nav-icon.spec.tsx` 钉住图标按宿主给的 `size` 缩放、只用 `currentColor`;真实宿主上用无头浏览器确认导航行只剩一个 `svg`、无残留标记。
|
||||
|
||||
### v0.30.0
|
||||
|
||||
- 🧭 **适配 DSH 0.2.2-rc.1(本版 peer 下限抬到 `^0.2.2-rc.1`)**:宿主把模型选择从可安装的 `ModelSelectionRef` 换成 agent 自有的 `AgentModel`——`agent.model.select()` 同时落盘并作用于下一步,侧边对话的线程模型选择随之改写(不再自己 install 一份 ref);`dsh-tools` 移除了 PTC(`tool/ptc-dispatch*`)的事件**类型声明**(运行期仍记录),宿主图标由内联 `<path>` 改为 sprite `<use href="#dsw-icon-…">`。**支持线随之移动**:0.x 的 caret 不跨 minor,因此 DSH 0.2.1 线(`0.2.1-rc.1 ~ rc.5`,即当前的宿主 npm `latest`)请继续固定插件 **v0.28.2**(`v0.29.0` 从未发布到 npm),0.2.2-rc.1+ 请用 **v0.30.0**。
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
>
|
||||
> 📝 The Chinese [CHANGELOG](./CHANGELOG.md) is the authoritative, item-by-item record; this file carries the English summaries and has historically lagged behind it. Where the two disagree, the Chinese one is current.
|
||||
|
||||
### v0.30.1
|
||||
|
||||
- 🎯 **The "Side card" settings row no longer shows two icons**: the plugin still assumed the settings navigation had no icon channel, so it hid the fallback gear with CSS and painted its own glyph. The shell has long since exposed a `settings.section.icon` slot addressed by section id, and it now wraps the nav icon in a span — the stale `> svg:first-child` rule stopped hiding the fallback, so both glyphs rendered side by side. The row now contributes its icon **through the slot**, and the marker + CSS-mask apparatus is gone (along with a document-wide MutationObserver).
|
||||
- 🧪 `tests/settings-nav-icon.spec.tsx` pins the glyph to the slot-provided `size` and `currentColor`; a headless pass against a real host confirms one `svg` in the row and no leftover marker.
|
||||
|
||||
### v0.30.0
|
||||
|
||||
- 🧭 **Adapted to DSH 0.2.2-rc.1 (peer floors move to `^0.2.2-rc.1`)**: the host replaced the installable `ModelSelectionRef` with an agent-owned `AgentModel` — `agent.model.select()` records the choice durably and applies it to the next step, so the side-chat thread model selection rides the agent's own handle instead of an installed ref. `dsh-tools` dropped the PTC (`tool/ptc-dispatch*`) event **type declarations** (the runtime still records them), and host icons switched from inline `<path>` to sprite `<use href="#dsw-icon-…">`. **The support line moves with it**: a 0.x caret never spans a minor, so DSH 0.2.1 hosts (`0.2.1-rc.1 ~ rc.5`, today's npm `latest`) keep pinning plugin **v0.28.2** (`v0.29.0` was never published), while 0.2.2-rc.1+ takes **v0.30.0**.
|
||||
|
||||
@@ -51,7 +51,7 @@ Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R). Requires DSH **0.2.2-rc.1+
|
||||
|
||||
| Your DSH version | Install command |
|
||||
| --- | --- |
|
||||
| **0.2.2-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.30.0` |
|
||||
| **0.2.2-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.30.1` |
|
||||
| **0.2.1-rc.1 ~ 0.2.1-rc.5** | `dsh plugin --profile web add dsh-better-sidebar@0.28.2` |
|
||||
| **0.2.1-alpha.5** | `dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0` |
|
||||
| **0.2.0-rc.2** | `dsh plugin --profile web add dsh-better-sidebar@0.26.1` |
|
||||
@@ -71,12 +71,12 @@ Always pin **exact versions** for older releases (`latest` moves forward with ea
|
||||
|
||||
```text
|
||||
Install the dsh-better-sidebar plugin (a sidebar workbench for DSH):
|
||||
1. Confirm DSH is 0.2.2-rc.1 or newer, then run dsh plugin --profile web add dsh-better-sidebar@0.30.0
|
||||
1. Confirm DSH is 0.2.2-rc.1 or newer, then run dsh plugin --profile web add dsh-better-sidebar@0.30.1
|
||||
2. Remind me to hard-refresh the browser (Cmd/Ctrl+Shift+R) afterwards
|
||||
If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-better-sidebar README first.
|
||||
```
|
||||
|
||||
**One-line script** — clone this repo and run `bash scripts/install.sh 0.30.0` (macOS / Linux / Windows Git Bash; `./scripts/install.ps1 -Version 0.30.0` for native Windows). It handles installation + bundle registration.
|
||||
**One-line script** — clone this repo and run `bash scripts/install.sh 0.30.1` (macOS / Linux / Windows Git Bash; `./scripts/install.ps1 -Version 0.30.1` for native Windows). It handles installation + bundle registration.
|
||||
|
||||
**Updating**: just re-run the install command, then hard-refresh the browser.
|
||||
|
||||
@@ -94,12 +94,16 @@ If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-bett
|
||||
| **Two sidebars** on the page | Double mounting. Remove the legacy manual mount line (`- insert: ... better-sidebar ...`) from `~/.dsh/profiles/web/cordis.patch.yml`; aggregate packages mounting this package under a different id are auto-yielded, no action needed. |
|
||||
| Settings values gone after upgrade | Since DSH 0.1.7, preferences live on this plugin's mount row in the profile (default entry id `better-sidebar`). The plugin migrates your old `settings.yaml` values once on first start and never overwrites newer values. |
|
||||
| Terminal unavailable | Terminals are provided by **DSH itself** (this plugin ships no PTY) — see DSH docs; "host provides no terminal capability" in the bottom terminal means this deployment has no terminal controller mounted. |
|
||||
| `dsh: command not found` | Install DSH first; or use `npx -y --package @deepseek-ai/dsh@0.2.2-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.30.0`. |
|
||||
| `dsh: command not found` | Install DSH first; or use `npx -y --package @deepseek-ai/dsh@0.2.2-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.30.1`. |
|
||||
|
||||
</details>
|
||||
|
||||
## 🆕 Recent Updates
|
||||
|
||||
**v0.30.1 — settings nav icon fix**
|
||||
|
||||
- **The "Side card" row in Settings no longer shows two icons.** The plugin used to paint its own glyph over the shell's fallback gear with a CSS mask; the shell now wraps the nav icon in a container and exposes a per-section icon slot. The row contributes its icon through that slot, and the stale marker + CSS apparatus is gone — along with a document-wide DOM observer.
|
||||
|
||||
**v0.30.0 — DSH 0.2.2 support, side-chat images, clickable quote chips**
|
||||
|
||||
- **DSH 0.2.2-rc.1 is the new baseline** (all 14 peer floors move to `^0.2.2-rc.1`). The host replaced the installable model-selection ref with an agent-owned `AgentModel`, so a side-chat thread's model switch now goes through `agent.model.select()` — recorded once in the log and applied to the next step. A 0.x caret never spans a minor: DSH 0.2.1 hosts (today's npm `latest`) keep pinning plugin v0.28.2.
|
||||
@@ -114,23 +118,6 @@ If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-bett
|
||||
- Uninstalled consumers, streaming replies and unsupported fences retain the existing Markdown view. The 0.28.2 cold-session read fix remains included.
|
||||
- Provider contribution: [@sunxiuguo](https://github.com/sunxiuguo), [#1033](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1033).
|
||||
|
||||
**v0.28.2 — large-session cold-read fix**
|
||||
|
||||
- **Root cause fixed**: a detached session's cwd no longer decodes the whole session log — it reads the workspace address stored in the header (first zstd frame only, header-only), memoized per session with in-flight sharing; `activeWorktreeRootOf` no longer folds the stored log for a detached session
|
||||
- **Why 0.28.1 missed it**: the single-flight only covered `/sidebar/api`, while the real startup fan-out is one fs-watch frame per watched directory and one cwd resolution per `/sidebar/file|html` resource — a 39 MB session was still fully decoded dozens of times in parallel
|
||||
- **Behavior**: an attached session still follows `working_directory` and linked worktrees; before attach the sidebar roots at the original project and the next 5 s poll switches back
|
||||
- **Measured (40.2 MB session, local)**: 12 routes + 36 bypass-entry calls concurrently → 1 header read, 0 full reads, 3 ms, +0.3 MB RSS; pre-fix, 6 bypass calls were 6 full reads with a +1.0 GB peak (≈6 GB extrapolated for 36)
|
||||
|
||||
**v0.28.1 — UX and reliability patch**
|
||||
|
||||
- **OOM fix**: cold cwd reads shared by the twelve `/sidebar/*` routes are merged per session and client hint, so a session-switch burst no longer decodes the same large session log N times in parallel
|
||||
- **Silent wrong-file writes are gone**: tab reconciliation now covers tabs in background sessions, and worktree sessions use one address base — a renamed/deleted file is no longer re-created on the next save, and a chat link never opens a same-named file from another checkout
|
||||
- **Host crash guard**: pathological `git status` output is capped with a latch and a process-tree kill, turning "host dies with `RangeError`" into one failed SCM refresh
|
||||
- **Git page**: histories with more than 1,000 branches load again; tags now decorate commits, rows and details, and tag changes invalidate pagination
|
||||
- **Editor**: saving after an mtime-only change no longer deadlocks on `fs-conflict`; the reading position survives tab re-seating; “Add to conversation” lands as a compact reference chip and never flattens earlier chips — and a selected passage now becomes a *clickable* quote chip that jumps back to the source file and flashes the quoted lines ([#888](https://github.com/omdsh-dev/DSH-better-sidebar/issues/888))
|
||||
- **Markdown links**: local destinations normalize Windows backslashes, so `C:\ws\_analysis\report.md` opens instead of a bare ENOENT
|
||||
- **Sidebar**: the bottom-workbench toggle stays visible while the right panel is open; the macOS dock fallback avoids the traffic lights; a content-stable tab scope ends needless full-file re-reads; closing a side-chat tab archives its session
|
||||
|
||||
## 🔌 Plugin Ecosystem
|
||||
|
||||
`ctx.betterSidebar` offers two extension points to every plugin — `registerTab` / `registerFileViewer`; the built-in 6 tabs + 4 viewers use the very same API. The GitHub topic [`dsh-better-sidebar`](https://github.com/topics/dsh-better-sidebar) already lists **30+ ecosystem plugins**; the full integration guide is at **[docs/external-plugin-guide.md](./docs/external-plugin-guide.md)**.
|
||||
|
||||
+8
-21
@@ -51,7 +51,7 @@ dsh plugin --profile web add dsh-better-sidebar@latest
|
||||
|
||||
| 你的 DSH 版本 | 安装命令 |
|
||||
| --- | --- |
|
||||
| **0.2.2-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.30.0` |
|
||||
| **0.2.2-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.30.1` |
|
||||
| **0.2.1-rc.1 ~ 0.2.1-rc.5** | `dsh plugin --profile web add dsh-better-sidebar@0.28.2` |
|
||||
| **0.2.1-alpha.5** | `dsh plugin --profile web add dsh-better-sidebar@0.28.0-alpha.0` |
|
||||
| **0.2.0-rc.2** | `dsh plugin --profile web add dsh-better-sidebar@0.26.1` |
|
||||
@@ -71,12 +71,12 @@ dsh plugin --profile web add dsh-better-sidebar@latest
|
||||
|
||||
```text
|
||||
帮我安装 dsh-better-sidebar 插件(DSH 侧边栏工作台),步骤:
|
||||
1. 先确认 DSH 为 0.2.2-rc.1 或更新版本,再执行 dsh plugin --profile web add dsh-better-sidebar@0.30.0
|
||||
1. 先确认 DSH 为 0.2.2-rc.1 或更新版本,再执行 dsh plugin --profile web add dsh-better-sidebar@0.30.1
|
||||
2. 完成后提醒我硬刷新浏览器(Cmd/Ctrl+Shift+R)
|
||||
遇到报错先查 https://github.com/omdsh-dev/DSH-better-sidebar README 的常见问题表。
|
||||
```
|
||||
|
||||
**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh 0.30.0`(macOS / Linux / Windows Git Bash;Windows 原生用 `./scripts/install.ps1 -Version 0.30.0`),自动完成安装 + bundle 注册。
|
||||
**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh 0.30.1`(macOS / Linux / Windows Git Bash;Windows 原生用 `./scripts/install.ps1 -Version 0.30.1`),自动完成安装 + bundle 注册。
|
||||
|
||||
**更新**:重跑一次安装命令即可,然后硬刷新浏览器。
|
||||
|
||||
@@ -94,12 +94,16 @@ dsh plugin --profile web add dsh-better-sidebar@latest
|
||||
| 页面出现**两个侧边栏** | 双挂载。删掉 `~/.dsh/profiles/web/cordis.patch.yml` 里旧的手动挂载行(`- insert: ... better-sidebar ...`);聚合包以不同 id 挂载本包时会自动退让,无需处理。 |
|
||||
| 升级后设置页的值去哪了 | DSH 0.1.7 起偏好写在 profile 里本插件的挂载行上(默认 entry id `better-sidebar`),插件首次启动会把旧 `settings.yaml` 里的配置一次性回迁,不会覆盖新设的值。 |
|
||||
| 终端无法使用 | 终端由 **DSH 自身**提供(本插件不自带 PTY),请查 DSH 侧文档;底部终端显示「宿主未提供终端能力」= 这个部署没挂终端控制器。 |
|
||||
| 提示 `dsh: command not found` | 先安装 DSH;或用 `npx -y --package @deepseek-ai/dsh@0.2.2-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.30.0`。 |
|
||||
| 提示 `dsh: command not found` | 先安装 DSH;或用 `npx -y --package @deepseek-ai/dsh@0.2.2-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.30.1`。 |
|
||||
|
||||
</details>
|
||||
|
||||
## 🆕 最近更新
|
||||
|
||||
**v0.30.1 — 设置导航图标修复**
|
||||
|
||||
- **设置页「侧边卡片」那一行不再显示两个图标**:插件此前用 CSS 遮罩盖住宿主的兜底齿轮、再画自己的图标;宿主的导航图标外层多了容器,同时也提供了按 section 挂图标的口子。现在图标走宿主插槽,标记 + 遮罩那一套整体删除(顺带去掉了一个全局 DOM 观察器)。
|
||||
|
||||
**v0.30.0 — 支持 DSH 0.2.2、侧边对话可发图、引用 chip 可点击**
|
||||
|
||||
- **基线抬到 DSH 0.2.2-rc.1**(14 条 peer 下限全部前移到 `^0.2.2-rc.1`)。宿主把可安装的模型选择 ref 换成了 agent 自有的 `AgentModel`,侧边对话的模型切换改走 `agent.model.select()`——只落盘一次,并作用于下一步。0.x 的 caret 不跨 minor:DSH 0.2.1 线(也就是今天的 npm `latest`)继续固定插件 v0.28.2。
|
||||
@@ -114,23 +118,6 @@ dsh plugin --profile web add dsh-better-sidebar@latest
|
||||
- 未安装消费插件、流式回复及不支持的围栏继续显示原 Markdown;保留 0.28.2 的冷会话读取修复。
|
||||
- 配套实现由 [@sunxiuguo](https://github.com/sunxiuguo) 贡献,见 [#1033](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1033)。
|
||||
|
||||
**v0.28.2 — 大会话冷读修复**
|
||||
|
||||
- **根因修复**:detached 会话的 cwd 不再解码整份会话日志——改读存储在 header 里的工作区地址(只读第一个 zstd 帧,header-only),按会话做进程内缓存与在飞去重;`activeWorktreeRootOf` 对 detached 会话不再折持久化日志
|
||||
- **为什么 0.28.1 没修好**:单飞只覆盖 `/sidebar/api`,而启动期真正并发的是 fs-watch 每个监视目录一帧、`/sidebar/file|html` 每资源一次——39 MB 级会话仍被并发整读数十次
|
||||
- **行为**:会话 attach 后仍跟随 `working_directory` 与 linked worktree;attach 之前侧边栏根是原始项目目录,下一次 5 s 轮询自动切回
|
||||
- **实测(40.2 MB 会话,本机)**:12 路由 + 36 个绕过入口并发 → 1 次 header 读、0 次整读、3 ms、RSS +0.3 MB;修复前 6 个入口并发即 6 次整读、峰值 +1.0 GB(外推 36 次 ≈ 6 GB)
|
||||
|
||||
**v0.28.1 — UX 与可靠性补丁**
|
||||
|
||||
- **OOM 修复**:12 条 `/sidebar/*` 路由共享的冷 cwd 读取按「会话 + 客户端提示」合并,切换会话的并发突发不再并行解码同一份大会话日志
|
||||
- **不再静默写错文件**:页签调解覆盖后台会话,worktree 会话统一地址基准——改名/删除的已打开文件不会被下一次保存重建,聊天链接也不会静默打开另一检出的同名文件
|
||||
- **宿主崩溃防护**:病态 `git status` 输出加了闩锁与进程树终止,「宿主 `RangeError` 崩溃」降为一次 SCM 刷新失败
|
||||
- **Git 页**:>1000 分支的历史恢复加载;tag 现在装饰提交行与详情,tag 变化会使旧分页失效
|
||||
- **编辑器**:仅 mtime 变化后保存不再死锁 `fs-conflict`;刷新后保留阅读位置;「添加到对话」落地为紧凑引用 chip,不再展平已有 chip —— 现在划选的一段文字还会变成**可点击**的引用 chip,点击跳回源文件并闪烁被引行段([#888](https://github.com/omdsh-dev/DSH-better-sidebar/issues/888))
|
||||
- **Markdown 链接**:本地 destination 的 Windows 反斜杠归一,`C:\ws\_analysis\report.md` 不再报裸 ENOENT
|
||||
- **侧栏**:右栏展开时底部工作台入口常显;macOS 兜底入口避开红绿灯;页签 scope 按内容稳定,消除无谓的整文件重读;关闭侧聊页签时归档其会话
|
||||
|
||||
## 🔌 插件生态
|
||||
|
||||
`ctx.betterSidebar` 向所有插件开放 `registerTab` / `registerFileViewer` 两个扩展点,内置 6 tab + 4 viewer 与第三方插件走同一套 API。GitHub topic [`dsh-better-sidebar`](https://github.com/topics/dsh-better-sidebar) 下已有 **30+ 生态插件**;完整接入文档见 **[docs/external-plugin-guide.md](./docs/external-plugin-guide.md)**。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> 面向 **消费插件开发者**:如何让你的插件向 better-sidebar 注册新的侧边栏页面(tab)和文件类型预览器。
|
||||
>
|
||||
> 适用版本:**v0.4.0+**(`ctx.betterSidebar` 服务);声明式设置 **v0.4.1+**;text/number 设置行 **v0.11.0+**;badge/生命周期/定向打开/插件设置/版本探测 **v0.12.0+**;select 设置行(`settingSelect`)与外链认领(`urlTarget`)**v0.13.0+**;统一 `@deepseek-ai/cordis` 类型基底 **v0.15.2+**;路由前缀安全解析(`hostRouteUrl`)**v0.25.0+**。当前版本 **v0.30.0**(14 条 DSH peer 下限 `^0.2.2-rc.1`,仅支持 DSH **0.2.2-rc.1+**;0.2.1 线(0.2.1-rc.1 ~ rc.5)请固定 v0.28.2;0.2.1-alpha.5 请固定 v0.28.0-alpha.0,0.2.0-rc.2 请固定 v0.26.1(v0.27.0 尚未发布),0.2.0-rc.1 请用 v0.24.1,0.1.7 线请用 v0.22.1——caret 范围跨 minor 不成立,`^0.1.7-rc.1` 会被 0.2.0 宿主的启动预检静默禁用)。**v0.19.0 移除了自绘右侧面板与自由窗口**(见 §0、§11);**自 v0.20.0 开发线起**(**注意:0.20.0 从未发布到 npm,这些变更全部落在 v0.21.1**)插件**移除了自带的终端**(宿主 0.1.6 的 `ui-sidebar-terminal` 取代,见 §4.4)、**移除了终端固定(pin)**,并在 0.1.7 上**把浏览器视图与只读文件预览整体让给宿主**(`ui-sidebar-browser` / `ui-sidebar-documentpreview`,见 §4.4、§5.4)、**收敛了外链接管**(见 §4.1)、**重写了设置接入面**(`SettingsForms`,见 §8.2)、**给文件树加了实时刷新**(见 §10);同时**删除了轮尾产物行接管**(DSH 0.1.6 把 `conversation.chat.turnTail` 从 chain 改成只能追加的 list,替换语义不复存在)。
|
||||
> 适用版本:**v0.4.0+**(`ctx.betterSidebar` 服务);声明式设置 **v0.4.1+**;text/number 设置行 **v0.11.0+**;badge/生命周期/定向打开/插件设置/版本探测 **v0.12.0+**;select 设置行(`settingSelect`)与外链认领(`urlTarget`)**v0.13.0+**;统一 `@deepseek-ai/cordis` 类型基底 **v0.15.2+**;路由前缀安全解析(`hostRouteUrl`)**v0.25.0+**。当前版本 **v0.30.1**(14 条 DSH peer 下限 `^0.2.2-rc.1`,仅支持 DSH **0.2.2-rc.1+**;0.2.1 线(0.2.1-rc.1 ~ rc.5)请固定 v0.28.2;0.2.1-alpha.5 请固定 v0.28.0-alpha.0,0.2.0-rc.2 请固定 v0.26.1(v0.27.0 尚未发布),0.2.0-rc.1 请用 v0.24.1,0.1.7 线请用 v0.22.1——caret 范围跨 minor 不成立,`^0.1.7-rc.1` 会被 0.2.0 宿主的启动预检静默禁用)。**v0.19.0 移除了自绘右侧面板与自由窗口**(见 §0、§11);**自 v0.20.0 开发线起**(**注意:0.20.0 从未发布到 npm,这些变更全部落在 v0.21.1**)插件**移除了自带的终端**(宿主 0.1.6 的 `ui-sidebar-terminal` 取代,见 §4.4)、**移除了终端固定(pin)**,并在 0.1.7 上**把浏览器视图与只读文件预览整体让给宿主**(`ui-sidebar-browser` / `ui-sidebar-documentpreview`,见 §4.4、§5.4)、**收敛了外链接管**(见 §4.1)、**重写了设置接入面**(`SettingsForms`,见 §8.2)、**给文件树加了实时刷新**(见 §10);同时**删除了轮尾产物行接管**(DSH 0.1.6 把 `conversation.chat.turnTail` 从 chain 改成只能追加的 list,替换语义不复存在)。
|
||||
> **版本对照提醒**:当前版本 **v0.30.0**(DSH 0.2.2-rc.1+)。0.x 的 caret 不跨 minor,因此 0.2.1 线(0.2.1-rc.1 ~ 0.2.1-rc.5,即今天的宿主 npm `latest`)必须固定插件 **v0.28.2**——v0.29.0 从未发布;DSH 0.2.1-alpha.5 固定 v0.28.0-alpha.0,0.2.0-rc.2 固定 v0.26.1。市场安装器按插件 `latest` 安装、不按宿主版本选版本。
|
||||
> 上一次 alpha.5 → rc.1 适配只动了 `package.json`(完整树差异 355 项,源码零变化);**本次 0.2.1 → 0.2.2 有真实代码改动**(`AgentModel` 取代可安装的 `ModelSelectionRef`、PTC 事件类型声明被移除、宿主图标改为 sprite),逐项记录见 [0.2.2 适配记录](plans/2026-11-04-dsh-0.2.2-rc.1-adaptation.md);伴随依赖仍为 Cordis peer `^4.0.5` / dev `4.0.5`、group `1.0.5`、schemastery `~3.18.5`、include `1.0.10`。
|
||||
> 权威代码:`src/client/service.ts`(服务实现)、`src/client/builtins/`(内置 6 tab + 3 viewer 参考实现)、`lib/types/client/service.d.ts`(类型声明)。
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "dsh-external/dsh-better-sidebar",
|
||||
"version": "0.30.0",
|
||||
"version": "0.30.1",
|
||||
"main": "./lib/index.js",
|
||||
"description": "更好用的右侧边栏——文件树、编辑器、文件变动、任务和侧边对话都收在这一栏里,每个会话互不干扰。暴露服务供其他插件注册侧边栏页面与文件预览器",
|
||||
"engines": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dsh-better-sidebar",
|
||||
"version": "0.30.0",
|
||||
"version": "0.30.1",
|
||||
"description": "Better Sidebar for DSH — file tree, editor, changes, tasks and side chat in one column, separate for every conversation. Also exposes a service other plugins use to register sidebar tabs and file viewers.",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
|
||||
@@ -26,6 +26,19 @@ export const IconTerminalOutline16 = ({ size = 16, className }: IconProps) => (
|
||||
</svg>
|
||||
)
|
||||
|
||||
/**
|
||||
* Settings-navigation glyph for the "Side card" section. The shell asks for a
|
||||
* square edge and tints the SVG with `currentColor`, so this stays a plain
|
||||
* two-tone outline mark: the side panel plus the two rails it docks against.
|
||||
*/
|
||||
export const IconSideCardNav = ({ size = 16, className }: IconProps) => (
|
||||
<svg width={size} height={size} className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2 7v10" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||
<path d="M6 5v14" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||
<rect x="10" y="3" width="12" height="18" rx="2" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||
</svg>
|
||||
)
|
||||
|
||||
/** Diff glyph in the app's outline style: a file frame with a plus and a minus row. */
|
||||
export const IconDiffOutline16 = ({ size = 16, className }: IconProps) => (
|
||||
<svg width={size} height={size} className={className} viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
+15
-10
@@ -26,7 +26,8 @@ import { createNativeSurface } from './native/surface.ts'
|
||||
import { isTargetAvailable, openInterceptedLink, registerLinkInterception, shouldTakeOverLink } from './link-intercept.ts'
|
||||
import { registerImeGuard } from './ime-guard.ts'
|
||||
import { registerQuoteSource } from './selection-quote.ts'
|
||||
import { registerSettingsNavIcon } from './settings-nav-icon.ts'
|
||||
import { IconSideCardNav } from './icons.tsx'
|
||||
import type { SettingsSectionIconOwnerProps } from '@deepseek-ai/dsh-client-ui-settings/client'
|
||||
import { loadBootDecision } from './prefs.ts'
|
||||
import { SideCardSection } from './SideCardSection.tsx'
|
||||
import { api } from './api.ts'
|
||||
@@ -462,15 +463,19 @@ export function apply(ctx: Context): void {
|
||||
'dsh-better-sidebar: IME composition guard',
|
||||
)
|
||||
|
||||
// DSH 0.1.x does not yet carry an icon through the settings.section
|
||||
// registration contract: its shell renders a generic gear for every
|
||||
// external section. Mark only this plugin's localized nav row so
|
||||
// layout.css can paint the requested Side card SVG; the disposer clears
|
||||
// the marker for HMR / plugin disable.
|
||||
ctx.effect(
|
||||
() => registerSettingsNavIcon(() => t('settingsNav')),
|
||||
'dsh-better-sidebar: settings navigation icon',
|
||||
)
|
||||
// The settings nav icon, contributed through the shell's own slot. The
|
||||
// contract addresses an icon by the section id (an unmatched id never
|
||||
// renders) and says the shell keeps its default glyph when none is
|
||||
// registered — so filling the slot REPLACES the fallback. The old
|
||||
// marker-and-CSS-mask replacement is gone with it: under the current shell
|
||||
// the nav icon is wrapped in a span, the stale `> svg:first-child` rule
|
||||
// stopped hiding the fallback and the row painted two glyphs.
|
||||
ctx.slots.inject('settings.section.icon', () => ctx.slots.register({
|
||||
name: 'settings.section.icon',
|
||||
id: 'better-sidebar',
|
||||
order: 100,
|
||||
label: () => t('settingsNav'),
|
||||
}, ({ size }: SettingsSectionIconOwnerProps) => createElement(IconSideCardNav, { size })))
|
||||
|
||||
// The "Side card" settings section: appears in the DSH Settings shell
|
||||
// once the shell's declaration is on the ledger (slots.inject waits for
|
||||
|
||||
@@ -55,25 +55,6 @@ body[data-dsh-sidebar-dragging] #root [data-dsh-center-col] {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
/* DSH 0.1.x gives external settings sections a generic gear and exposes no
|
||||
icon field in the settings.section contract. settings-nav-icon.ts marks
|
||||
only this plugin's localized row; render the requested Lucide
|
||||
gallery-horizontal-end SVG as a currentColor mask so it follows the native
|
||||
nav hover/active colors without changing the shell's 16px icon rhythm. */
|
||||
[data-dsh-better-sidebar-settings-nav] > svg:first-child {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-dsh-better-sidebar-settings-nav]::before {
|
||||
content: '';
|
||||
flex: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: currentColor;
|
||||
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 7v10'/%3E%3Cpath d='M6 5v14'/%3E%3Crect width='12' height='18' x='10' y='3' rx='2'/%3E%3C/svg%3E") center / contain no-repeat;
|
||||
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 7v10'/%3E%3Cpath d='M6 5v14'/%3E%3Crect width='12' height='18' x='10' y='3' rx='2'/%3E%3C/svg%3E") center / contain no-repeat;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
#root [data-dsh-center-col] {
|
||||
transition: none;
|
||||
|
||||
@@ -860,7 +860,7 @@ export function matchUrlTarget(tabs: readonly TabDescriptor[], url: URL): TabDes
|
||||
* The plugin version this service instance reports. Keep in lockstep with
|
||||
* `package.json`'s version — `tests/service.spec.ts` asserts the pair.
|
||||
*/
|
||||
export const SIDEBAR_SERVICE_VERSION = '0.30.0'
|
||||
export const SIDEBAR_SERVICE_VERSION = '0.30.1'
|
||||
|
||||
/**
|
||||
* Monotonic capability list consumers use to gate new API usage (features
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Mark this plugin's row in the DSH settings navigation so its bundled CSS
|
||||
* can replace the shell's fallback gear with the Side card glyph.
|
||||
*
|
||||
* DSH 0.1.x projects only `id`, `order`, and `label` from a
|
||||
* `settings.section` registration, then chooses icons inside the settings
|
||||
* shell from a closed list of built-in ids. Until that public contract grows
|
||||
* an icon field, the plugin identifies only its own localized row after the
|
||||
* dialog mounts. The marker owns no shell structure and is removed on fiber
|
||||
* disposal, so the adaptation remains HMR-safe.
|
||||
*
|
||||
* Mutation bursts are coalesced into one sync per animation frame: the
|
||||
* observer watches the whole body, so chat streaming would otherwise run the
|
||||
* document-wide row query at microtask cadence.
|
||||
*/
|
||||
|
||||
export const SETTINGS_NAV_MARKER = 'data-dsh-better-sidebar-settings-nav'
|
||||
|
||||
/**
|
||||
* Keep the marker on the settings-nav button whose visible text is this
|
||||
* plugin's current localized section label.
|
||||
* @param label - locale-aware label resolver used by the section registration.
|
||||
* @returns disposer that disconnects observation and removes owned markers.
|
||||
*/
|
||||
export function registerSettingsNavIcon(label: () => string): () => void {
|
||||
let disposed = false
|
||||
let frame: number | null = null
|
||||
|
||||
const sync = (): void => {
|
||||
if (disposed) return
|
||||
const currentLabel = label().trim()
|
||||
const buttons = document.querySelectorAll<HTMLButtonElement>('[role="dialog"] nav button')
|
||||
for (const button of buttons) {
|
||||
const matches = currentLabel.length > 0 && button.textContent?.trim() === currentLabel
|
||||
if (matches) button.setAttribute(SETTINGS_NAV_MARKER, '')
|
||||
else button.removeAttribute(SETTINGS_NAV_MARKER)
|
||||
}
|
||||
}
|
||||
|
||||
/** One sync per frame at most: the first mutation of a burst schedules it. */
|
||||
const schedule = (): void => {
|
||||
if (disposed || frame !== null) return
|
||||
frame = requestAnimationFrame(() => {
|
||||
frame = null
|
||||
sync()
|
||||
})
|
||||
}
|
||||
|
||||
sync()
|
||||
// No `characterData`: the marker is a function of the mounted buttons and
|
||||
// their text, and every dialog mount/unmount or row insert/remove already
|
||||
// changes childList. Watching character data made this observer fire for
|
||||
// every streamed token in the main conversation — a document-wide
|
||||
// `querySelectorAll('[role="dialog"] nav button')` per token burst.
|
||||
const observer = new MutationObserver(schedule)
|
||||
observer.observe(document.body, { childList: true, subtree: true })
|
||||
|
||||
return () => {
|
||||
disposed = true
|
||||
observer.disconnect()
|
||||
if (frame !== null) {
|
||||
cancelAnimationFrame(frame)
|
||||
frame = null
|
||||
}
|
||||
document.querySelectorAll(`[${SETTINGS_NAV_MARKER}]`)
|
||||
.forEach(element => { element.removeAttribute(SETTINGS_NAV_MARKER) })
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// @vitest-environment jsdom
|
||||
/**
|
||||
* Settings-navigation icon marker tests (including delayed dialog mount).
|
||||
*
|
||||
* v0.25 的稳态开销治理:观察者改 rAF 合帧 + 去掉 `characterData`。三条契约:
|
||||
* 1. 标记仍然落在本地化标签匹配的那一行上(挂载/改标签的既有用例);
|
||||
* 2. 同一帧里的一串 DOM 文本 mutation 只做**一次**全文档行查询;
|
||||
* 3. 纯文本节点内容变化(对话流式输出就是它)不再触发任何查询。
|
||||
*/
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { registerSettingsNavIcon, SETTINGS_NAV_MARKER } from '../src/client/settings-nav-icon.ts'
|
||||
|
||||
/** 被观察者查询的行选择器(统计它,而不是 disposer 的标记清理查询)。 */
|
||||
const NAV_SELECTOR = '[role="dialog"] nav button'
|
||||
|
||||
/** 确定性 rAF:只有在 flushFrame() 里才推进一帧。 */
|
||||
let frames: Map<number, FrameRequestCallback>
|
||||
let nextFrameId: number
|
||||
|
||||
function flushFrame(): void {
|
||||
const callbacks = [...frames.values()]
|
||||
frames.clear()
|
||||
for (const callback of callbacks) callback(0)
|
||||
}
|
||||
|
||||
function navButton(label: string): HTMLButtonElement {
|
||||
const button = document.createElement('button')
|
||||
button.innerHTML = `<svg data-fallback="gear"></svg><span>${label}</span>`
|
||||
return button
|
||||
}
|
||||
|
||||
function dialogWith(...buttons: HTMLButtonElement[]): HTMLElement {
|
||||
const dialog = document.createElement('div')
|
||||
dialog.setAttribute('role', 'dialog')
|
||||
const nav = document.createElement('nav')
|
||||
nav.append(...buttons)
|
||||
dialog.append(nav)
|
||||
return dialog
|
||||
}
|
||||
|
||||
async function mutationTick(): Promise<void> {
|
||||
await new Promise<void>(resolve => { setTimeout(resolve, 0) })
|
||||
}
|
||||
|
||||
/** 一次 mutation 走到「观察者回调(微任务)→ 合帧后的一次 sync」。 */
|
||||
async function settleMarker(): Promise<void> {
|
||||
await mutationTick()
|
||||
flushFrame()
|
||||
}
|
||||
|
||||
/** 观察者查询行的次数(标记清理的查询不算)。 */
|
||||
function navQueries(spy: { mock: { calls: unknown[][] } }): number {
|
||||
return spy.mock.calls.filter(call => call[0] === NAV_SELECTOR).length
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
frames = new Map()
|
||||
nextFrameId = 1
|
||||
vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {
|
||||
frames.set(nextFrameId, callback)
|
||||
return nextFrameId++
|
||||
})
|
||||
vi.stubGlobal('cancelAnimationFrame', (id: number) => {
|
||||
frames.delete(id)
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = ''
|
||||
vi.unstubAllGlobals()
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
describe('registerSettingsNavIcon', () => {
|
||||
it('marks only the matching settings row and preserves the shell icon DOM', () => {
|
||||
const general = navButton('General')
|
||||
const sideCard = navButton('Side card')
|
||||
document.body.append(dialogWith(general, sideCard))
|
||||
|
||||
const dispose = registerSettingsNavIcon(() => 'Side card')
|
||||
|
||||
expect(general.hasAttribute(SETTINGS_NAV_MARKER)).toBe(false)
|
||||
expect(sideCard.hasAttribute(SETTINGS_NAV_MARKER)).toBe(true)
|
||||
expect(sideCard.querySelector('[data-fallback="gear"]')).not.toBeNull()
|
||||
dispose()
|
||||
expect(sideCard.hasAttribute(SETTINGS_NAV_MARKER)).toBe(false)
|
||||
})
|
||||
|
||||
it('marks a dialog mounted later and follows a localized label change', async () => {
|
||||
let label = 'Side card'
|
||||
const dispose = registerSettingsNavIcon(() => label)
|
||||
const english = navButton('Side card')
|
||||
const chinese = navButton('侧边卡片')
|
||||
const dialog = dialogWith(english, chinese)
|
||||
document.body.append(dialog)
|
||||
await settleMarker()
|
||||
|
||||
expect(english.hasAttribute(SETTINGS_NAV_MARKER)).toBe(true)
|
||||
expect(chinese.hasAttribute(SETTINGS_NAV_MARKER)).toBe(false)
|
||||
|
||||
label = '侧边卡片'
|
||||
chinese.querySelector('span')!.textContent = '侧边卡片 '
|
||||
await settleMarker()
|
||||
expect(english.hasAttribute(SETTINGS_NAV_MARKER)).toBe(false)
|
||||
expect(chinese.hasAttribute(SETTINGS_NAV_MARKER)).toBe(true)
|
||||
|
||||
dispose()
|
||||
})
|
||||
|
||||
it('coalesces a burst of mutations into one sync per frame', async () => {
|
||||
const dispose = registerSettingsNavIcon(() => 'Side card')
|
||||
const button = navButton('Side card')
|
||||
document.body.append(dialogWith(button))
|
||||
// 对话正文的形态:转写每来一个 token 就往正文容器里插一个文本节点,而设置行本身
|
||||
// 一动不动。观察者盯的是整个 body,所以这些 mutation 都会打到它身上。
|
||||
const stream = document.createElement('div')
|
||||
document.body.append(stream)
|
||||
await settleMarker()
|
||||
|
||||
const query = vi.spyOn(document, 'querySelectorAll')
|
||||
for (let index = 0; index < 6; index++) {
|
||||
stream.append(document.createTextNode(`token ${index}`))
|
||||
// 每个 token 一个宏任务(流式输出的节拍):观察者是同步回调时,每次都会跑一次
|
||||
// 全文档行查询。
|
||||
await mutationTick()
|
||||
}
|
||||
expect(navQueries(query), '还没到帧,一次都不该查').toBe(0)
|
||||
flushFrame()
|
||||
expect(navQueries(query), '同一帧内的一串 mutation 只查一次').toBe(1)
|
||||
// 合帧不改变结果:帧末那次 sync 仍把标记留在唯一匹配的行上。
|
||||
expect(button.hasAttribute(SETTINGS_NAV_MARKER)).toBe(true)
|
||||
dispose()
|
||||
})
|
||||
|
||||
it('ignores characterData-only mutations (streamed conversation tokens)', async () => {
|
||||
const dispose = registerSettingsNavIcon(() => 'Side card')
|
||||
const button = navButton('Side card')
|
||||
document.body.append(dialogWith(button))
|
||||
// 对话正文那样的一串文本节点:先排掉挂载那一次观察者回调。
|
||||
const streamed = document.createTextNode('streaming 0')
|
||||
document.body.append(streamed)
|
||||
await settleMarker()
|
||||
|
||||
const query = vi.spyOn(document, 'querySelectorAll')
|
||||
for (let index = 1; index <= 5; index++) {
|
||||
streamed.data = `streaming ${index}`
|
||||
await mutationTick()
|
||||
}
|
||||
flushFrame()
|
||||
expect(navQueries(query), 'characterData 已被移出观察面').toBe(0)
|
||||
expect(button.hasAttribute(SETTINGS_NAV_MARKER), '标记不受正文影响').toBe(true)
|
||||
dispose()
|
||||
})
|
||||
|
||||
it('cancels a pending frame when disposed', async () => {
|
||||
const dispose = registerSettingsNavIcon(() => 'Side card')
|
||||
document.body.append(dialogWith(navButton('Side card')))
|
||||
// 观察到 mutation,但帧还没到就 dispose:回调必须被取消,不能再查一次。
|
||||
await mutationTick()
|
||||
const query = vi.spyOn(document, 'querySelectorAll')
|
||||
dispose()
|
||||
expect(frames.size, '待处理的那一帧被取消').toBe(0)
|
||||
flushFrame()
|
||||
expect(navQueries(query)).toBe(0)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* The settings-nav glyph the plugin contributes through
|
||||
* `settings.section.icon`.
|
||||
*
|
||||
* The shell owns the nav button and label and asks the registrant for a square
|
||||
* glyph: it passes the requested edge as `size` and tints the SVG with
|
||||
* `currentColor`, so the component must scale with that prop and must not carry
|
||||
* its own color. This replaced a marker + CSS-mask hack that assumed the
|
||||
* fallback gear was a direct `svg` child of the button; once the shell wrapped
|
||||
* it in a span the stale rule stopped hiding it and the row painted two glyphs.
|
||||
*/
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createElement } from 'react'
|
||||
import { renderRoot } from './test-utils.ts'
|
||||
import { IconSideCardNav } from '../src/client/icons.tsx'
|
||||
|
||||
describe('settings navigation icon', () => {
|
||||
it.each([16, 24])('honours the requested square edge (%i px)', (size) => {
|
||||
const { container, unmount } = renderRoot(createElement(IconSideCardNav, { size }))
|
||||
try {
|
||||
const svg = container.querySelector('svg')
|
||||
expect(svg).not.toBeNull()
|
||||
expect(svg!.getAttribute('width')).toBe(String(size))
|
||||
expect(svg!.getAttribute('height')).toBe(String(size))
|
||||
expect(svg!.getAttribute('viewBox')).toBe('0 0 24 24')
|
||||
} finally {
|
||||
unmount()
|
||||
}
|
||||
})
|
||||
|
||||
it('paints with currentColor only (the shell owns the tint)', () => {
|
||||
const { container, unmount } = renderRoot(createElement(IconSideCardNav, { size: 16 }))
|
||||
try {
|
||||
const svg = container.querySelector('svg')!
|
||||
expect(svg.getAttribute('fill')).toBe('none')
|
||||
for (const element of svg.querySelectorAll('path, rect, circle, line, polygon')) {
|
||||
const stroke = element.getAttribute('stroke')
|
||||
if (stroke !== null) expect(stroke).toBe('currentColor')
|
||||
expect(element.getAttribute('fill')).toBeNull()
|
||||
expect(element.getAttribute('style')).toBeNull()
|
||||
}
|
||||
} finally {
|
||||
unmount()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user