Commit Graph
221 Commits
Author SHA1 Message Date
Menghuan1918 2c8d11a8fc feat(editor): 编辑器未提交变更提示(行号着色 + 左侧色条 + hover blame)(#212)
code 视图(可编辑 CodeMirror)显示未提交变更的行级提示,一个布尔设置
editorGitGutter(默认开)总开关:

- 行号槽着色 + 行号左侧 2px 细色条(新增/修改/删除),取色复用文件树
  既有 tone 口径(--dsw-alias-state-*);
- hover 某行时按需取该行 blame,纯文本 tooltip(作者 · 时间 + 摘要),
  按 sessionId+path+line 记忆化,不预取整文件、滚动不重复请求;
- 行映射复用既有 useGitStatus 共享 store 与既有统一 diff 引擎
  (parseUnifiedDiff/unifiedSegments),不新增第二个 git status 轮询器;
  未跟踪文件按状态 store 整篇标新增;
- 新增宿主路由 git.diff-head(git diff HEAD,部分暂存时给出已暂存+未暂存
  的整份未提交变更,未出生 HEAD 回退 --cached)与 git.blame
  (git blame --porcelain -L,四条失败路径一律返回空,不抛);
- 只给 viewerId === 'code' 挂 decoration/gutter/tooltip,markdown/html 与
  关闭设置后不安装任何扩展;开关经 Compartment 原地重配。

不做行尾常驻作者 widget、不做徽章、不做动画、不做渐变、不做四个独立开关。
2026-10-05 22:25:51 +08:00
Menghuan1918 a67779acdc fix(desktop): 顶部保留区优先读壳的 desktopWindow 契约(#864)
现象:dsh-desktop 的 compatibility / extended 模式下,壳已经把整个页面下移 36px(页面在独立
WebContentsView / 壳自有 root 里从 y=36 开始),却仍按契约在 URL 上盖
`dsh-desktop-titlebar-inset=36`;插件把这枚戳当成「页面还要再让位 36px」,于是面板顶部多一条空白。

修法:
① `desktop-env.ts`:mode 接受第三种取值 `extended`(与 compatibility 同几何的独立 36px
   frame),并新增 `probeDesktopWindow(ctx)` —— 结构化探测客户端服务 `ctx.desktopWindow`
   (镜像类型 `SidebarDesktopWindowService` 落在 `context-types.ts`,照 sidebar-file.ts 的
   probe 约定)。**不写进 `dsh.client.inject`**:普通浏览器没有该服务,注入它会让整个插件
   pending;探测按调用读(服务由壳自己的 client fiber 提供,可能后到),`get` 抛错按缺失处理。
② `computeTitleBarStrip`:取值链在 ⓪ `web` 强制 0 之后、① WCO 之前插入壳契约 —— 服务存在时
   以 `safeAreaInsets.top` 为权威(compatibility / extended 报 0 → 不再预留;advanced 报它画进
   内容里的 caption 行,darwin 与 win32 同为 32,以壳上报值为准)。URL 戳因此在有服务时被忽略;服务不存在时旧链路
   (WCO → URL → preset/custom)逐字不变。
③ `shell-presets.ts`:复核 `env.mode !== 'advanced'` —— extended 不套用 advanced 的 preset
   顶部值(guard 原样成立,补注释与用例把它钉住)。

文档:指南 §12 的壳信号与 strip 取值链、`docs/plans/2026-08-20-desktop-scheme-settings-design.md`
的实施偏差记录同步。

判别性(`git stash push -- src` 临时还原源码、保留测试后重跑):
- titlebar-strip.spec.ts:(a)/(d) 由 0 变 **36**、(b) 由 32 变 0 → 3 例红((c)「无服务 + 戳 36
  → 36」在旧代码上照旧绿,正是本次刻意不动的那段);
- desktop-window-strip.spec.tsx(挂真 Sidebar、断言页面实际状态):期望
  `{compat:false, px:''}` 实得 `{compat:true, px:'36px'}` —— issue 的可见症状本身;advanced 实得
  无 strip → 3 例红;
- desktop-env.spec.ts:extended 解析成 null、`probeDesktopWindow is not a function` → 4 例红
  (typecheck 同时报 12 条:链只收 5 参 / `'extended'` 不在联合里);
- 还原后 34/34 绿,src diff 与还原前逐字节一致(`git diff -- src | diff - /tmp/430-src.patch`)。

全量:174 files / 1977 passed | 13 skipped(新增 14 例),typecheck 0,eslint 0。

本改动**不**解决 #430(那是「preset / custom 档位不改变位置」的取值链优先级问题),两者不要互相关闭。
2026-10-05 21:59:14 +08:00
Menghuan1918 2dceb093b9 test(git): 补 git.suggest-message 宿主路由契约(模型回退链/截断/参数面/错误映射)
新增 tests/git-suggest-route.spec.ts(16 例;真 git 仓库 + 假 ctx.llm / 假会话 / 假设置,
沿 tests/git-remote-actions.spec.ts 的 harness),在真实 /sidebar/api 路由面上钉住:
三级模型回退链(固定 → 会话自身 → agentDefaultModel)与「全都拿不到」的可辨识 503、
提示词组装与 truncateDiff 的截断标记、512 token / 最低 reasoningEffort / 30s 超时确实
进了 llm.stream 入参、{message, provider, model} 返回形状与 cleanSuggestion 后的文本、
llm 失败与「无可用模型」可区分的错误映射,以及「除读 diff 外零 git 调用」的安全不变式
(spawn 进程边界 + 仓库状态双证据)。

顺带把 docs/plans/2026-10-05-git-commit-suggest-and-remote-actions.md 改名为
2026-10-05-git-remote-actions.md(内容本就是 Push/Pull 移植记录,slug 与内容错位),
并补记该路由层缺口的回填。

Refs #642
2026-10-05 02:50:34 +08:00
Menghuan1918andAhdong&Shouey 3badac1981 Merge port/pr-434:Push / Pull(建议提交信息只留 port/pr-642 的一份实现)
冲突取舍:

- src/client/locales*.ts + locales.ts(20 份词典):两侧都是在同一锚点插入新键。保留 HEAD
  (#642 的 generateCommitMessage / generatingCommitMessage / suggestCommitError /
  suggestCommitEmpty / commitModel* 等)全部译文,只并入 434 的 push / pull / pushError /
  pullError 四键;同名键只留一份(重复插入会 TS1117 直接红)。
- src/client/api.ts:保留 #642 的 gitSuggestMessage(返回 message+provider+model)与
  gitModels / gitCommitModel,并入 434 的 gitPush / gitPull;删 434 的同名 gitSuggestMessage。
- src/index.ts:git.suggest-message 取 #642 的路由体(pinned → 会话自身 → agentDefaultModel
  三级模型回退、buildCommitPrompt/truncateDiff、最低 reasoningEffort、512 token、30s 超时、
  assembler.finish 判错),删 434 的 SUGGEST_DIFF_LIMIT / sessionModelRoute / 重复的
  @deepseek-ai/dsh-llm import;git.push / git.pull 两条路由(434)保留。
- src/client/changes/GitLens.tsx:以 #642 的提交栏为基(原生 textarea + commitInputWrap +
  commitBusyText + suggestButton + Ctrl+G + 模型 tooltip),删 434 的重复 suggestMessage 与
  Input+IconButton 版建议按钮;把 Push/Pull 两个按钮并进同一条 commitRow(不新增第二行),
  失败仍落既有那一条 actionError 状态行。
- src/client/changes/changes.module.css:删 434 的 .suggestSpinner + keyframes +
  prefers-reduced-motion 块与 .commitRemoteRow(#642 自带 suggestButton / commitBusyText)。
- src/context-types.ts:整块回退到 HEAD,删 434 的 requestHeader() / SidebarSessionRoute
  (#642 的模型路由不消费它,留着就是死接线)。
- 测试:tests/git-remote-actions.spec.ts 只留 push/pull 的 4 例宿主用例(434 的
  git.suggest-message 组钉的是被替换的契约:requestHeader 折叠与 200 token 预算);
  tests/git-suggest-ui.spec.tsx 改为 tests/git-remote-actions-ui.spec.tsx,只留 Push/Pull 一例
  (jsdom,钉调用参数与共用状态行);建议实现由 #642 自带的 commit-message / git-suggest /
  commit-model-settings 三个 spec 覆盖。
- docs/plans/2026-10-05-git-commit-suggest-and-remote-actions.md:改写为 Push/Pull 的移植
  记录,写明两处集成取舍(建议以 #642 为准并逐项列出删除的接线;文件树 rename 整块丢弃)。

Co-authored-by: Ahdong&Shouey <131278957+LiuStar656@users.noreply.github.com>
2026-10-05 02:41:34 +08:00
Menghuan1918andidoall ce2ccabcad Merge port/pr-584:/sidebar/* 传输按页面前缀解析(反代子路径不再甩掉前缀)
冲突取舍(两处都是「能力清单并集」,两边都留,不取一边):

- src/client/service.ts:SIDEBAR_FEATURES 同时保留 #264 的 'settingPatterns' 与
  #584 的 'hostRouteUrl'(能力清单只增不删)。
- docs/external-plugin-guide.md:features 契约行同步列全两项。

移植分支已按证据卡口径把 base 权威收到一处:desktop-env.ts 的 hostTransportBase()
= __DSH_TRANSPORT__?.streamBaseUrl ?? document.baseURI(宿主同款解析式,保留 #768 的
桌面壳修复),HTTP/WS 共用 hostRouteUrl / hostWebSocketUrl 而不另起一套 base 来源;
HTTP 调用点 api / chunk-loader / markdown-images / archive / file / html,
WS 调用点 use-host-feeds / use-dir-watch 均已切到新 helper。

Co-authored-by: idoall <6040958+idoall@users.noreply.github.com>
2026-10-05 02:38:02 +08:00
Menghuan1918andCold Cloud d377bf458c Merge port/pr-303:fs.search 引擎优先(fd/rg 探测 + JS 回退)
冲突取舍(#264 排除模式 × #303 引擎优先,两边功能全部保留):

- src/fs-search.ts:保留 #303 的 searchFiles(引擎优先 dispatch)/ searchFilesPlain
  拆分与 SKIP_DIR_NAMES 单源化,同时保留 #264 的 opts.exclude。新增
  engineExcludeProbe:编译好的 exclude 探针作为**引擎输出的后置过滤**——引擎是更快的
  walk,不是另一套过滤面,所以匹配行消失,且被排除目录下的整棵子树一起消失(walk 从
  不下钻,永远不会报出它们)。过滤在预算切片之前跑(被排除行不吃调用方的行额),
  dirs 仍严格是 matches 的子集。
- tests/fs-search.spec.ts:两个分支的 import 都保留;新增一条用例钉住引擎路径的排除
  后置过滤(行 + 子树 + dirs),走注入钩子,不依赖真 fd/rg。
- docs/external-plugin-guide.md:两处增量并入同一条参考实现条目(顺序按 dev 现状)——
  #264 的 compact / explorerExclude / 目录缓存模式集身份键 在前,#303 的
  search-engines.ts、引擎优先与 DSH_SEARCH_DEBUG 插桩 在后,测试清单两边都列。

Co-authored-by: Cold Cloud <64406210+yanzhaohui1999@users.noreply.github.com>
2026-10-05 02:37:39 +08:00
Menghuan1918andidoall 78274c7b78 fix(sidebar): /sidebar/* 传输按页面前缀解析,反代子路径下不再甩掉前缀(#584 移植)
贡献者 PR #584(fix: preserve reverse-proxy base paths,head 1ca99d8)的改动面在
dev 上仍然需要——JSON API / upload / file / html / bundle 与两条 WebSocket 都还是
源站绝对路径(带前导斜杠 → 反代子路径下 404 / 1006),目标 issue #753 仍 OPEN,
docs/plans/2026-10-04-issue-triage.md 也把 #584 记为优先合入项。但它不能机械解冲突,
故按 dev 现有结构重写。

复用(PR 的可复用部分):
- 新增 src/client/host-route-url.ts:hostRouteUrl() / hostWebSocketUrl() 先去前导
  斜杠,再按注入基底解析;基底去 search/hash 并强制目录尾斜杠——launch token 查询串
  与「缺尾斜杠的前缀」都不会吃掉路径最后一段。

改写(dev 侧已经变掉的东西):
- 基底来源并进 dev 的 2718725:desktop-env.ts 的 sidebarWebSocketBase() 泛化为
  hostTransportBase()(__DSH_TRANSPORT__.streamBaseUrl 优先,回落 document.baseURI),
  HTTP 与 WS 从此共用一个基底权威,而不是另起一套。丢弃 PR 的 hostDocumentBase()
  「取 document.baseURI 与 location.href 中更长者」启发式:它会顶掉刚落地的桌面壳修复
  (dsh-app://app/ 下 location.href 会重新拼出不可达的 ws://app/…),而基线
  0.2.0-rc.1 的宿主产物里没有 <base href>(PR 自己的 e2e 也只采集、从不断言它)。
  最终解析式与宿主 dsh-api-gateway 逐字同形(去前导斜杠 + 壳注入基底优先)。
- 丢弃 src/client/TerminalView.tsx 的改动:该文件在 dev 已删除(终端已交还宿主),
  其覆盖的 WS 语义改由 dev 现存的两条调用点承担,并补齐 PR 文件清单里漏掉的
  src/client/use-dir-watch.ts(fs-watch socket)。

调用点(一律相对路径 + 前缀解析):api.ts 的 JSON API / upload / file / html /
archive、chunk-loader.ts 的 CHUNK_URL、markdown-images.ts 与 MarkdownHtml /
TextEditor / DiffPane 的媒体改写(原 window.location.origin 在桌面壳下是
dsh-app://app,媒体同样不可达)、use-host-feeds.ts 与 use-dir-watch.ts 的两条
WebSocket。archiveDownloadUrl 是 PR 漏掉的同类调用点(FileTree 用它 fetch zip 字节),
一并纳入;open-in-app.ts 打的是宿主路由 /open-in-app/*,与 PR 明确不碰的宿主 /api
同类,不纳入。

消费插件契约(指南「接入 API 即文档」):
- BetterSidebarService 新增 hostRouteUrl(path)(features 'hostRouteUrl'),
  docs/external-plugin-guide.md §6 / §7 / §15 的 fetch('/sidebar/api/…') 示例改为
  经它解析,并写明「绝不写前导斜杠」。

验证:pnpm typecheck / pnpm exec vitest run(161 files / 1812 passed / 13 skipped)/
eslint 全绿。tests/base-path.spec.ts 钉前缀保留与基底优先级,并在真实调用点上断言
(api fetch 的 URL、chunk 注入的 script src、jsdom 下 fs-watch 的 socket URL);
PR 自带的 base-path e2e 在 page.evaluate 里复制实现后自证,回归守不住,故不引入该 lane。

Refs #584

Co-authored-by: idoall <6040958+idoall@users.noreply.github.com>
2026-10-05 02:22:03 +08:00
Menghuan1918andshyuan-hub 5254c031b1 feat(explorer): 文件树面包屑折叠 + VS Code 风格可配置排除模式(移植 #264)
按当前 dev 重写贡献者 PR #264 的两项核心意图:

1. 面包屑折叠(VSCode "compact folders"):host 给「内容恰为一个有效
   子项」的目录行标记 `compact`,client 把单目录链折叠成一行 `a/b/c`
   并整链展开/折叠。
2. `explorerExclude`(VS Code `files.exclude` 风格的 glob 子集):匹配
   条目从文件树与文件名搜索中彻底移除;树与搜索共用同一份 host 侧编译
   好的 matcher,两个界面永不失配。

为什么按 dev 现有结构重写而不是机械解冲突——证据卡逐条点名的 dev 侧变化:

- **客户端树已换成 DirRow 记忆化组件 + loadLevels/api.fsTrees 批量路由**。
  PR 改的是旧的 `expanded.includes(...)` 内联目录行与单路径 `api.fsTree`,
  该上下文在 dev 已不存在。折叠因此接在 renderLevel/visibleRows 的链上,
  并新增「每级缓存修订一次」的链缓存:DirRow 按 prop 身份 memo,每次渲染
  新建数组会让选择/悬停把每个目录行都重渲。
- **`api.fsTree(scope, path, signal?)` 的第三位已经是 AbortSignal**,PR 的
  `api.fsTree(scope, dir, exclude)` 会把数组当 signal。exclude 统一排在
  signal 之前(`fsTree`/`fsTrees`/`fsSearch` 三处一致)。
- **dev 的 `listDirectory` 有 1.5s TTL 缓存,PR 是直接读盘**。照搬会让不同
  排除集共用一份缓存(改完排除列表仍读到旧行),而 pref 变更没有可搭的
  失效钩子。故把模式集的身份并入 cacheKey(新增 `ExcludeMatcher.key`,含
  锚点 root 与大小写折叠语义):同列表命中缓存,改列表即换键。
- **文件树的真实入口是批量路由 `fs.trees`**(挂载/展开一次 POST),PR 只
  改了 `fs.tree`/`fs.search` 两处——不接批量路由等于 exclude 不生效。
- PR body 声称移除 `explorerShowHidden`,但净 diff 对它零命中、dev 与 PR
  合并基也都没有该键,属失效声明,不做产品取舍。

复用的部分(与 dev 无耦合):`src/exclude-patterns.ts` 与
`src/client/file-tree-compact.ts` 两个纯逻辑模块逐字取用(前者仅新增缓存
身份 `ExcludeMatcher.key`)。设置 UI 沿用 PR 的声明式 `patterns` 行类型
(chips + 删除钮 + 常驻添加输入框,原子提交整表),5 个新词条按仓库规则
同步全部 21 份词典;`src/client/service.ts` 的能力清单新增 `settingPatterns`
并同步 docs/external-plugin-guide.md。

门禁:pnpm typecheck 0;pnpm exec vitest run --maxWorkers=3 全绿
(165 files / 1847 passed / 13 skipped);npx eslint 45 个改动文件 0;
新增与改动的 spec 单跑 154 passed;pnpm build 0。

Refs #264

Co-authored-by: shyuan-hub <311810858+shyuan-hub@users.noreply.github.com>
2026-10-05 02:13:53 +08:00
Menghuan1918andAhdong&Shouey 7cf3d609ff feat(changes): AI commit-message suggestion + push/pull in the git lens
Port PR #434's two Git-panel features onto the current dev structure. The
PR's third commit (file-tree context-menu rename) is dropped: dev already
has it (#550, e39ea92) with a different `fs.rename` payload contract
(`name`, not `newName`) and its own i18n keys, so keeping it would break the
route and duplicate dictionary keys (TS1117).

Why this is a rewrite rather than the PR's diff applied:

- The client carrier moved. `src/client/GitView.tsx` was deleted by 24a3813
  (the unified "changes" tab), so the client half lands in
  `src/client/changes/GitLens.tsx` and follows that file's conventions: the
  bar's single `actionError` status line instead of a second `remoteError`
  channel, `runAction` for the git mutations, the kit's `IconButton`, and the
  host's own `IconSparkleRegular` rather than a new react-icons import.
- The host route could not read `Session.events` at all: it was renamed to
  `snapshotEvents()` in DSH 0.1.2-alpha.4, and 0.2.0-rc.1 marks it `new calls
  are prohibited`. `git.suggest-message` resolves its provider/model from the
  incrementally folded `Session.requestHeader()` — the same `request/header`
  record the PR was after, but O(new events) instead of a full reverse scan.
  `SidebarSessionStore` gains that face; `snapshotEvents()` is marked
  deprecated there.
- Message source is the plugin's own producer kind
  (`plugin:dsh-better-sidebar`, the existing `MessageSourceMap` augmentation):
  a bare `plugin` kind is rejected outright in session format v4.
- The commit row stays where dev put it. PR moved it to the top of the panel
  because it was buried between the two file lists; dev's commit bar is
  already a `position: sticky` footer, so that problem is gone — and
  `changes-tab.spec.tsx` pins the bar's status line to the message row.

Beyond the port, the route reads `assembler.finish` so a provider-side failure
is reported with the provider's own reason instead of "the model returned an
empty message", bounds the call with a 30s deadline, and truncates the diff at
12K characters.

Refs #434

Co-authored-by: Ahdong&Shouey <131278957+LiuStar656@users.noreply.github.com>
2026-10-05 02:11:10 +08:00
Menghuan1918andCold Cloud 194099e7f3 feat(search): fs.search 文件名搜索优先用 fd/rg,缺失/失败回退 JS 遍历
issue #203:十万级目录下纯 JS 递归遍历是秒级,10 万条访问预算一顶结果
还被静默截断。现在启动后惰性探测一次本机 fd / rg(每个候选 `--version`
500ms 内验证通过才算数,进程内缓存),探到就用引擎输出,探不到或运行失败
整段回退原来的遍历(导出为 `searchFilesPlain`);坏二进制在进程内禁用,
超时只降级本次(树大 ≠ 二进制坏)。

为什么按 dev 现状重写而不是机械解冲突(PR #303 的落点全部复核过):

- **#801 的必填 `dirs` 是语义级冲突,必须扩引擎契约**。dev 的
  `FsSearchResult` 多了 `dirs`(`TreePanel` 用它把命中行当目录导航,否则
  `fs.read` 报 “is a directory”),而 PR 的引擎侧只产出
  `{paths, truncated}`,`searchFilesPlain` 的空查询也还在返回两字段形状;
  照搬会让 #801 修的 bug 在引擎路径上静默回退。收口:fd 用第二次
  `--type d` 调用取目录子集(fd 自己不做标注),rg 由文件路径倒推匹配的
  目录段(`deriveRgMatches`),dispatch 再把 `dirs` 收敛成 `matches` 的
  子集。残留差异只有**空目录在 rg 下不可见**(没有文件路径能带上它)。
- **rg 的路径级 glob 补成三个**:PR 的 `**/*<q>*/**` 缺一个直接子文件
  (`util/helper.ts` 是最常见形态),只加 `**` 会让这类目录命中在
  rg-only 机器上凭空消失;`**/*<q>/*` + `**/*<q>/**` 两条并用(对真实
  rg 15 实测:单用任一条都丢结果)。
- **`bundledRgCandidates` 的路径推导按真机布局改写**:npm/pnpm 把
  `@vscode/ripgrep-<platform>-<arch>` 提升到 `@deepseek-ai` 的**同级**,
  不存在 `<root>/@deepseek-ai/dsh/node_modules/@vscode/...`;候选根改成
  「从 CLI 入口(argv[1])向上逐级 `node_modules`」+ 各包管理器全局前缀,
  桌面壳那种「自带依赖树 + 外部 node」的布局才探得到捆绑 rg(实测命中)。
- **丢掉 abort 形参**:`src/index.ts` 的生产路径不传 signal(PR 里也只有
  测试在用),单为测试保留一条贯穿三层的通道不划算;引擎子进程由 15s
  内部超时兜底。
- **文档锚点按 dev 重锚**:README 的 v0.12.3 条目已随发布历史迁到
  CHANGELOG(新增 Unreleased 条目),AGENTS §2 的引擎门禁入口挂到现有
  ci-windows 段落,指南 §14 参考实现行补 `src/search-engines.ts`。
- 未新增任何依赖:`@vscode/ripgrep` 只作为**路径**探测,不做模块导入。

Windows 侧由既有 ci-windows lane 承载:`choco install fd ripgrep` 把真
二进制放进 PATH,套件后 `pnpm check:engines`(`scripts/win-engine-check.mjs
--assert`,import `src/search-engines.ts` 取插件自己的 argv)断言
`--path-separator /` 的输出不含 `\`/CR、非 ASCII 文件名命中;引擎缺失则
跳过(fd 在 ubuntu lane 与多数开发机上都没有)。

测试:`tests/search-engines.spec.ts`(探测缓存 / 运行失败禁用 / 超时不禁
用 / argv 对称性与噪声目录排除 / `deriveRgMatches` / 捆绑 rg 候选推导 /
真引擎在场时的端到端——缺席即返回),`tests/fs-search.spec.ts` 拆成
「直接钉遍历」+「注入假引擎的 dispatch 组」(引擎优先、`dirs` 透传与
子集收敛、预算透传、运行失败回退并禁用)。真机核对:本仓库上 rg 路径与
JS 遍历对 `locales` / `util` / `client` / `src` / `e2e` 五个查询的
matches 与 dirs **逐项一致**。

Refs #303

Co-authored-by: Cold Cloud <64406210+yanzhaohui1999@users.noreply.github.com>
2026-10-05 02:10:45 +08:00
Atlas Zeng 244d7d9fd3 Merge pull request #600 from nyantused-cpun/feat/editor-draft-protection
feat(editor): 未保存草稿保护、保存冲突检测与内置查找替换
2026-10-05 02:01:42 +08:00
Menghuan1918 783ac9feb6 merge #600 into dev(草稿保护/冲突门/替换;删掉与 #587 重复的查找接线与词典键,换掉已删图标名)
贡献者 PR #600(feat/editor-draft-protection,head a14c1e8)以 --no-ff 落到 dev
基线(9b97e6f)。贡献者的提交原样保留,冲突解决体现为本次合并结果。

保留(PR 独有):
- 草稿保护:src/client/editor-dirty.ts(脏稿登记表 + confirmDiscardDraft)、EditorHost
  的登记/卸载清理、Sidebar 的 closeTab 门与 beforeunload、closePathTabs 的确认参数。
- 保存冲突门:fs.read 回报 mtimeMs、fs.write 的 expectedMtimeMs(409 fs-conflict,在写
  临时文件之前判定)、TextEditor 的 mtimeRef + 冲突横幅 + onReload、wire 的
  fs-conflict 码,以及 fs-write-route / text-editor-conflict 两个新 spec。
- 查找/替换入口:TextEditor 工具栏放大镜按钮(打开 #587 的面板;可编辑视图的面板自带
  替换行),文案用 #587 的 searchFind。

删除(与 #587 / 2e22b90 重复的部分):
- TextEditor 里重复的那份查找接线:本地 searchPhrases()、EditorState.phrases.of(...)、
  search({ top: true })、编辑器 keymap 里的 ...searchKeymap,以及 search / searchKeymap
  两个 import——#587 的 src/client/cm-search.ts 已提供同一套(面板、keymap、phrases 隔间、
  令牌主题)。
- 20 份词典里被 #587 取代的 10 个键:find / replace / findNext / findPrevious / findAll /
  findMatchCase / findRegexp / findByWord / replaceOne / replaceAll(命名以先落的 #587 为准:
  searchFind / searchReplace / searchNext / searchPrevious / searchAll / searchMatchCase /
  searchWholeWord / searchRegexp / searchReplaceAll)。
- src/index.ts 里已被 2e22b90 覆盖的临时文件改名(.dsh-write-<uuid>):保留 dev 的
  .dsh-sidebar-tmp-<uuid>,tests/fs-write-route.spec.ts 的残留断言改指 dev 命名。
- tests/text-editor-search.spec.tsx 中与 editor-find.spec.tsx 重复的三个用例(en/zh 文案、
  Mod-f),只留「工具栏按钮开面板并切到编辑态」这一个独有用例。
- README / README_EN / 指南里未实现的 Ctrl/Cmd + H 声明(PR 从未绑定 Mod-h,且浏览器保留
  该组合键),改为如实描述「Ctrl/Cmd + F 的面板含替换行」,并补上 #587 已支持的
  Ctrl/Cmd + G / Shift + Ctrl/Cmd + G / Ctrl/Cmd + D。

其它解冲突取舍(dev 上下文已漂移,不复活 PR 基线代码):
- 图标:IconSearchOutline16 在宿主图标整族改名后已不存在,换为 IconSearchOutlineRegular
  size={16}(显式尺寸;旧 16 后缀已删,不传会按新默认尺寸)。
- 采纳 dev 侧:fs.read 的 ensureWorkspacePath 两参调用、truncation 横幅不带 mode 条件、
  fs.write 的编码探测与 invalidateDirectoryCache、Sidebar 的 closeTab 里 PR 基线的终端
  pty 释放块(dev 已移走)与 summaryCwd/pushedBottomHeight/collapsed 块(dev 已删)。
- 测试 harness 跟随 dev:ctx.sidebarRight.mounted、bottomSplits、先打开底部工作台、
  apply() 需要的 ctx.on、api 模块改为部分 mock(保留 sessionPhase / sessionCwd)。
- 取舍记录写入 docs/plans/2026-09-09-editor-draft-protection-design.md。

Refs #600
2026-10-05 01:58:18 +08:00
Menghuan1918 9c8d5c62ed merge #574 into dev(工作区提及重放到 reference-in-chat 新载体,复用 mentionFor)
冲突是载体搬迁,不是语义作废:

- `@` 回调的载体在 dev 已是 src/client/reference-in-chat.ts(#479 eed2fee 抽出的
  两侧共享入口)。PR 新增的 `insertWorkspaceReference` 与 `directoryMention`
  落在 conversation-draft.ts(它要用同模块的 appendToDraft /
  insertFileReference / mentionFor),由该入口转发;Sidebar.tsx 只保留转发,
  native/tab-adapter.tsx 与之同步,两个调用点不再传 cwd(工作区 root 由
  `ctx.get('workspaces')` 的会话成员匹配得到,不再回退会话 cwd)。
- PR 的 `directoryMention` 改为委托 dev 的共用构造器 `mentionFor(path, 'folder')`
  (#479 把「尾斜杠进引号」的规则收进它),不再自建一套引号规则;
  `insertWorkspaceReference` 的文件分支同样换成 `mentionFor(path, 'file')`。
- tests/paths.spec.ts:`resolveSidebarPath` 的导入走已搬迁的 src/client/paths.ts
  (produced-files.ts 已不存在),并存的 preview URL 用例与 workspaceRelativePath
  用例两块都保留。
- tests/reference-in-chat.spec.ts(#479 验收 spec):fake ctx 补上它现在要读的
  workspaces 面、调用点去掉 cwd,三处草稿断言跟随本 PR 的目录尾随分隔空格;
  引号与宿主 token 可读性的断言逐字未动。

Refs #574
2026-10-05 01:55:36 +08:00
Atlas Zeng d694b868b9 Merge pull request #828 from yanzhaohui1999/fix/826-file-link-line-suffix
fix(editor): 正文里 `[path](path:131)` 的链接去掉行号后缀再打开(#826 第一半)
2026-10-05 01:38:18 +08:00
Menghuan1918 eed2fee0e6 fix(client): 含空格的目录 @ 引用补引号,让宿主能识别成 folder(#479)
宿主的两处 token 读取都只认「引号闭合」的目录写法:
`FOLDER_REF_RE`(dsh-client-ui-conversation)的引号分支是 `@"[^"\n]*\/`,
消息气泡的 `@"[^"\n]+"` 也只在闭合时才把 token 判成 folder;而插件目录分支
原先直接拼 `@${rel}/`,含空格目录 `@my dir/` 在补全扫描里完全不命中、在气泡里
退化成只覆盖 `my` 的 file 芯片——文件分支经 fileMention 加引号,目录分支没有,
同一套引号规则被写了两遍,只有一份对。

把「构造 mention 字面量」抽成 conversation-draft.ts 的共用纯函数
`mentionFor(path, kind)`(fileMention 并入,两个调用点:insertFileReference 与
referenceInChat 的目录分支),沿用原有的控制字符/引号拒绝守卫;目录的尾斜杠拼在
引号内侧(`@"my dir/"`)。宿主自己的选择器在补全途中发的是开引号形式
(`@"my dir/`),那是未完成的补全态、气泡里同样判成 file;本插件的动作插入的是
一条完成的引用,所以闭合引号。

行为不变:无空格目录仍是 `@docs/`、cwd 仍是 `@./`、无空格文件仍是 `@notes.md`,
文件分支的引号与 chip 路径逐字未动。宿主 FOLDER_REF_RE 仍能读到 `@"my dir/`
(闭合引号落在 token 之外),文件夹补全不受影响。

验证:pnpm typecheck(exit 0);pnpm exec vitest run --maxWorkers=3(151 files /
1678 passed / 13 skipped);npx eslint 四个改动文件(exit 0)。
tests/reference-in-chat.spec.ts 把目录分支回退到旧写法后 2/7 红(草稿变成
`@my dir/`、守卫路径重新写入不可表示路径)。guide §4.2 的 onReferenceFile 说明
同步引号形式。

Refs #479
2026-10-05 01:31:29 +08:00
Menghuan1918 582f814d5e merge #828 into dev(fileParamsOf 剥掉 path:line 行号后缀,解上下文冲突)
贡献者 PR #828(fix/826-file-link-line-suffix,2c5b762)修 issue #826:
宿主 markdown 语法只认 `#L131`,`path:131` 会被 parseFileLink 整串当文件名,
editor tab 于是去读一个叫 `CMakeLists.txt:131` 的文件并报「文件不存在」。
改法是在插件唯一把文件地址转成合成记录的那一步(native/index.ts 的
fileParamsOf)切掉尾部行号规格,tab 标题同源修正;新增纯函数
src/client/path-line.ts 与 tests/path-line.spec.ts。

解冲突:只有 tests/native-surface.spec.ts 的第 9 行 import 块冲突。
dev 侧多了 `import { createNativeSurface } from '../src/client/native/surface.ts'`
(PR #696 移植),PR 侧把同一行改成 `import { fileParamsOf, registerNativeSurface }`。
两边都要,合为两行;docs/external-plugin-guide.md 由 git 三方合并自动解掉
(PR 新增的「地址里的行号(#826)」行与 dev 新增的「文件打开的认领判定」行并存)。
未改贡献者任何实现意图,未 rebase / squash 其提交。

Refs #828
2026-10-05 01:30:34 +08:00
Atlas Zeng 00801f5289 Merge pull request #818 from btsd321/feat/tabbar-right-actions
feat(tabbar): 新增 TabDescriptor.rightActions,活跃 tab 可注入 tab 栏右侧操作区
2026-10-05 00:54:50 +08:00
Atlas Zeng 40f0255ad0 Merge pull request #807 from graydovee/fix/blank-session-bottom-entry
fix(client): 空白新会话里恢复「打开底部工作台」入口(#698 / #623)
2026-10-05 00:53:27 +08:00
Menghuan1918 7ddf99cb94 feat(skill): issue/PR 分诊与排队 skill(.agents/skills/issue-triage)
把这次 190 条 issue 全量分诊 + 排期看板落地的做法沉淀成仓库级 skill:

- `SKILL.md`:五阶段流程(快照 → 分类 → 判动作 → 同步看板 → 落档)+ 交付前检查表;
  写死了两条容易返工的纪律:已有优先级标签默认保留、优先级只降不升(要升先说)。
- `references/taxonomy.md`:类型/领域/优先级/批次/Status 口径与看板身份;
  「人工提入 R1 的 P2」只有一份机器可读来源(`promoted.json`),避免标签与名单两套真相。
- `references/gh-gotchas.md`:Projects v2 的实测坑——`project` scope 必须人工授权、
  组织项目可见性只有 owner 能改(连 `public:false` 空写都 FORBIDDEN)、视图分组不在公开 API、
  `updateProjectV2Field` 的选项是整体替换(会清值,必须重写一遍)、
  `gh project item-list` 的非 ASCII 键乱码、嵌套连接 50 万节点上限、条目不随 issue 关闭移除。
- `scripts/snapshot.mjs`:open issue/PR 快照 + 「是不是已经修了」的线索(提交 / 文件 / 提及),
  输出 `digest.md` 供人读;只读,不写 GitHub。
- `scripts/board-sync.mjs`:按**名字**解析项目/字段/选项,幂等加条目与写字段值(issue 按标签算优先级、
  PR 从它引用的仍开着的 issue 继承),`--dry-run` 看计划、`--verify` 回读断言(缺失 / 不一致 / 一 issue 多 P 标签)。
- `docs/plans/2026-10-04-issue-triage.md`:首次执行的完整记录(skill 的示例输出,含关闭理由与复核证据)。
- `AGENTS.md` §6 增加 skill 入口。

验证:在本仓库真实看板上跑通——`--dry-run` 与实跑各一次(+ #841 / #842 / #843,207 条目,字段写入 5 次),
`--verify` 输出 `missing=0 mismatched=0 multi-P-label=0 → OK`;多出的 1 条是已关闭的 PR #761,属预期(条目不随关闭移除)。
2026-10-05 00:17:08 +08:00
ymac 2c5b7621dd fix(editor): 正文里 [path](path:131) 的链接去掉行号后缀再打开 (#826)
DSH 的 markdown 链接语法只认 GitHub 的 `#L131` 片段:目的地没有 `#` 时
`parseFileLink` 把整串当文件名返回。于是模型按编译器诊断的通用写法输出的
`[a/b.c](a/b.c:131)` 变成一次对 `b.c:131` 的文件打开,编辑器读不到、右侧栏
红字报「文件不存在」。

宿主源码不可改,纠正放在插件唯一把文件地址变成合成记录的那一步
(native/index.ts 的 fileParamsOf):尾部行号规格(`:行` / `:起-止` /
`:行:列`)在这里切掉,tab 标题按切完的文件名给(宿主用同一个字符串推导标题,
否则芯片上会写 `b.c:131`)。切完之后读、写、"打开方式"、去重、viewer 匹配
拿到的都是真实路径,所以没有需要重试或记住的状态。

切分规则与宿主的 `#L` 语法对齐:1 起、无前导零、锚在串尾(`data:2024.csv`
和盘符 `C:` 因此原样通过),并拒绝空前缀、只剩一个字符的前缀(`C:131`)和
倒序区间(`a.c:20-12`)。

取舍:从聊天链接打开一个真名以 `:数字` 结尾的文件会丢掉后缀。文件树 / 搜索 /
插件自有流程的路径不经过这一步(只有 `openResource` 的地址会),而 `:` 在
Windows 上本就不是合法文件名字符。

测试:新增 tests/path-line.spec.ts(9 例,含全部「必须原样通过」的反例);
tests/native-surface.spec.ts 补 fileParamsOf 四例 + editor 类型对带行号地址的
标题。typecheck / lint 全绿;全量 1503 passed,tests/locales.spec.ts 的 ja
词典缺 key 在干净 origin/main 上同样失败(既有问题,不在本 PR 范围)。
2026-10-01 22:05:56 +08:00
HuanLinOTO 84d89067d4 Merge PR #696 (ported): fix(editor): 打开文件先问原生 tab 注册表,被认领的类型不再被硬编码 editor 顶掉(移植到 sidebar-file.ts 新载体,Fixes #695 #643)
# Conflicts:
#	src/client/EditorHost.tsx
2026-10-01 17:22:00 +08:00
HuanLinOTO 56567b3c4d fix(editor): 打开文件先问原生 tab 注册表,被认领的类型不再被硬编码 editor 顶掉(#696 移植到 sidebar-file.ts 新载体,Fixes #695 #643) 2026-10-01 17:21:10 +08:00
HuanLinOTO 8c37a7e7df Merge PR #663: fix(sidechat): clear the child inbox after create — fork markers alone do not fence the runtime inbox
# Conflicts:
#	AGENTS.md
#	tests/sidechat-seed-validation.spec.ts
2026-10-01 17:17:57 +08:00
HuanLinOTO 86ec5ccc75 Merge PR #736: fix(native): focus through the controller on surface.activate; carry meta on close
# Conflicts:
#	docs/external-plugin-guide.md
#	src/client/native/surface.ts
#	src/client/service.ts
2026-10-01 17:12:53 +08:00
HuanLinOTO 92ab1f83b8 Merge PR #776: fix(native): 按会话记账 + 宿主 keepMounted,原生 tab 状态不再跨切换丢失(#636 #661)
# Conflicts:
#	src/client/native/index.ts
#	src/client/native/tab-adapter.tsx
2026-10-01 17:12:10 +08:00
HuanLinOTO b47fb12457 Merge PR #652: fix(state): contain a throwing store listener instead of blanking the sidebar 2026-10-01 17:08:18 +08:00
ymac 0a83d671e5 docs: the post-merge division of labour for native tab state
Merging main moved the expansion set into the plugin store's session state
(`5c95002`: `attachStore` / `syncExpanded` / `getSessionStates().expanded`), which
was this branch's other half. Record the split so the next reader does not try to
keep two authorities: the STORE owns the expansion set, the RECORD owns identity
(`sessionId::tabId`) and lifetime (no `drop` on unmount), and `keepMounted` is
what makes both survive a tab or Conversation switch.

- `AGENTS.md` §3.4 item 9: three facts instead of two — (c) is the store authority.
- `docs/plans/2026-09-25-…md`: the merge note, plus the earlier attribution note
  that the `FILES_KIND` guard came from #777.
2026-10-01 16:47:43 +08:00
ymac d1c8208d56 Merge origin/main (v0.24.1, DSH 0.2.0-rc.1) into fix/native-tab-state-retention
Two conflicts, both in the native tab adapter's per-session work — main's
`5c95002` moved the expansion set into the plugin store's session state while
this branch moved the RECORD identity to `sessionId::tabId`:

- `src/client/native/tab-adapter.tsx`: keep main's store-backed expansion as
  the authority (`attachStore` / `syncExpanded` / `getSessionStates().expanded`)
  and this branch's seat-scoped identity (`views` keyed `sessionId::tabId`,
  `get/has/update/drop/versionOf/retain` take the seat session). `toggleExpanded`
  keeps main's active-`reduce` / background-`reduceFor` split, but locates the
  record by its seat and writes the SCOPE session's set — the set every view of
  that session mirrors.
- `tests/native-surface.spec.ts`: main's five expansion cases adapted to the
  session-scoped API (seat session on `ensure`, two-arg `get`/`drop`, seat on
  `toggleExpanded`); the branch's cases now bind a store before toggling, since
  expansion no longer lives in the record itself.

The `files` takeover guard and its registration invariants come from
main; this merge drops the branch's duplicate.
2026-10-01 16:37:35 +08:00
HuanLinOTO 8c17648962 fix(tabbar): rightActions 按 review 修复 + 回归测试
逐条解决 Copilot review 的 6 条 findings:

1. 空结果不挂载 wrapper:TabBar 先解析 rightActions 节点,
   null/undefined/false 直接不渲染容器(空容器是 flex item,
   会改变所有既有 tab 栏的布局)。
2. resolver 传入 tab/paneId:签名扩为
   (ctx, scope, state, tab, paneId)——single:false 且有分栏时同一类型
   可同时开多个实例、每个 pane 各渲染自己的 tab 栏,工具栏操作必须
   能定位到正确实例;paneId 与 state.activePane 比较可知聚焦 pane。
   API 未发布(本 PR 新增),签名可直接演进。
3. CSS 不再等分:.tabBarRightActions 由 flex:1 改为 0 1 auto
   (内容定宽、可收缩裁切),.tabList 独占剩余空间——等分会让
   极小的工具栏砍掉 tab 滚动区一半宽度。
4. split 递归转发:NodeView 的递归调用补上 getTabRightActions
   (此前 bottomSplits 一旦是 split,所有子 pane 的 resolver
   全部丢失,工具栏静默不渲染)。
5. 指南 §7 canonical features 清单补 'rightActions'。
6. 新增 tests/tab-bar-right-actions.spec.tsx(5 用例):节点渲染
   位置与参数、跟随活跃 tab、null/无 resolver 不挂载、嵌套 split
   树逐 pane 转发(已做变异验证:删掉递归转发该用例即红)。
2026-10-01 16:03:14 +08:00
xlli67 bb0c4649c8 docs: 注释去掉终端插件举例,保持通用接口描述 2026-09-30 13:13:42 +08:00
xlli67 679889d8a9 feat(tabbar): 新增 TabDescriptor.rightActions,活跃 tab 可注入 tab 栏右侧操作区
TabBar 新增 getTabRightActions prop,活跃 tab 的 descriptor 声明 rightActions
时,返回的 ReactNode 渲染在 tab 栏右端(+ 按钮右侧、面板关闭按钮左侧,
右对齐)。让 tab 把自己的工具栏(如终端 tab 的新建 / 拆分 / 重启)直接放进
tab 栏,而不是在内容区顶部再单独渲染一行头部。

TabDescriptor.rightActions 与 badge 同签名 (ctx, scope, state) => ReactNode,
抛错被吞掉(不渲染操作),每次活跃 tab 渲染调用——保持廉价。

文档同步:docs/external-plugin-guide.md §4.1 TabDescriptor 字段。
2026-09-30 13:00:28 +08:00
graydovee 78a7dbd272 fix(client): 空白新会话里恢复「打开底部工作台」入口(#698 / #623)
0.2.0-rc.1 实测:空白会话里宿主仍渲染会话头,但只渲染 leading + corner(宿主自己的
「Open right sidebar」按钮);header.utilities / header.actions 两个槽不渲染,插件挂在
utilities 上的底部工作台开关随之不可达。

- 判定来源不用 DOM 探测:host 半区新增只读路由 session.phase,读
  ctx.sessions.get(id).snapshotEvents(),按宿主会话列表投影同一规则判定 blank
  (无 user/message 与 assistant/message)。
- 客户端 useSessionPhase(sessionId):挂载/会话切换取一次;blank 期间每 1s 轮询;
  发出第一条消息即翻转停止。路由/宿主不支持时按非 blank 降级。
- 备用入口放在 conversation.composer.dock(list 槽,blank 态渲染且为空;hero 行的
  workspace 槽是 single 且被宿主 WorkspacePicker 占用,实测抢占会使客户端条目激活失败,
  不用)。仅在 blank 相位渲染,因此与会话头里的入口天然互斥、恒定一套。
- 备用按钮 position:fixed,按宿主「Open right sidebar」按钮的 rect 对齐到其左侧紧邻
  (随 resize 与 500ms 周期重对齐),经 portal 到 document.body(z 40:高于 AppFrame(20)
  与会话头、低于浮层 100+),否则会被会话头 titleRow 拦截点击(实测)。
- mount / perf 的入口断言从「attached 恰好 1 个」升级为「可见的第一个可 attached/点击」:
  宿主会为每个保留会话渲染隐藏的会话头副本(transform 移出视口、rect 仍在),节点计数
  会把副本算进去;「屏幕内恰好 1 个」的强不变量由新增用例的 on-screen 计数负责。
- 单测 tests/dock-fallback.spec.tsx(4 条,mock session.phase):blank 渲染且点击写 store;
  非 blank 不渲染;相位未到达不渲染;路由不可用降级。
- 部署级 tests/e2e/blank-session-dock-entry.e2e.ts:空白会话入口可见可点、宿主侧边栏按钮
  仍在旁、屏幕内恒定一套;发消息后退场、入口回会话头;无 console/pageerror。
- docs/plans/2026-09-29-blank-session-dock-entry.md:根因、实测、排除方案、判据。
2026-09-29 17:54:53 +08:00
Menghuan1918 0ac62b3a49 Merge origin/main (v0.22.1 与三个热修 PR) into feat/files-changes-uiux
冲突面 11 个文件,逐项裁决如下:

1. src/client/native/index.ts —— **取 main 版**。main 的 v0.22.1 在同一处做了更强的修复
   (清理循环同样跳过 FILES_KIND,另加 `disposeSafely` 与「注册失败必须回滚已占用 id /
   已建槽位」),是我们那行守卫的超集。
   ⚠️ 但 main 分支从来没有过我们 task-19 的 `records.attachStore(store)` 调用,整文件
   采用会**静默丢掉**它(records 拿不到 store → `toggleExpanded` 直接 return → 点目录
   树毫无反应),且 jsdom 单测看不见(它们自己绑 records)。已按原注释恢复该调用,并在
   注释里记下这次合并教训。真实宿主 lane 证明:恢复前 `zz-expand-refresh` 红(请求为
   空、`big` 不展开),恢复后 9/9 全绿。
2. package.json / dsh.plugin.json / src/client/service.ts —— 版本相关冲突取我们的
   0.24.1(支持线 ^0.2.0-rc.1 不变)。
3. CHANGELOG / README(中英各一)—— 双方版本节全部保留:我们的 v0.24.1 / v0.24.0 +
   **新增缺失的 v0.23.0 节**(开发线,内容随 v0.24.1 发布)+ main 的 v0.22.1。
   同时修正两处事实错误:① 「0.1.7 线请固定 v0.23.0」→ **v0.22.1**(0.23.0 从未发布);
   ② 安装对照表里 0.1.7 行的安装命令同改。README 并补上 v0.23.0 摘要(含 ⚠️ 删除工作区
   路径检测这一安全相关的行为变更)。
4. docs/external-plugin-guide.md —— 版本行取我们的(0.2.0 线)。

验证(合并后的树):pnpm typecheck / lint / test = **137 文件 / 1491 通过 / 9 跳过**
(含 main 新增的 native-registration.spec.ts);pnpm build ✓;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = **9/9**
(mount 5 + perf 2 + main 的 native-reload 1 + 我们的 zz-expand-refresh 1)。
2026-09-28 23:13:36 +08:00
Menghuan1918 b7825e1bd0 docs(dsh): 记录 profile overrides 必须与宿主同批抬版本的坑(0.2.0 升级实测)
升级 3080 后出现「加载提供商目录失败: settings service is absent」,根因是 profile 的
pnpm-workspace.yaml 里上一轮留下的 overrides '@deepseek-ai/dsh-settings': 0.1.7-rc.2——
它让 profile 顶层留住 0.1.7-rc.2 的 dsh-settings,后者用精确版本拉来 dsh-config-editor
0.1.7-rc.2 并遮蔽 bundle 自带的 0.2.0-rc.1,于是 0.2.0 的启动预检禁用 config-editor 行,
settings 行永远 pending (waiting for service: configEditor)。

已修:override 抬到 0.2.0-rc.1(profile 顶层全部收敛到 0.2.0-rc.1,.pnpm 里 0.1.7 副本归零)。
文档:适配记录新增 §5.1(含原始日志证据),AGENTS §3.0 增加「用户 profile 自己的 pin 也要
同批抬」一条。
2026-09-28 21:38:58 +08:00
Menghuan1918 b91675ae61 feat(dsh): 适配 DSH 0.2.0-rc.1(单线支持)+ v0.24.0
支持线从 ^0.1.7-rc.1 整体前移到 ^0.2.0-rc.1;0.1.7 线(含 npm latest 的
0.1.7-rc.2)停留在 v0.23.0。适配前实测确认这是纯增量,故本版无运行时兼容分支。

必改项(否则装不上/不加载)
- 14 条 DSH peer → ^0.2.0-rc.1。实测 caret 跨 minor 不成立:`^0.1.7-rc.1`
  展开为 >=0.1.7-rc.1 <0.2.0-0,对 0.2.0-rc.1 判定 false(includePrerelease
  也救不了)。判别性验证:把 peer 回退成 ^0.1.7-rc.1 后,在 0.2.0-rc.1 宿主上
  `dsh plugin add` 直接拒绝并回滚包树——
  "installation rejected: Plugin dsh-better-sidebar@0.24.0 is incompatible with
   dsh 0.2.0-rc.1: peerDependencies {…^0.1.7-rc.1…}";恢复 ^0.2.0-rc.1 后安装通过
- 28 个 @deepseek-ai/* devDependencies 精确钉 0.2.0-rc.1(cordis 4.0.4 /
  cordis-plugin-group 1.0.4 / cordis-plugin-include 1.0.9 不变)
- 新增 @deepseek-ai/dsh-util-code-language@0.2.0-rc.1:0.2.0 的 ui-primitives
  产物裸 import 它(0.1.7 的产物同样 import,只是旧树里恰好被传递提供),
  不补则所有加载 ui-primitives 的 20 个 spec 在收集期失败

实测证据(写进 docs/plans/2026-09-28-dsh-0.2.0-rc.1-adaptation.md)
- 本插件消费的 19 个宿主包零值导出删除(对比 export {} / exports.x=)
- 类型面仅 3 处且全为增量:ui-primitives(DisclosureRow/TextShimmer/Tooltip
  新增可选 prop、overlay 顶部内距)、dsh-session(新增 ToolCallRecovery)、
  dsh-api-remotes(新增 product-analytics remote)
- 会话格式仍 v4、SUBAGENT_DESCRIPTOR_VERSION 仍 3、dsh/lib/bin.js 与
  dsh-client-modules 运行时逐字节相同、web profile 客户端 inject 列表相同、
  ui-primitives 裸 import 集合不变、agent-team 四包类型逐字相同
- 宿主 web profile:新增 desktop-only product-analytics/telemetry(web 上
  disabled);time-context/schedule/ui-schedule(本就 disabled)移入可选
  dsh-experimental-schedule-bundle;插件不依赖宿主 schedule

其余同步
- CI 与挂载 lane 钉 @deepseek-ai/dsh@0.2.0-rc.1(scripts/e2e-common.sh 的
  DSH_NPX_SPEC/DSH_EXPECT_VERSION、ci.yml),注释记下「0.2.0 首个候选版只挂
  next」与「caret 跨 minor 必失效」两条教训
- tests/market-manifest.spec.ts 的 peer 形状断言钉当前基线 tuple
- dsh.plugin.json engines.dsh → >=0.2.0-rc.1;SIDEBAR_SERVICE_VERSION → 0.24.0
- README/README_EN、CHANGELOG/CHANGELOG_EN、AGENTS.md(§2 钉版句 + §3 改为
  「DSH 版本适配要点」并新增 §3.0 当前基线,0.1.7 内容降为历史分节)、
  docs/external-plugin-guide.md 全部同步

验证:pnpm peers check 仅剩上游 better-locale 的 5 条 unmet(非本插件 peer);
typecheck / lint / test(136 文件 1484 通过 9 跳过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = 7/7;
pnpm test:mount:aggregate 通过(聚合双挂载退让)
2026-09-28 21:21:45 +08:00
Menghuan1918 5c95002641 perf(sidebar): fs.tree 22.8ms→3.8ms + 删除工作区路径检测(放开权限)+ 树展开状态按会话
用户实测反馈:

1) `/sidebar/api/fs.tree` 性能极差 —— 先测后改(10k 条目目录、热缓存、中位数):
   - 冷调用 cap=1000:22.76ms → **3.77ms**;TTL 内重复:≈23ms → **0.000ms**
   - 改法:opendir for-await → readdir(withFileTypes) 一次取回;只为 cap 条建行
     (slice + 定长数组);路径用字符串拼接而非 path.join;排序弃 localeCompare
     (14.6ms/10k → 0.35ms)改小写比较 + 原名码点兜底;新增 1.5s 目录级缓存
     (键 绝对路径\0cap,上限 512),由 fs.write/rename/remove/mkdir/upload 与
     fs-watch 的变更通知显式失效
   - 契约逐字不变;新增 tests/fs-tree.spec.ts 6 例 + fs-watch 失效用例(判别性验证)

2) 删除工作区路径检测(默认不检测、放开权限):
   - path-security 变纯词法解析(realpath/包含性判定删除)、fs-operations 去 fence
     分支、所有 fs 路由不再读 fence、403 分支消失、config 删 workspaceFence 字段
     (schemastery 容忍未知键,旧 profile 不会加载失败)、settings 开关删除
   - ⚠️ 安全影响:插件 fs 路由(tree/read/write/rename/remove/mkdir/媒体/HTML/
     upload/archive)现在可读写宿主用户可访问的任意路径,只受 OS 权限约束;
     指南 §8.1 已加醒目声明
   - 死代码清理:FenceErrorNotice 组件 + EditorHost 分支 + 4 个词条(settingsFence*、
     fenceErrorReason、fenceDisableAction)+ isOutsideWorkspace* 助手 + TreePanel 的
     store prop + 相关 CSS 块

3) 批量列举路由 `fs.trees`(单层失败只在该层带 error)+ 客户端批量加载:
   挂载/刷新时的 N+1 请求变为 1 个(8 个展开目录:9 → 1,探针断言)
   refreshTick 不再先清缓存(旧行保留到新答案;失败保留旧行 + warn 提示)

4) 修复「关闭文件后返回文件树,展开状态被重置」:
   原生承载面的展开集合原来存在每个 tab 的记录里(drop 即丢),改为**每会话状态**
   的投影(ensure 从会话态读、toggleExpanded 写回会话态、registerNativeSurface 用
   attachStore 订阅);同一会话多 tab 共享、不同会话隔离;revealed 保持 per-tab

验证:typecheck / lint / test(136 文件 / 1484 通过 / 9 跳过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
版本镜像同步(dsh.plugin.json + SIDEBAR_SERVICE_VERSION)
2026-09-28 20:37:56 +08:00
Menghuan1918 ee1fe05067 feat(sidebar): 菜单层级/性能 + 选中条吸底 + 打包进度 + 修复「在侧边打开」
用户实测反馈 5 条:

1) 文件列表性能 / 右键菜单不再刷屏(先测量后改,探针 tests/file-tree-menu-perf.spec.tsx)
   - 宿主应用列表按路径缓存:N 次打开菜单只请求 1 次(原每次 1 次 + Loading 帧)
   - 行上的 git 数据改为原始值(tone/letter):共享 store 每次轮询重建对象不再触达行
     (探针:开窗 folderIcons 4 → 0;root 行也 memo 化)
   - 菜单开关不触发目录重列(fsTree=0);实测「菜单打开期间暂停轮询」会让变更行瞬时
     掉色并多两次重渲染,故按测量结果放弃该做法(数字与理由写进探针注释)

2) 「已选择 N 项」条移到底部:滚动容器最后一个内容子节点 + sticky bottom(不遮最后
   一行),窄栏 flex-wrap 换行不出横向滚动条

3) 菜单层级重构:一级只留默认动作(宿主默认应用 / 打开方式 ▸ / 在文件管理器中显示 /
   新 Tab / 在侧边打开 / 下载 / 压缩并下载 / 复制路径 / 重命名 / 删除;目录行另有
   新建文件夹、上传到此处),应用列表整体收进「打开方式」子菜单;宿主探测到本机关联
   应用时默认不显示插件自研 open-with 项目,新增设置开关 openWithPluginTargets
   (editor descriptor 的 pluginToggles)可强制并存;宿主不可用时插件项目照旧

4) 压缩并下载显示进度:宿主改为可观测任务(archive.build / archive.status /
   /sidebar/archive?id=,4 并发 + 5 分钟 TTL + sessionId 绑定,buildZip 逐条目
   onProgress),客户端轮询 250ms 显示「正在打包 done/total · N%」,ready 后 blob 下载,
   失败进 zipFailed

5) 修复「在侧边打开没有效果」:根因是它只写插件底部工作台(原生右侧栏的 tab 不在
   bottomSplits 里),现按承载面分流 —— 原生 tab 走 service.openTab(target:'side') →
   宿主 openResource(preferNewPane, revealIfOpened:false) 真正分栏;底部工作台行为不变
   (接入 API 变更已同步 docs/external-plugin-guide.md)

验证:typecheck / lint / test(135 文件 1461 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
新增/更新测试:menu-perf(3)、archive(10)、open-in-app(18)、open-with(10)、multiselect(9)、
zip(37)、service(64)、editor-host(11)、builtins(23)、locales(20)
2026-09-28 20:11:46 +08:00
Menghuan1918 13d4bae321 fix(sidebar): 二轮独立验证的 9 项缺陷 + 目录级暂存
verifier 二轮报告(F1–F9)全部修复,每条都有「临时回退即变红」的判别性验证:

- F1【高】中文等非 latin1 下载名 → 真实宿主 500:content-disposition 改用
  RFC 5987(ASCII 回退 + filename*=UTF-8'');补真 node:http 用例与根因对照断言
- F2【中】多选同名文件归档重名(解压互相覆盖):冲突项逐级上溯父目录消歧
- F3【中低】maxBytes 在读完之后才判定;budget<=0 的 0 字节 FIFO 会永久阻塞:
  改为先 stat、读取前拒绝(FIFO 探针验证)
- F4【中低】SSH 模式 + 宿主不可用时 reveal 整条消失:保留 kind==='reveal' 目标
- F5【低】图钉嵌套交互语义非法且键盘不可达:改为诚实的鼠标热区,键盘入口归设置面板
- F6【低】变更树空闲 tick 全量重渲染:行 memo + 恒定 props + 内容键派生 +
  共享 store 的 sameStatus 保住快照身份
- F7【低】排序随运行时 locale 漂移:显式 'en' collation + 码点兜底
- F8【低】POSIX 文件名的反斜杠被当成层级:不再替换
- F9【低】打包中重复点击静默、无反馈:busy 行(role=status)+ in-flight 守卫
- 新增:目录行「暂存/取消暂存该目录」(git pathspec 语义,不触发折叠)

验证:typecheck / lint / test(134 文件 1441 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过
2026-09-28 18:20:08 +08:00
Menghuan1918 b011be1e98 feat(sidebar): 打开方式双源并存 + 多选压缩下载 + 文件变动层级树
用户追加三条需求,全部落地:

1) 打开方式 = 宿主探测应用 + 插件自研 open-with(并存)
- 逐字恢复 src/client/open-with.ts / open-with-settings.tsx / plugin-settings.ts /
  src/open-external.ts / open.external 路由 / api.openExternal / editor descriptor
  的 settings.render,以及 20 个 openWith* 词条(19 份词典从 main 取回原文)
- 恢复 menu-flip.ts + layout.css 子菜单翻转规则(子菜单回来了)
- FileTree 菜单段(无标题行):宿主行 → 分隔线 → 插件 pinned + 「在应用中打开 >」
  子菜单(图钉 / SSH 后缀原样)→ 分隔线 → 宿主 reveal;宿主可用时过滤插件
  explorer 目标,宿主不可用时插件行照旧(SSH 远端场景保持可用)
- 死键清理:菜单去掉标题行后 openInApp 词条无引用,已从 21 份词典删除

2) 文件页多选右键「压缩并打包下载」
- 新增 src/zip.ts(自研 ZIP:方法 0/8 按收益二选一、UTF-8 bit 11、目录条目、
  自实现 CRC32、无第三方依赖)+ src/archive-route.ts(名净化 + 递归收集)+
  GET /sidebar/archive(同一道 workspace fence、目录递归跳过符号链接、
  10000 条目 / 256 MiB 上限)+ api.archiveUrl
- FileTree:多选 ≥2 项或单选目录时出现;fetch → blob → objectURL 下载,
  路由错误(超限 / fence / 非 GET)以 zipFailed 显示在错误条
- 修掉真实缺陷:central directory 只写 MS-DOS 位而 version-made-by 声称 Unix,
  Info-ZIP 会把每个文件解成 mode 000;改为 Unix 语义(0o100644 * 0x10000,
  << 16 会溢出 int32)。系统 unzip 复验:mode 644/755、unzip -t 无错

3) 文件变动页层级树 + 视觉打磨
- 新增 src/client/changes/change-tree.ts:单子目录链压缩成一行、目录先于文件、
  大小写不敏感排序、文件带 GitFileStatus、目录带下级变更数
- GitLens 两组各自渲染树:折叠状态按「组+路径」独立、默认展开;分组头吸顶 +
  计数胶囊;Stage all/Unstage all 改为带 aria-label 的 IconButton;选中 =
  interactive-bg-active + 2px 内嵌强调条;12px/级缩进 + l1 参考线;
  历史行 hash 徽标 / ref 胶囊 / 作者·时间右对齐

验证:typecheck / lint / test(134 文件 1422 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
真实宿主截图确认三条需求(多选+双源菜单+zip 项、变动页树形层级)
2026-09-28 18:08:21 +08:00
gyixuan bc1c6be747 test(native): pin activate-focus and close-meta; document the native lifecycle
- five cases over the real createNativeSurface: activate rides
  ISidebarRight.focus for a known record (and stays a no-op for unknown
  ids), close hands the record meta back and rides the on-screen face
  for the mounted session (per-session face otherwise)
- one service-level case: closeTab hands the native close meta through
  to descriptor.onClose
- guide: activateTab's native path (focus via ISidebarRight.focus,
  dsh >= 0.1.5) and the close-meta carry, including the standing gap
  that a user-initiated x-close never reaches onClose
2026-09-28 14:38:12 +08:00
Menghuan1918 a18e0f000d docs(release): 修正 v0.22.1 条目里的测试计数与「3/3」措辞(独立 review 发现)
- 单测计数:`122 files / 1292 passed / 9 skipped` → **1293**。1292 是 #785 当时的数字,
  本 commit 自己的 `make check` 两次都报 1293(`tests/` 与 main 逐字相同,122 个 spec +
  `it.each` 展开 = 1293)。涉及 CHANGELOG.md / CHANGELOG_EN.md / README.md / README_EN.md
  与事故文档。
- 「3/3 红 / 3/3 绿」措辞改为「连续 3 次运行全红 / 全绿」并注明该 lane 里只有 1 个用例、
  是重复跑三次——原措辞会被读成「3 个用例各红一次」。涉及上述四份发布文档 + 事故文档
  + AGENTS.md §2(同一句话在那边也有)。
- 其余 review 结论均已满足:版本三处锁步 + 两个守护用例绿、无遗留 0.22.0 引用、
  zh/en 段落一一对应、「最近更新」保持两条并把指针下移为 v0.21.1 → v0.12.3、
  release.yml 的 tag 校验与 `latest` dist-tag 都能过、lockfile 无需改动。
2026-09-28 11:30:29 +08:00
ymac aec7101374 feat(native): keep visited tab bodies mounted, and pin state retention end to end
DSH 0.1.7 gives a tab TYPE the `keepMounted` switch: a marked body stays
mounted through hiding, tab selection and Session switches. That is exactly
what the plugin tried to fake with module-level memory, so declare it on
every plugin type (the descriptor types and the `files` takeover) and let
the host hold the component state — tree scroll, unsaved drafts, chip
renames — with no plugin-side memory at all.

With the bodies staying up, the per-session record registry from the
previous commit is what keeps co-resident sessions apart; both halves are
required, because a body may still be remounted by the host (type disposal,
session teardown) and the records must outlive that.

Verification on a real host (`scripts/e2e-mount.sh`: npm pack -> fresh
scratch profile -> real `dsh web` pinned to 0.1.7-rc.1 -> headless Chromium),
new lane `tests/e2e/tree-scroll.e2e.ts`: build state in conversation A,
switch to B, come back, and compare the whole observable vector (tree
expansion, scroll offset, chip title) — plus the negative half, that B does
not inherit A's state.

That lane also exposed a defect in the old one: it picked its "second
conversation" by row index, but the session tree's first row is a WORKSPACE
row and a seeded session with no messages takes no row at all, so the
"A -> B -> A" round trip was re-selecting the same session and every
assertion held vacuously. It now identifies sessions by
`data-row-key="session:<id>"` and creates a real second session through the
rail.

`tests/e2e/mount.e2e.ts` reaches the side-chat tab through its guide entry
now: with the record retained, the chip shows the thread's own title, so
the old `/Side Chat/` chip match no longer names it.

Docs: AGENTS.md records the two facts that must hold together, and
docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md replaces the
park/archive design (PR #712) with this one.
2026-09-28 11:27:50 +08:00
Menghuan1918 2e94b56c36 chore(release): v0.22.1——修复 files 接管 id 孤儿化与 macOS 拖拽失效
- package.json / dsh.plugin.json / SIDEBAR_SERVICE_VERSION → 0.22.1(三者锁步由
  tests/service.spec.ts 与 tests/manifest-consistency.spec.ts 断言)
- README / README_EN:新增 v0.22.1 条目、同步三处徽章与 latest/支持线表格、
  切回 npm 通道的示例版本号;「最近更新」保持两条(v0.22.1 + v0.22.0),
  更早版本指针区间随之下移为 v0.21.1 → v0.12.3
- docs/external-plugin-guide.md:当前版本行 → v0.22.1
- CHANGELOG / CHANGELOG_EN:补 v0.22.1 条目(两个缺陷的根因链、真机证据、
  修复要点与守卫清单)

支持线**不变**:仅 DSH 0.1.7-rc.1+(peer 下限 ^0.1.7-rc.1,CI 钉 0.1.7-rc.1);
0.21.1 / 0.22.0 用户直接升级;0.1.6-alpha.2 及更早仍固定 v0.19.1。

内容提要:① 修复客户端条目替换后 `dsh-better-sidebar:files` id 被孤儿化
(#777 + #785:清理循环跳过 FILES_KIND + 注册失败回滚已占用的 id 与槽位,
并新增部署级回归门 tests/e2e/native-reload.e2e.ts);② 修复 macOS 桌面版
窗口拖拽/双击缩放失效(#773 + #786:视口层用 initial !important 退出
app-region 计算,补齐放大视图,探针改用真实级联计算值)。

验证:make check 全绿(typecheck / lint / build / test 122 files 1293 passed
9 skipped / check:consumer-types);此外本地 pnpm test:mount 与
pnpm test:mount:aggregate 绿,npm 0.22.0 与修复版在 scratch profile 上的
红→绿对照见 PR #785 / #786。
2026-09-28 11:23:48 +08:00
Atlas Zeng 69f4349047 Merge pull request #786 from omdsh-dev/fix/desktop-app-region-rest
fix(desktop): 补齐 mermaid 放大视图的拖拽区退出 + 把 #772 的守卫换成真实级联探针
2026-09-28 11:22:22 +08:00
Menghuan1918 e7d2300cf8 fix(review): 按独立 review(Chromium 实测)修正 #786 的措辞、守卫与覆盖
reviewer 在本机跑 Chromium 逐条实测(同一批宿主规则 + 插件产物),结论:修复方向与形状正确
(`.mermaidModal` 预修复计算 `no-drag`、修复后 `none`;级联探针确实能把未修复产物判红),
但有几处措辞与守卫不到位。逐条处理:

1. **「app-region 会被继承」的说法在该引擎里不成立**:`[data-dsh-panel-host]` 不是 body
   子元素(DOM 是 `body > [data-dsh-better-sidebar] > [data-dsh-panel-host]`),lane 用的
   Chromium 不传播该属性(实测:`drag` 父元素里子元素读 `none`)。改写成「宿主是 body
   子元素;在 Electron 里该值会传到它内部的面板层(#772 的 CDP 实测),lane 的引擎不传播,
   所以面板层自己也声明同一条规则」——CSS 注释、指南 §12.1、探针注释三处同步。
2. **`regions.layer` 那条断言是真空断言**(修复前后都读 `none`):保留为回归钉子,但在
   注释里明确标注它不具判别力、面板层的规则由 `panel-host-css.spec.ts` 钉住。
3. **给修复本身补行为级守护**:放大视图已经在同一 lane 里被真实打开过,于是在那里直接对
   `[data-mermaid-modal]`(以及它的按钮)读计算值——断言用**页面里宿主自己的** darwin
   规则(不再是探针复制的副本)。实测判别力:npm 0.22.0 上 `Received: "no-drag"`、修复版
   `none`。
4. **「交互层不要加 initial」与放大视图的矛盾**:放大视图是**遮罩层例外**——模态语义下
   只有其中控件必须保持 `no-drag`;残余代价(背景落在顶部拖拽带上时点背景会变拖窗)已写进
   指南,避免后来者按字面判据「修」掉其中一边。
5. **`.selectionPopup` 的负向守卫可被选择器列表绕过**(reviewer 实测:`.selectionPopup,.x
   { initial !important }` 能通过):改成按**声明块**扫描——凡带 `-webkit-app-region:
   initial` 的块,其选择器文本都不得出现 `selectionPopup`。
6. **补上 `none` 关键字的坑**:字面量 `none` 计算成 `no-drag`(是扣减值),只有 `initial`
   /`unset`/`revert` 才是中性值——CSS 注释、指南与单元用例注释都已写明。
7. **未覆盖层给出结论**:`FileTree` 的 `.uploadDropChatHint` 是 body 直挂的装饰层,但只在
   OS 文件拖拽悬停期间存在且 `pointer-events:none`,收益极小而**有意不处理**(写进指南,
   不再让「覆盖清单」看起来是绝对集合)。
8. 顺带:`§12.2` 的同步集里 `tests/theme.spec.ts` 只守颜色(本轮无颜色改动),形状守护落在
   已解析该样式表的 `tests/panel-host-css.spec.ts` 上——指南那句已按此表述。

验证:typecheck / lint 通过;panel-host-css 4 例通过;本地挂载 lane 7 passed(含新的放大
视图计算值断言);对 npm 0.22.0 的判别力实测:宿主探针红(`host` = `no-drag`)、放大视图
断言红(`modal` = `no-drag`),修复版全绿。
2026-09-28 11:17:03 +08:00
Menghuan1918 233201f7f8 fix(review): 按独立 review 结论修正 PR C 的注释、文档与用例保真度
独立 review(对照 606339f / 4099700 静态复核 + 日志逐行核对)提出的问题,逐条修正:

1. **补回被我自己抹掉的源码注释**:上次验证「未修复代码上 4/4 红」时用了
   `git checkout 606339f -- src/client/native/index.ts`,随后 `git checkout HEAD --
   <同一文件>` 把**尚未提交**的 `disposeSafely` 注释一起还原掉了 —— PR 描述里承诺的
   「说明释放失败为何只走 console.error」因此在 diff 里根本不存在。已重新落盘。
2. **事故文档三处事实修正**:同一毫秒的 `already registered` 是 **7 条**(.339 一条 +
   .340 六条,合计 burst 9 条),不是 6;验证段的「114 files / 1136 passed」是修复分支
   (base 早于 #781)的数字,补上口径并给出合入 main 后的 122/1292;`index.ts:353` 标注
   为 v0.22.0 行号(main 上因 #777 顺移)。
3. **撤回一处措辞过头**:「部分回滚分支从未被执行」→ 回收集合虽然进了、但 disposer
   列表恒为空(释放动作未执行),改后能真正覆盖。
4. **e2e 门不再可能静默通过**:`test.skip(CLIENT_JS === undefined, …)` 改成硬失败——
   这个门的价值就在于 harness 以后不再导出 DSH_HOME 时必须报错而不是变成 skip。
   同时把「无 `[data-sidebar-right-unavailable]`」移到文件渲染断言**之后**(前者在空
   pane 上恒真,不是真空但也没重量)。
5. **测试替身补齐保真度**:假注册表的 disposer 改为幂等(真宿主的 disposer 是幂等的
   ——cordis effect 二次释放返回同一个 task),避免「二次 release 又被记一笔」这种与
   真实宿主不一致的行为被后续用例当成事实。
6. **AGENTS §2 的 HMR 机制加版本限定**:`mtime/ctime/size` 的 sha1 rev 是**钉住的宿主
   0.1.7-rc.1** 的行为;DSH 源码树新版本改成只比 `mtime+size` 并对内容取 sha1,pin 上调
   时该触发器必须同步复核(否则会红在替换断言上,而不是静默失效)。

验证:typecheck / lint 通过;pnpm test 122 files / 1292 passed / 9 skipped(重启前机器上有
两个 scratch dsh 服务时的 fs-watch 超时是负载抖动,单独跑 5/5 绿、清空负载后全量绿)。
2026-09-28 11:09:30 +08:00
Menghuan1918 b07c7116c8 fix(desktop): 补齐 mermaid 放大视图的拖拽区退出 + 把 #772 的守卫换成真实级联探针
#773 修掉了面板宿主层继承宿主 `body > :not(#root) { no-drag }` 导致的 macOS 拖拽
失效,但只覆盖了 `.mermaidModal` 之外的层——而放大视图是插件**第二个铺满视口的
body 直挂层**(`position:fixed; inset:0`,portal 到 body),打开期间会同样清空整窗
拖拽与 macOS 双击标题栏缩放。

- src/client/sidebar.module.css:`.mermaidModal` 加 `-webkit-app-region: initial
  !important`(与面板宿主同一条契约),并在面板宿主那段注释里写明「哪些交互层
  绝对不能加 initial」(`.selectionPopup` 是 `<button>`、FloatingWindow /
  AnchoredPopover 自带指针拖拽,宿主 `:is(button, …)` 已给它们 no-drag;反过来
  声明 `initial !important` 会让按下变成拖窗,重演 #103/#111)。
- tests/panel-host-css.spec.ts:新用例把形状钉在 Linux 的 `pnpm test` 里(宿主层
  与面板层必须是 `initial !important`、`> *` 必须是 `no-drag`、`.mermaidModal`
  同样退出、`.selectionPopup` 不得出现 `initial`)——没有 macOS runner,丢掉
  `!important` 只能靠这里才不会静默复发。
- tests/e2e/mount.e2e.ts:把 #773 的**文本正则**断言换成**真实级联探针**——逐字
  注入宿主两条 darwin 规则、翻转 `data-platform=darwin`,读取计算值并断言
  `[data-window-drag]` 仍 `drag`、宿主层与面板层为 `none`、`[data-dsh-panel-host]
  > *` 为 `no-drag`,随后还原。探针把 `[data-window-drag]` 放在 `#root` 内:直挂
  body 的元素会被宿主那条 id 级规则本身命中(这正是问题机制)。
- docs/external-plugin-guide.md §12.1:按仓库规则同步这条皮肤契约(含交互弹层
  的反例判据与守卫位置)。

实测(scratch profile + 真实 dsh web + Chromium):
- npm dsh-better-sidebar@0.22.0:探针红,`host` 计算值 `no-drag`(正是线上症状)
- 本分支打包版:探针绿(`strip=drag` / `host=none` / `layer=none` / `child=no-drag`)
- 本地挂载 lane:7 passed(mount + perf,含新探针)

验证:typecheck / lint 通过;panel-host-css + theme 用例通过;新产物
`app-region:initial!important` 2 处(面板宿主 + mermaid 模态)、`app-region:no-drag` 2 处。
2026-09-28 11:04:52 +08:00
Menghuan1918 0b40f74ce8 fix(native): 钉牢 files 接管泄漏的守护断言 + 记录两条不变量
#777 已修掉根因(清理循环跳过 FILES_KIND、注册失败回滚已占用的 id),但它的两处
断言写在「活着的 id 集合」上——泄漏的 id 恰好构成同一个集合,未修复代码上同样
通过;且槽位失败判据按 key 命中,而一个描述符的两个槽共用一个 key,所以
registerSlots 的「部分回滚」分支从未被执行。

- tests/native-registration.spec.ts:断言改写到注册表的事件日志(孤儿 id 会让键
  集合看起来完全正常);槽位失败判据改为 name::key,从而可以只让某个描述符的
  第二个槽失败、真正走到部分回滚;补 reportFailure 的 phase 断言。实测:在
  v0.22.0 源码上 4/4 红,在修复后的源码上 4/4 绿。
- src/client/native/index.ts:给 disposeSafely 补注释,说明释放失败只写
  console.error、不弹诊断条的理由(两个调用点都在 teardown 路径上;真被占住的
  id 会在下一次注册尝试里经 reportFailure 显式报出)。
- AGENTS.md:§3.4 第 9 条补上这两条不变量(含真机日志实证的链接),§6 把
  native-registration.spec.ts 纳入关键测试守护。
- docs/plans/2026-09-28-native-files-takeover-reload-leak.md:事故/证据/否决方案
  记录(含「吸收」方案为何被否)。

验证:pnpm typecheck / pnpm lint 通过;pnpm test 122 files / 1292 passed / 9 skipped。
2026-09-28 10:57:10 +08:00
Menghuan1918 36fbc5ac7e feat(sidebar): 文件页与文件变动页 UIUX 重构 + 全局组件抽取
文件页(FileTree/TreePanel)
- Ctrl/Cmd 多选 + Shift 按可见行序连选(Esc/点空白/右键收敛),批量条支持复制路径、批量删除(共享 ConfirmDialog + 顺序 fsRemove)
- Git 变更着色:行名按状态上色 + M/A/D/U 徽标,目录按 dirHasChanges 着色,非仓库静默降级(数据来自共享 git 状态存储)
- 新建文件夹:fs.mkdir 路由 + mkdirWorkspaceEntry + 内联输入行(Enter/Esc/blur/IME 守卫)
- 性能:FileRow/DirRow memo(含反向验证)、搜索 hidden 停车不再卸载树、level 拉取世代守卫 + AbortController、fs.tree truncated 提示、use-dir-watch 入参 memo
- 拖拽上传视觉 token 化(硬编码色清零);可见性下传后隐藏页签停止轮询
- 右键「打开方式」改为复用 DSH 自带 open-in-app(宿主探测的关联应用 + 文件管理器显示)

文件变动页(changes/diff)
- 36px 头(宿主 SegmentedControl)+ 单一 ChangeRow + SectionHeader 分组 + 吸底提交条单状态行 + 历史独立空态
- 修掉:双份空态、暂存失败 unhandled rejection、手动刷新被丢、仓库切换刷新两次、worktree 清单缺 repoRoot、工作树被自动切走、预览持旧快照、恢复高度未 clamp、session ops 无谓轮询
- DiffPane/DiffTab 共用 use-git-diff;修掉 DiffPane 的 untracked 预览从不渲染

全局组件与宿主接入
- 新增 src/client/ui(IconButton/Chip/SectionHeader/Notice/ConfirmDialog/StatusBadge + 共享 git 状态存储)
- 新增 src/client/open-in-app.ts(宿主 open-in-app 客户端适配),删除自研 open-with 全链路与 open.external 路由
- 客户端 inject 补 remote / remote.session:缺声明时 ctx.get('remote').session 会抛出并把整个面板打成错误条(真实挂载 lane 抓到)
- 词典:+25 键 / -20 openWith* / -noChanges,20 份同步

验证:typecheck / lint / test(126 文件 1322 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过(含 tab sweep 与 perf lane)
2026-09-28 00:27:31 +08:00
Menghuan1918 606339f81e chore(release): v0.22.0——任务管理页重做(工作流图)+ DSH 0.1.7 团队/后台任务数据面
版本号 bump 到 0.22.0(含 dsh.plugin.json 与 SIDEBAR_SERVICE_VERSION 两处镜像,
tests/manifest-consistency.spec.ts 与 tests/service.spec.ts 就是守这两处的),
README / README_EN 的版本徽章、支持线表格、npm 通道说明与「最近更新」段落同步,
CHANGELOG / CHANGELOG_EN 补 v0.22.0 条目正文。

支持线**不变**:仅 DSH 0.1.7-rc.1+(peer 下限 ^0.1.7-rc.1),0.21.1 用户可直接升级。
主内容是任务管理页从「子代理拓扑」重做为工作流图(图/树双视图、双段式节点卡、
主 Agent 同款合并活动行、扫光、两组折叠聚合、两个常驻浮动窗),以及随后按真机反馈
打磨的四轮修正;团队与后台任务两个数据面按 0.1.7 删掉的 Remote 方法/自建路由改写。

验证:typecheck / lint 通过;pnpm test 1288 passed / 9 skipped;build + pack 产出
dsh-better-sidebar-0.22.0.tgz。
2026-09-27 22:33:57 +08:00