Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

## 3. DSH 版本适配

- **当前基线 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` 钉住这条形状。
- **当前基线 DSH 0.2.1-rc.1(v0.28.0 正式版起)**。**v0.30.0 起 14 条** `@deepseek-ai/dsh-*` peer(新增 `dsh-client-ui-input-trigger`,划选引用 chip 用它的 `ctx.inputTriggers`)下限均为 `^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.29.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)。按本仓库先例**不写运行时兼容层**。
- **抬基线动作清单**:① `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 / 指南的版本行。
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

### 未发布

- 🔖 **编辑器里划选一段文字,主会话输入框里落一枚可点击的引用 chip(发送时展开成路径 + 围栏正文)**([#888](https://github.com/omdsh-dev/DSH-better-sidebar/issues/888)):`code` / `markdown` / `jsonl` 编辑面与 Markdown 预览里划选后,弹窗「添加到对话」不再只是把文本塞进输入框,而是插入一枚 chip。这枚 chip 归属本插件自己的 input-trigger source(`betterSidebarQuote`,经 `ctx.inputTriggers.registerSource` 注册):**点击它会把源文件在侧边栏打开并定位到被引行**,`line`–`lineEnd` 整段闪 2.4 s(皮肤令牌 `--dsw-alias-interactive-bg-hover-accent`,`prefers-reduced-motion` 下减弱);发送时由该 source 的 `codec.serialize` 还原成与升级前字节一致的 `<相对路径>[:起[-止]]` 表头 + ≤500 字符的围栏正文,超限只留表头。行段末行走模块内的一次性旁路 `src/client/line-target.ts`(key = path + line,最多 32 条),**不写进宿主导航参数**——宿主 `SidebarRightResourceParamsMap.file` 只声明了 `line`。
- 降级链:宿主没有 `ctx.inputTriggers`、注册被拒、composer 不在可插入相位、`draftRev` 不匹配 → 退回 #1052 内置的不可点击 chip;再退纯文本,最终行为与升级前一致。插不进去的那一次会删掉刚写入的引用记录,不留孤儿 id。
- 记录存 `localStorage`(`dsh-better-sidebar:quote-refs`,FIFO 200 条):该模块同时进 core bundle 与 lazy editor chunk,两个模块实例只能靠它互见记录。点击时校验 chip 所属会话,换了会话不跳转(cwd 可能不同,会打开错文件)。
- 底部工作台的编辑器不消费 `line`,因此**跳转与闪光只在右侧栏生效**;在那里 chip 仍能点开文件。
- 新增 peer `@deepseek-ai/dsh-client-ui-input-trigger`(`^0.2.1-rc.1`,DSH peer 增至 14 条);接入面与三级降级写进[指南 §7.2](docs/external-plugin-guide.md)。
- 🧪 测试:新增 `tests/selection-quote.spec.ts`(23 例)、`tests/quote-flash.spec.ts`(13 例)、`tests/line-target.spec.ts`(7 例);`tests/conversation-draft.spec.ts` 追加 2 例(chip 的 `source`/`ref` 覆盖不改动 #1052 的默认载荷)。
- ⚡ **大 Markdown 的 Mermaid 预览不再卡死渲染器(chunk 内测量隔离到沙箱 iframe)**:Mermaid 用 `SVGElement.getBBox()` 量文字,测量节点挂在 `document.body` 上 → 每次测量都刷新整个 DSH 文档布局。真机实测一次 `getBBox` **59–75 ms**(15,418 节点),空 iframe 里只要 **1 ms**;31 张图因此阻塞主线程 >20 s,触发桌面壳看门狗杀渲染器,恢复标签页后循环卡死。现在图表改在隐藏的 `sandbox="allow-scripts"` iframe(blob: 自包含 mermaid UMD + 协议)里渲染,父侧只做 postMessage 收发与 SVG 清洗:**单图 1,500–7,300 ms → 30–104 ms,31 图约 5 s 内完成**,客户端 mermaid chunk 同时从 **7.04 MB → 3.69 MB**。另加共享渲染队列(可见/近视口优先,其余 `requestIdleCallback` 逐张补齐,两次之间让出 16 ms 主线程;**所有图最终都会渲染成图,不再退化为代码块**)与按围栏行数预留高度的占位骨架。设计与实测见 [docs/plans/2026-10-23-mermaid-iframe-isolation.md](docs/plans/2026-10-23-mermaid-iframe-isolation.md)。
- ⚡ **大文档滚动流畅性:渲染让位于滚动、隐藏页签不空转、摘掉全量 DOM 扫描**:图表渲染队列在滚动期间暂停(停止滚动 350 ms 后恢复),并且只服务当前可见的预览——隐藏页签里的图表保持占位、切回时才渲染;`Markdown` 变更触发的两次全量扫描(内联 HTML pass、标题锚点 pass)由「每次 mutation 跑一遍」(实测 8–15 ms/次)改为 80 ms 合并一次;打开文档时的近视口判断改为先批量读 rect、再统一写入,去掉每张图一次强制布局;`.mermaidWrap` 增加 `content-visibility: auto` + `contain-intrinsic-size` + `contain: layout paint style`,视口外的图表不再参与布局与绘制。滚动时不再有后台渲染、全量扫描与视口外 SVG 重绘抢主线程;图表仍会在滚动停止后或进入视口时补齐,不退化为代码块。
- 🐞 **图表渲染失败时直接显示 mermaid 的解析错误**:之前只显示通用「Mermaid 渲染失败」+ 源码块(完整错误只在 hover title 里)。现在错误条下方直接给出 mermaid 报错的首两行(如 `Parse error on line 10 ... Expecting 'SEMI', ... got 'UNICODE_TEXT'`),配合下方源码可快速定位坏围栏;错误信息仍完整保留在 title 中。
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

### Unreleased

- 🔖 **Selecting text in the editor now drops a clickable quote chip into the main composer (expanded to a path plus fenced body on send)** ([#888](https://github.com/omdsh-dev/DSH-better-sidebar/issues/888)): in the `code` / `markdown` / `jsonl` editing surfaces and in Markdown preview, "Add to conversation" used to paste the text into the composer; it now inserts a chip owned by a plugin-registered input-trigger source (`betterSidebarQuote` via `ctx.inputTriggers.registerSource`). **Clicking the chip reopens the source file in the sidebar at the quoted lines** and flashes the whole `line`–`lineEnd` span for 2.4 s (skin token `--dsw-alias-interactive-bg-hover-accent`, softened under `prefers-reduced-motion`); on send the source's `codec.serialize` restores the byte-identical `<relative path>[:start[-end]]` header plus a fenced body of up to 500 characters (header only beyond that). The end line reaches the viewer through a module-local one-shot side channel (`src/client/line-target.ts`, keyed by path + line, capped at 32), **never through host navigation params** — the host's `SidebarRightResourceParamsMap.file` only declares `line`.
- Degradation: no `ctx.inputTriggers` service, a rejected registration, a composer outside an insertable phase, or a stale `draftRev` falls back to the built-in non-clickable chip from #1052, then to plain text, so behaviour never regresses past the previous release. A failed insert deletes the record it just wrote, so no orphan ids accumulate.
- Records live in `localStorage` (`dsh-better-sidebar:quote-refs`, FIFO of 200) because the module ships in both the core bundle and the lazy editor chunk; the two instances can only see each other's records that way. Clicking validates the chip's session first — a different session may carry a different cwd and would open the wrong file.
- The bottom-workbench editor does not consume `line`, so **jump and flash only apply in the right sidebar**; the chip still opens the file there.
- New peer `@deepseek-ai/dsh-client-ui-input-trigger` (`^0.2.1-rc.1`, bringing the DSH peers to 14); the integration surface and its three-tier fallback are documented in [guide §7.2](docs/external-plugin-guide.md).
- 🧪 Tests: new `tests/selection-quote.spec.ts` (23 cases), `tests/quote-flash.spec.ts` (13), `tests/line-target.spec.ts` (7); `tests/conversation-draft.spec.ts` gains 2 cases (the chip's `source`/`ref` override leaves #1052's default payload untouched).
- 🪟 **Windows + WSL workspaces: a UNC path is no longer folded into a drive-relative one.** Re-spelling paths on a Windows base folded every run of separators into one `\`, which also folded the UNC prefix of `\\wsl.localhost\<distro>\...` into `\wsl.localhost\...`; the host's `path.resolve()` then anchored that on its own process drive (`C:\wsl.localhost\...`), so every file opened from a WSL workspace failed with ENOENT. The UNC prefix now survives and only the rest is folded (drive paths are unchanged).
- 🧪 `tests/worktree-address.spec.ts` adds one case: UNC absolute, workspace-relative, and forward-slash spellings all keep the two leading separators.
- 🗂 **A session cwd that is a Git repository subdirectory is no longer lifted to the repository top** ([#1024](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1024), [#1080](https://github.com/omdsh-dev/DSH-better-sidebar/issues/1080); contributor PR [#1070](https://github.com/omdsh-dev/DSH-better-sidebar/pull/1070) @hy5424): the sidebar root was replaced with `git rev-parse --show-toplevel`, so a relative file link in chat resolved to `<repo>/<file>` instead of `<repo>/<subdir>/<file>` (ENOENT) and file search used the wrong root. The session cwd is now the root as it stands; only linked-worktree evidence from the session's own tool calls replaces it. The cwd is canonicalized first, so symlinked spellings (`/var` vs `/private/var`) cannot make a nested worktree look outside the workspace (#952).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ If something fails, check the FAQ table in https://github.com/omdsh-dev/DSH-bett
- **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
- **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

Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ dsh plugin --profile web add dsh-better-sidebar@latest
- **不再静默写错文件**:页签调解覆盖后台会话,worktree 会话统一地址基准——改名/删除的已打开文件不会被下一次保存重建,聊天链接也不会静默打开另一检出的同名文件
- **宿主崩溃防护**:病态 `git status` 输出加了闩锁与进程树终止,「宿主 `RangeError` 崩溃」降为一次 SCM 刷新失败
- **Git 页**:>1000 分支的历史恢复加载;tag 现在装饰提交行与详情,tag 变化会使旧分页失效
- **编辑器**:仅 mtime 变化后保存不再死锁 `fs-conflict`;刷新后保留阅读位置;「添加到对话」落地为紧凑引用 chip,不再展平已有 chip
- **编辑器**:仅 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 按内容稳定,消除无谓的整文件重读;关闭侧聊页签时归档其会话

Expand Down
Loading