diff --git a/AGENTS.md b/AGENTS.md
index b8dba35b..e2f77520 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -42,7 +42,7 @@
- **当前基线 DSH 0.2.1-rc.1(v0.28.0 正式版起)**。13 条 `@deepseek-ai/dsh-*` peer 下限均为 `^0.2.1-rc.1` 浮动 caret 范围、**绝不钉精确版本**(只有 devDependencies 精确钉);本包不声明 `package.json#engines.dsh`,因此走 peer 兼容性检查;宿主对声明了该字段的包优先且仅按它判定,不读 peer。`dsh.plugin.json#engines.dsh` 不参与这一规则。`tests/market-manifest.spec.ts` 钉住这条形状。
- **0.x caret 不跨 minor,但可跨 patch**:`^0.1.7-rc.1` 对 `0.2.0-rc.1` 判定为 false → 整行 `disabled`、插件静默不加载。**抬基线必须同批抬 peer 下限。**
-- 支持线(用户侧):DSH **0.2.1-rc.1+** 使用插件 **v0.28.0**;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**(v0.23.0 从未发布到 npm)。按本仓库先例**不写运行时兼容层**。
+- 支持线(用户侧):DSH **0.2.1-rc.1+** 使用插件 **v0.28.1**;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**(v0.23.0 从未发布到 npm)。按本仓库先例**不写运行时兼容层**。
- **抬基线动作清单**:① `pnpm peers check`,把失配的传递 peer 提升进 devDependencies;② 扫宿主包产物的**裸 import 差集**(`pnpm peers check` 看不到这类失败,0.1.7 线是 `zustand` / `immer`);③ 对消费的宿主包做类型面 diff(重点 `ui-primitives` / `dsh-session` / `sidebar-right`),确认导出只增不减;④ 复查会话格式版本、`SUBAGENT_DESCRIPTOR_VERSION`、web profile 的 inject 列表;⑤ 同批同步 CI 钉版、`scripts/e2e-common.sh`、**`scripts/install.sh` / `scripts/install.ps1`(随包发布、会直接给用户 npx 命令)** 与 README / 指南的版本行。
- **用户 profile 自己的 `overrides: '@deepseek-ai/dsh-*'` 要同批抬**,否则旧包遮蔽 bundle → 预检禁用 `config-editor` → `settings` 行永久 `pending`;先看宿主日志的 `disabling profile plugin row` 与 `pending (waiting for service: …)`。
- **沿用 alpha.5 的删除契约**:不再依赖 `@deepseek-ai/dsh-invariants`、`ctx.invariants` 或上游 `/invariant` 子路径,也不发布本插件的 invariant companion;HTTP/WS 准入统一调用 `ctx.connection.requestRejection(req)`,仅 `undefined` 放行,不恢复 `webRuntime` / 自建信任例外。
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24bb80a2..1de9f788 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,8 +2,9 @@
> 本文档收录 dsh-better-sidebar 的完整发布历史(最新版摘要见 [README](README_ZH.md);同步发布于 [GitHub Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases))。
-### 未发布
+### v0.28.1
+- 🛡 **并发同键冷读合并(OOM 修复)**:全量重启后会话全部转为 detached,12 条 `/sidebar/*` 路由共享的 cwd 解析会对同一会话各做一次宿主冷观察(整份日志读 + 解码;39MB 级会话 × 44 个并发请求 ≈ 1.7GB → OOM)。现在 `cwdOf()` 把**同一会话 + 同一客户端 cwd 提示**的并发请求合并为一次真实读,其余 await 同一结果;不引入 TTL(宿主本身按持久化 revision 缓存已完成冷读),客户端提示参与 key 以免跨提示串味。`tests/smoke.spec.ts` 新增「12 并发 → 1 次冷读」与「不同提示不合并」两例。
- **runGit 输出上限加固**(#999):字节封顶后的 chunk 一律丢弃(闩锁)、超时/封顶路径统一销毁 stdio 并 SIGKILL 进程树、stderr 纳入同一预算;病态工作区的结果从「宿主 `RangeError` 崩溃」降为「一次 SCM 刷新失败」。
- **worktree 会话的根选择与地址基准**(#956 / #947 / #950 / #952):同一会话不再有两个基准——聊天链接按会话 header cwd 解析、打开/保存不再二次拼接,linked worktree 里也不再静默读到另一检出的同名文件。
- **关闭侧聊页签时归档其会话**(#981 / #942):线程的完整父会话副本不再作为独立会话残留在工作区列表里。
diff --git a/CHANGELOG_EN.md b/CHANGELOG_EN.md
index 0a9a8628..f7700107 100644
--- a/CHANGELOG_EN.md
+++ b/CHANGELOG_EN.md
@@ -4,9 +4,19 @@
>
> 📝 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.28.1
+
+- **Concurrent single-flight for cold cwd reads (OOM fix)**: after a full restart every session is detached, and the shared cwd resolution behind all twelve `/sidebar/*` routes ran one host observation per call (a full log read plus decode; a 39 MB session × 44 concurrent requests ≈ 1.7 GB → OOM). `cwdOf()` now shares one resolution between concurrent requests for the same session + client cwd hint; there is no TTL (the host already caches completed cold reads by persistence revision), and the hint stays in the key so different hints never leak across each other. Two new `tests/smoke.spec.ts` cases pin "12 concurrent → 1 cold read" and "different hints do not merge".
+- **No more silent wrong-file writes**: tab reconciliation now reaches tabs opened in **background sessions**, and a worktree session resolves chat links against **one address base**. Renaming or deleting an open file no longer re-creates the old path on the next save, and a relative link inside a linked worktree no longer silently opens a same-named file from another checkout ([#915](https://github.com/omdsh-dev/DSH-better-sidebar/issues/915), [#947](https://github.com/omdsh-dev/DSH-better-sidebar/issues/947), [#950](https://github.com/omdsh-dev/DSH-better-sidebar/issues/950), [#952](https://github.com/omdsh-dev/DSH-better-sidebar/issues/952)).
+- **Host crash guard for pathological git output**: the bounded `runGit` reader now latches after the byte cap, destroys both stdio streams and kills the process tree, and budgets stderr too. A pathological worktree can no longer take the whole host down with `RangeError: Invalid string length` ([#999](https://github.com/omdsh-dev/DSH-better-sidebar/pull/999)).
+- **Git page**: histories with more than 1,000 branches load again ([#1013](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1013)). **Tags now decorate commits, rows and details** — lightweight and annotated, with their own inventory budget and pagination fingerprint, without consuming the branch limit ([#983](https://github.com/omdsh-dev/DSH-better-sidebar/issues/983)).
+- **Editor**: saving after an mtime-only change (a `touch`, `git checkout` or formatter rewrite of identical content) no longer deadlocks on `fs-conflict`; “Reload from disk” adopts the fresh baseline in place and keeps the draft ([#1059](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1059)). The reading position survives tab re-seating ([#965](https://github.com/omdsh-dev/DSH-better-sidebar/pull/965)). “Add to conversation” now lands as a compact reference chip and never flattens earlier chips ([#1002](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1002), [#1052](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1052)).
+- **Markdown links**: local destinations normalize Windows backslashes, so `C:\ws\_analysis\report.md` opens instead of a bare ENOENT ([#1037](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1037)).
+- **Sidebar**: the bottom-workbench toggle stays visible while the right panel is open ([#989](https://github.com/omdsh-dev/DSH-better-sidebar/issues/989)); the macOS dock fallback avoids the window controls instead of pinning itself to the top-left corner ([#992](https://github.com/omdsh-dev/DSH-better-sidebar/issues/992)); a content-stable tab scope ends needless full-file re-reads ([#1057](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1057)); closing a side-chat tab archives its session instead of leaving a copy behind ([#942](https://github.com/omdsh-dev/DSH-better-sidebar/issues/942)).
+- **Package**: export the `dsh-better-sidebar/icon` subpath so other packages can resolve `icon.svg` through `exports` ([#1016](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1016)).
+
### v0.28.0
-- **Export the plugin icon subpath**: add the `dsh-better-sidebar/icon` package entry so other packages can resolve `icon.svg` through `exports`.
- **Stable plugin support moves to DSH 0.2.1-rc.1+**: all 13 DSH peer floors are `^0.2.1-rc.1`; development dependencies, CI and installers pin the exact RC baseline. No runtime compatibility layer or feature implementation changes are introduced.
- **Retain the published alpha's functionality**: the upstream alpha.5 → rc.1 full source-tree diff contains 355 files, all `package.json`, with no source changes. This release updates versions, dependency declarations and documentation only. Companion versions are Cordis peer `^4.0.5` / dev `4.0.5`, group `1.0.5`, schemastery `~3.18.5`, and unchanged include `1.0.10`.
- **Move to npm `latest`**: v0.28.0 will take over the plugin's `latest` tag through the existing stable-version workflow; no workflow change is needed. **DSH's own `latest` still points to 0.2.0-rc.2 and cannot run this release**: pin plugin **v0.26.1** on that host. DSH 0.2.1-alpha.5 users pin **v0.28.0-alpha.0**; earlier support-line guidance is unchanged. The user explicitly accepted the independent tags' compatibility risk.
diff --git a/README.md b/README.md
index 56d5873a..b4321c87 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
| | |
|---|---|
-| **🗂️ File Management**
Lazy-loading tree, git status colors, live directory watch, global search, drag-and-drop upload, multi-select batch actions, dual-source "Open with" menu.

| **🌿 Git**
Source Control (Merge / Staged / Changes groups, message box with Generate, branch + sync footer) plus a this-session AI-changes lens, with a **read-only commit graph** (lanes, ref badges, branch filter, commit details) in one tab.
|
+| **🗂️ File Management**
Lazy-loading tree, git status colors, live directory watch, global search, drag-and-drop upload, multi-select batch actions, dual-source "Open with" menu.

| **🌿 Git**
Source Control (Merge / Staged / Changes groups, message box with Generate, branch + sync footer) plus a this-session AI-changes lens, with a **read-only commit graph** (lanes, branch and tag badges, branch filter, commit details) in one tab.
|
| **📝 Editable Editor & Previews**
An editable CodeMirror (the stock preview is read-only), Markdown + Mermaid + floating outline, sandboxed HTML preview, `.jsonl` record cards, paged preview for huge files, streaming transfers with no size caps.
| **🧩 Tasks**
Live subagent topology (workflow graph / tree modes) + background task list: exit codes, live output, force-kill.
|
| **💬 Side Chat (beta)**
Codex-style side threads: inherit the full parent context and run independently, realtime push, visible & revocable queue, per-thread model selection, one-click promotion to a top-level session.
| **🖥️ Bottom Workbench**
A self-drawn bottom panel that coexists with the native right sidebar: drag-to-split panes, multiple terminal tabs, per-session persisted layout.
|
@@ -44,14 +44,14 @@ dsh plugin --profile web add dsh-better-sidebar@latest
Then **hard-refresh the browser** (Cmd/Ctrl+Shift+R). Requires DSH **0.2.1-rc.1+**.
-> **Compatibility warning — match the plugin to the host line.** As of 2026-10-26, DSH's npm `latest` is **0.2.1-rc.2**, so the command above installs the compatible v0.28.0. Hosts still on **0.2.0-rc.2** must pin `dsh-better-sidebar@0.26.1` (and should upgrade the host to `0.2.1-rc.2` first); DSH 0.2.1-alpha.5 users must pin `dsh-better-sidebar@0.28.0-alpha.0`. The marketplace installer picks the plugin's `latest` regardless of host version, so an old host gets a version-rejection error — upgrade the host or pin the version explicitly. The two packages' `latest` tags are independent.
+> **Compatibility warning — match the plugin to the host line.** As of 2026-10-26, DSH's npm `latest` is **0.2.1-rc.2**, so the command above installs the compatible v0.28.1. Hosts still on **0.2.0-rc.2** must pin `dsh-better-sidebar@0.26.1` (and should upgrade the host to `0.2.1-rc.2` first); DSH 0.2.1-alpha.5 users must pin `dsh-better-sidebar@0.28.0-alpha.0`. The marketplace installer picks the plugin's `latest` regardless of host version, so an old host gets a version-rejection error — upgrade the host or pin the version explicitly. The two packages' `latest` tags are independent.
Pick the plugin version for your DSH version
| Your DSH version | Install command |
| --- | --- |
-| **0.2.1-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.28.0` |
+| **0.2.1-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.28.1` |
| **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` |
| **0.2.0-rc.1** | `dsh plugin --profile web add dsh-better-sidebar@0.24.1` |
@@ -70,12 +70,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.1-rc.1 or newer, then run dsh plugin --profile web add dsh-better-sidebar@0.28.0
+1. Confirm DSH is 0.2.1-rc.1 or newer, then run dsh plugin --profile web add dsh-better-sidebar@0.28.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.28.0` (macOS / Linux / Windows Git Bash; `./scripts/install.ps1 -Version 0.28.0` for native Windows). It handles installation + bundle registration.
+**One-line script** — clone this repo and run `bash scripts/install.sh 0.28.1` (macOS / Linux / Windows Git Bash; `./scripts/install.ps1 -Version 0.28.1` for native Windows). It handles installation + bundle registration.
**Updating**: just re-run the install command, then hard-refresh the browser.
@@ -92,27 +92,28 @@ 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.1-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.28.0`. |
+| `dsh: command not found` | Install DSH first; or use `npx -y --package @deepseek-ai/dsh@0.2.1-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.28.1`. |
## 🆕 Recent Updates
+**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
+- **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
+
**v0.28.0 — stable plugin release for DSH 0.2.1-rc.1+**
- Move all 13 DSH peer floors to `^0.2.1-rc.1`; retain the alpha.0 functionality without runtime changes
- The upstream alpha.5 → rc.1 full-tree diff contains 355 files, all `package.json`; no source changes
-- v0.28.0 will replace this plugin’s npm `latest`, even while DSH’s `latest` remains 0.2.0-rc.2; old hosts must pin the versions in the table above
-- RC validation is pending; see the [RC adaptation record](./docs/plans/2026-10-17-dsh-0.2.1-rc.1-adaptation.md). Earlier alpha test counts are not RC evidence
-
-**v0.28.0-alpha.0 (prerelease)**
-
-- Adapt to DSH **0.2.1-alpha.5+**: use native Connection admission for HTTP/WS and remove the retired invariant companion and dependency
-- Files, Git, terminals and newly created side chats follow the session’s current working directory
-- The commit graph fills the available Git-panel height and adapts to the diff preview and window size
-- Optional dsh-context diagnostic shortcuts in agent details, background-job output windows and the session header appear only when the Context entry is available
-- **DSH 0.2.0-rc.2 users stay on npm-published v0.26.1**; v0.27.0 has not been published. Use the explicit alpha version above, not `latest`
-- Validation history: [DSH alpha.5 adaptation record](./docs/plans/2026-10-16-dsh-0.2.1-alpha.5-adaptation.md) (before the latest dev integration; not the final release test counts)
+- DSH 0.2.0-rc.2 hosts stay on plugin v0.26.1; DSH 0.2.1-alpha.5 hosts stay on v0.28.0-alpha.0
+- Validation: [RC adaptation record](./docs/plans/2026-10-17-dsh-0.2.1-rc.1-adaptation.md)
**v0.27.0** - full release history at [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG_EN.md)
@@ -121,11 +122,6 @@ If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-bett
- **Selection stays in place**: fixed the integration regression that displaced selected files and drew stray borders; added real-host layout coverage
- **Side Chat**: new child sessions seed from the latest summarizing compaction instead of copying the full parent log
-**v0.26.1** — full release history at [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG_EN.md)
-
-- ⚡ **Fixed the steady-state cost behind "fine on 0.24, then it got slow"** (community reports: the sidebar turns laggy after being open a long time, DSH turns laggy after many turns, a restart clears it for a while; an artifact-level A/B puts the line at v0.25.0): both 500 ms timers are now visibility-gated (the host right-panel state is one shared module-level poller; the blank-session fallback only runs while it actually renders), the per-tab 5 s session-root poll became **one per session and only while visible**, the file-tree watch and side-chat push stop when parked, `keepMounted` keeps its semantics while every cache/registry is now bounded, and the host cwd resolver gained in-flight dedupe with a 3 s → 15 s TTL
-- 📊 Measured in the real mount lane (4 visited tabs, 15 s idle window): live 500 ms timers **3 → 1**, live 5 s timers **5 → 0**, `session.cwd` requests **15 → 0**, hit tests **1,620 → 0**, forced layouts **5,190 → 30**
-
## 🔌 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)**.
diff --git a/README_ZH.md b/README_ZH.md
index f02905f9..8dfa0657 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -22,7 +22,7 @@
| | |
|---|---|
-| **🗂️ 文件管理**
懒加载目录树、Git 变更着色、实时 watch 刷新、全局搜索、拖拽上传、多选批量操作、「打开方式」双源菜单。

| **🌿 Git**
Source Control(Merge / Staged / Changes 三组、带 Generate 的消息框、分支与同步底栏)+ 本轮 AI 改动视角合一,并在同一页签内给出**只读提交图**(泳道、引用徽章、分支筛选、提交详情)。
|
+| **🗂️ 文件管理**
懒加载目录树、Git 变更着色、实时 watch 刷新、全局搜索、拖拽上传、多选批量操作、「打开方式」双源菜单。

| **🌿 Git**
Source Control(Merge / Staged / Changes 三组、带 Generate 的消息框、分支与同步底栏)+ 本轮 AI 改动视角合一,并在同一页签内给出**只读提交图**(泳道、分支与 tag 徽章、分支筛选、提交详情)。
|
| **📝 可编辑编辑器与预览**
可编辑的 CodeMirror(官方预览是只读)、Markdown + Mermaid + 浮动目录、HTML 沙箱预览、`.jsonl` 记录卡片、超大文件分页预览、传输无大小上限。
| **🧩 任务管理**
子代理拓扑实时预览(工作流图 / 树双模式)+ 后台任务清单:退出码、实时输出、强制终止。
|
| **💬 侧边对话(beta)**
Codex 风格侧边线程:继承主会话完整上下文独立运行、实时推送、排队可见可撤回、每个线程独立选模型、一键提升为顶层会话。
| **🖥️ 底部工作台**
自绘底部面板与原生右侧栏同时展开:拖拽分栏、多终端页签、按会话持久化布局。
|
@@ -44,14 +44,14 @@ dsh plugin --profile web add dsh-better-sidebar@latest
装完**硬刷新浏览器**(Cmd/Ctrl+Shift+R)即可。要求 DSH **0.2.1-rc.1+**。
-> **兼容性警告:插件版本必须与宿主线匹配。** 截至 2026-10-26,DSH 的 npm `latest` 是 **0.2.1-rc.2**,上方命令安装的 v0.28.0 与之兼容。仍停留在 **0.2.0-rc.2** 的宿主必须固定 `dsh-better-sidebar@0.26.1`(并建议先升级宿主到 `0.2.1-rc.2`);DSH 0.2.1-alpha.5 用户固定 `dsh-better-sidebar@0.28.0-alpha.0`。市场安装器按插件的 `latest` 安装、不按宿主版本选版本,旧宿主会收到版本拒绝错误——请升级宿主或显式固定版本。两个包的 `latest` 标签不是同一支持线。
+> **兼容性警告:插件版本必须与宿主线匹配。** 截至 2026-10-26,DSH 的 npm `latest` 是 **0.2.1-rc.2**,上方命令安装的 v0.28.1 与之兼容。仍停留在 **0.2.0-rc.2** 的宿主必须固定 `dsh-better-sidebar@0.26.1`(并建议先升级宿主到 `0.2.1-rc.2`);DSH 0.2.1-alpha.5 用户固定 `dsh-better-sidebar@0.28.0-alpha.0`。市场安装器按插件的 `latest` 安装、不按宿主版本选版本,旧宿主会收到版本拒绝错误——请升级宿主或显式固定版本。两个包的 `latest` 标签不是同一支持线。
按 DSH 版本选插件版本
| 你的 DSH 版本 | 安装命令 |
| --- | --- |
-| **0.2.1-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.28.0` |
+| **0.2.1-rc.1+** | `dsh plugin --profile web add dsh-better-sidebar@0.28.1` |
| **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` |
| **0.2.0-rc.1** | `dsh plugin --profile web add dsh-better-sidebar@0.24.1` |
@@ -70,12 +70,12 @@ dsh plugin --profile web add dsh-better-sidebar@latest
```text
帮我安装 dsh-better-sidebar 插件(DSH 侧边栏工作台),步骤:
-1. 先确认 DSH 为 0.2.1-rc.1 或更新版本,再执行 dsh plugin --profile web add dsh-better-sidebar@0.28.0
+1. 先确认 DSH 为 0.2.1-rc.1 或更新版本,再执行 dsh plugin --profile web add dsh-better-sidebar@0.28.1
2. 完成后提醒我硬刷新浏览器(Cmd/Ctrl+Shift+R)
遇到报错先查 https://github.com/omdsh-dev/DSH-better-sidebar README 的常见问题表。
```
-**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh 0.28.0`(macOS / Linux / Windows Git Bash;Windows 原生用 `./scripts/install.ps1 -Version 0.28.0`),自动完成安装 + bundle 注册。
+**一键脚本**——克隆本仓库后执行 `bash scripts/install.sh 0.28.1`(macOS / Linux / Windows Git Bash;Windows 原生用 `./scripts/install.ps1 -Version 0.28.1`),自动完成安装 + bundle 注册。
**更新**:重跑一次安装命令即可,然后硬刷新浏览器。
@@ -92,27 +92,28 @@ 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.1-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.28.0`。 |
+| 提示 `dsh: command not found` | 先安装 DSH;或用 `npx -y --package @deepseek-ai/dsh@0.2.1-rc.1 dsh plugin --profile web add dsh-better-sidebar@0.28.1`。 |
## 🆕 最近更新
+**v0.28.1 — UX 与可靠性补丁**
+
+- **OOM 修复**:12 条 `/sidebar/*` 路由共享的冷 cwd 读取按「会话 + 客户端提示」合并,切换会话的并发突发不再并行解码同一份大会话日志
+- **不再静默写错文件**:页签调解覆盖后台会话,worktree 会话统一地址基准——改名/删除的已打开文件不会被下一次保存重建,聊天链接也不会静默打开另一检出的同名文件
+- **宿主崩溃防护**:病态 `git status` 输出加了闩锁与进程树终止,「宿主 `RangeError` 崩溃」降为一次 SCM 刷新失败
+- **Git 页**:>1000 分支的历史恢复加载;tag 现在装饰提交行与详情,tag 变化会使旧分页失效
+- **编辑器**:仅 mtime 变化后保存不再死锁 `fs-conflict`;刷新后保留阅读位置;「添加到对话」落地为紧凑引用 chip,不再展平已有 chip
+- **Markdown 链接**:本地 destination 的 Windows 反斜杠归一,`C:\ws\_analysis\report.md` 不再报裸 ENOENT
+- **侧栏**:右栏展开时底部工作台入口常显;macOS 兜底入口避开红绿灯;页签 scope 按内容稳定,消除无谓的整文件重读;关闭侧聊页签时归档其会话
+
**v0.28.0 — 面向 DSH 0.2.1-rc.1+ 的插件正式版**
- 13 条 DSH peer 下限前移到 `^0.2.1-rc.1`,沿用 alpha.0 的功能实现,不增加运行时改动
- 上游 alpha.5 → rc.1 完整树差异共 355 个文件,全部为 `package.json`,源码零变化
-- v0.28.0 即将接管插件 npm `latest`,但宿主 `latest` 仍为 0.2.0-rc.2;旧宿主必须按上表固定旧插件版本
-- RC 验证待执行,见 [RC 适配记录](./docs/plans/2026-10-17-dsh-0.2.1-rc.1-adaptation.md);不把历史 alpha 测试统计当作 RC 验证证据
-
-**v0.28.0-alpha.0(预发布)**
-
-- 适配 DSH **0.2.1-alpha.5+**:HTTP/WS 改用宿主 Connection admission,移除已废弃的 invariant companion 与依赖
-- 会话执行目录变化时,文件 / Git / 终端与新建侧边对话跟随当前目录
-- 提交图使用 Git 面板完整可用高度,随差异预览和窗口大小自动调整
-- Agent 详情、后台任务输出窗和会话标题栏提供可选 dsh-context 诊断入口,仅在 Context 入口可用时显示
-- **0.2.0-rc.2 用户留在 npm 已发布的 v0.26.1**;v0.27.0 尚未发布,alpha 请用上方精确版本命令,不要用 `latest`
-- 验证历史:[DSH alpha.5 适配记录](./docs/plans/2026-10-16-dsh-0.2.1-alpha.5-adaptation.md)(合入最新 dev 之前的证据,不代表最终发布测试统计)
+- DSH 0.2.0-rc.2 宿主固定插件 v0.26.1;DSH 0.2.1-alpha.5 宿主固定 v0.28.0-alpha.0
+- 验证:[RC 适配记录](./docs/plans/2026-10-17-dsh-0.2.1-rc.1-adaptation.md)
**v0.27.0** - 完整发布历史见 [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG.md)
@@ -121,11 +122,6 @@ dsh plugin --profile web add dsh-better-sidebar@latest
- **选中行不再错位**:修复整合时引入的文件行漂移和异常边框,新增真实挂载布局回归
- **侧边对话**:从最近一次 summarizing compaction 构造子会话,不再全量复制父日志
-**v0.26.1** — 完整发布历史见 [Releases](https://github.com/omdsh-dev/DSH-better-sidebar/releases) · [CHANGELOG](./CHANGELOG.md)
-
-- ⚡ **修掉「0.24 没问题、之后越用越卡」的稳态开销**(社区反馈:侧栏在前台开久了卡、多轮对话后 DSH 卡、重启又暂时好;分界线经产物级 A/B 落在 v0.25.0):两个 500ms 表按可见性门控(右侧面板展开态改全模块一条共享表、空白会话兜底入口只在真的渲染时起表)、每 tab 的 5s 会话根轮询收敛成**每会话一条且只在可见时**、文件树 watch 与侧聊推送 parked 即停、`keepMounted` 保留语义但缓存与记账全部有界、宿主 cwd 解析加在飞去重且 TTL 3s→15s
-- 📊 真机实测(4 个访问过的页签、15s 空闲窗):活着的 500ms 表 **3→1**、5s 表 **5→0**、`session.cwd` 请求 **15→0**、命中测试 **1620→0**、强制布局 **5190→30**
-
## 🔌 插件生态
`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)**。
diff --git a/docs/external-plugin-guide.md b/docs/external-plugin-guide.md
index 591e87d6..dbdbf2d8 100644
--- a/docs/external-plugin-guide.md
+++ b/docs/external-plugin-guide.md
@@ -2,8 +2,8 @@
> 面向 **消费插件开发者**:如何让你的插件向 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.28.0 正式版**(13 条 DSH peer 下限 `^0.2.1-rc.1`,仅支持 DSH **0.2.1-rc.1+**;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.28.0 即将接管插件 npm `latest`,而宿主 npm `latest` 仍为 0.2.0-rc.2,不能据此判断兼容。旧 rc.2 宿主必须固定插件 v0.26.1;旧 alpha.5 固定 v0.28.0-alpha.0。用户已接受此标签分离,发布 workflow 不变。
+> 适用版本:**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.28.1 正式版**(13 条 DSH peer 下限 `^0.2.1-rc.1`,仅支持 DSH **0.2.1-rc.1+**;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.28.1**(DSH 0.2.1-rc.1+;宿主 npm `latest` 已为 0.2.1-rc.2)。仍停留在 DSH 0.2.0-rc.2 的宿主必须固定插件 v0.26.1;DSH 0.2.1-alpha.5 固定 v0.28.0-alpha.0。市场安装器按插件 `latest` 安装、不按宿主版本选版本。
> 本次 alpha.5 → rc.1 上游完整树差异 355 项全部为 `package.json`、源码零变化,因此不改功能实现;伴随依赖为 Cordis peer `^4.0.5` / dev `4.0.5`、group `1.0.5`、schemastery `~3.18.5`、include `1.0.10`。RC 验证单独记录于 [适配记录](plans/2026-10-17-dsh-0.2.1-rc.1-adaptation.md),不以已发布 alpha 的测试数字替代。
> 权威代码:`src/client/service.ts`(服务实现)、`src/client/builtins/`(内置 6 tab + 3 viewer 参考实现)、`lib/types/client/service.d.ts`(类型声明)。
> alpha.5 已删除 `@deepseek-ai/dsh-invariants` 与上游 `/invariant` 子路径;本插件同步移除 invariant companion,不提供替代注册服务。HTTP/WS 准入遵循宿主 Connection(见 §6.2)。
diff --git a/docs/screenshots/changes-tree.png b/docs/screenshots/changes-tree.png
index 912e6815..0b11b42b 100644
Binary files a/docs/screenshots/changes-tree.png and b/docs/screenshots/changes-tree.png differ
diff --git a/docs/screenshots/files-tree.png b/docs/screenshots/files-tree.png
index dc912a6c..b868e7cd 100644
Binary files a/docs/screenshots/files-tree.png and b/docs/screenshots/files-tree.png differ
diff --git a/dsh.plugin.json b/dsh.plugin.json
index 977cfe19..56887056 100644
--- a/dsh.plugin.json
+++ b/dsh.plugin.json
@@ -1,6 +1,6 @@
{
"id": "dsh-external/dsh-better-sidebar",
- "version": "0.28.0",
+ "version": "0.28.1",
"main": "./lib/index.js",
"description": "更好用的右侧边栏——文件树、编辑器、文件变动、任务和侧边对话都收在这一栏里,每个会话互不干扰。暴露服务供其他插件注册侧边栏页面与文件预览器",
"engines": {
diff --git a/package.json b/package.json
index b1406afc..4f1739af 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "dsh-better-sidebar",
- "version": "0.28.0",
+ "version": "0.28.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": {
diff --git a/src/client/service.ts b/src/client/service.ts
index 4cf8ec17..8072a32b 100644
--- a/src/client/service.ts
+++ b/src/client/service.ts
@@ -836,7 +836,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.28.0'
+export const SIDEBAR_SERVICE_VERSION = '0.28.1'
/**
* Monotonic capability list consumers use to gate new API usage (features
diff --git a/src/index.ts b/src/index.ts
index f6024711..feb30957 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -635,11 +635,37 @@ function buildApi(
assistantLive: AssistantLiveBuffer,
archiveTasks: ArchiveTasks,
): Record {
+ /**
+ * Same-key sharing for the shared cwd path. All twelve routes below resolve
+ * the session cwd through here, and a session switch fires them at once. A
+ * detached (cold) session costs one host observation per call — a full log
+ * read plus decode, e.g. 39 MB for a large session — and the host's cold
+ * cache only helps AFTER a read completes; concurrent same-key asks all miss
+ * it. A client burst therefore used to decode the same log N times in
+ * parallel (44 × 39 MB ≈ 1.7 GB, OOM on 0.28.0). Concurrent asks for the same
+ * session + client hint now share ONE resolution; the hint is part of the key
+ * because it is a fallback the result depends on. No TTL: the host already
+ * caches completed cold reads by persistence revision, so the leader's result
+ * is what every follower and every later ask reuses.
+ */
+ const cwdInFlight = new Map>()
const cwdOf = async (payload: unknown): Promise<{ sessionId: string; cwd: string }> => {
const sessionId = requireString(payload, 'sessionId')
const record = payload as { cwd?: unknown } | null
const clientCwd = typeof record?.cwd === 'string' && record.cwd !== '' ? record.cwd : undefined
- return { sessionId, cwd: await activeWorktreeRootOf(ctx, sessionId, await sessionCwdOf(ctx, sessionId, clientCwd)) }
+ const key = `${sessionId}\u0000${clientCwd ?? ''}`
+ const pending = cwdInFlight.get(key)
+ if (pending !== undefined) return pending
+ const resolved = (async (): Promise<{ sessionId: string; cwd: string }> => ({
+ sessionId,
+ cwd: await activeWorktreeRootOf(ctx, sessionId, await sessionCwdOf(ctx, sessionId, clientCwd)),
+ }))()
+ cwdInFlight.set(key, resolved)
+ try {
+ return await resolved
+ } finally {
+ cwdInFlight.delete(key)
+ }
}
/** Resolve the optional Git-panel checkout selector against the selected
* session repository. Unlike `cwd`, `worktree` is never trusted directly. */
diff --git a/tests/dock-fallback.spec.tsx b/tests/dock-fallback.spec.tsx
index fe1bc5ca..727484f6 100644
--- a/tests/dock-fallback.spec.tsx
+++ b/tests/dock-fallback.spec.tsx
@@ -112,6 +112,10 @@ async function settle(): Promise {
describe('dock fallback(空白会话入口)', () => {
beforeEach(() => {
+ // The store persists per-session state to localStorage; a test that opens
+ // the workbench must not seed the next test's store with
+ // `bottomOpen: true` (the click would close it instead of open it).
+ localStorage.clear()
intervals.clear()
vi.spyOn(globalThis, 'setInterval').mockImplementation(((fn: () => void, ms?: number) => {
const id = ++intervalSeq
@@ -233,6 +237,7 @@ describe('dock fallback(空白会话入口)', () => {
const shell = document.querySelector('[data-dsh-dock-fallback]')
expect(shell, '空白会话没有其他 opener,不能隐藏唯一入口').not.toBeNull()
expect(Number.parseFloat(shell!.style.left), '无空位也不能落到 left<=4 或红绿灯区域').toBeGreaterThanOrEqual(88)
+ expect(store.getSnapshot().state?.bottomOpen, '本用例从关闭态开始').toBe(false)
clickFallbackToggle()
expect(store.getSnapshot().state?.bottomOpen).toBe(true)
} finally {
diff --git a/tests/smoke.spec.ts b/tests/smoke.spec.ts
index cf36bd74..e1e9dd97 100644
--- a/tests/smoke.spec.ts
+++ b/tests/smoke.spec.ts
@@ -805,6 +805,46 @@ describe('session cwd resolution over the API route', () => {
expect(releases).toBe(2)
})
+ it('shares one cold observation between concurrent same-session cwd calls', async () => {
+ let reads = 0
+ let releases = 0
+ let unblock!: () => void
+ const gate = new Promise((resolve) => { unblock = resolve })
+ const shared = resolvePath('/cold-shared-execution')
+ const route = mount({ sessionQuery: {
+ observeSession: async () => {
+ reads += 1
+ await gate
+ return {
+ header: { cwd: resolvePath('/original-project') },
+ projections: { values: { workingDirectory: shared } },
+ [Symbol.dispose]: () => { releases += 1 },
+ }
+ },
+ } })
+ // A session switch fires the twelve routes at once; every one needs cwd.
+ const calls = Array.from({ length: 12 }, () =>
+ invoke(route, 'session.cwd', { sessionId: 'wd-shared', cwd: '/stale-client' }))
+ await Promise.resolve()
+ unblock()
+ const results = await Promise.all(calls)
+ expect(reads, 'concurrent same-key asks must share ONE cold read').toBe(1)
+ expect(releases, 'the shared observation is released once').toBe(1)
+ for (const result of results) {
+ expect(result).toMatchObject({ ok: true, value: { cwd: shared } })
+ }
+ })
+
+ it('does not share a resolution across different client cwd hints', async () => {
+ const route = mount({})
+ const [first, second] = await Promise.all([
+ invoke(route, 'session.cwd', { sessionId: 'wd-hints', cwd: resolvePath('/hint-a') }),
+ invoke(route, 'session.cwd', { sessionId: 'wd-hints', cwd: resolvePath('/hint-b') }),
+ ])
+ expect(first).toMatchObject({ ok: true, value: { cwd: resolvePath('/hint-a') } })
+ expect(second).toMatchObject({ ok: true, value: { cwd: resolvePath('/hint-b') } })
+ })
+
it('uses the host custom default for a null cold working-directory projection before a stale client hint', async () => {
const defaultDirectory = resolvePath('/configured-execution-default')
let releases = 0