Commit Graph
996 Commits
Author SHA1 Message Date
Menghuan1918 66eb494bb3 docs: 修正 #774 的三处不实数字与 e2e 入口口径
- CHANGELOG:chunk 体积 750,030 → **749,897** 字节(实测 wc -c
  lib/client-terminal.js);chunk 名镜像点 9 处 → **8 处**(按 AGENTS §5 口径,
  tests/manifest-consistency.spec.ts 从 CHUNK_NAMES 派生,无需字面量改动)。
- e2e 入口写法改正:lane 点的是**空面板的类型卡片**(PaneEmptyCards,与 `+` 菜单
  同一份 buildNewTabOptions),不是 `+` 菜单;并注明 `+` 菜单那条点击路径 lane 里
  没有覆盖。计划文档同步。
- 计划文档第 6 节:「未验证:真实挂载 lane」改为已实测(实现节点与独立验证节点都
  跑过),并如实写明**完整 lane 曾因无关 spec zz-expand-refresh 抖动失败过一次、
  单独重跑即过**,所以「完整 lane 一次通过」不能当证据用。
- 计划文档与 CHANGELOG 同步本次新增的单元守护与用例数(14 → 15 条)。
2026-10-06 00:06:40 +08:00
Menghuan1918 6c60693e7d test(terminal): #774 收尾——补 bottomOnly 原生承载面的单元判别性守护
独立验证节点实测:把 src/client/native/index.ts 的 sync() 里
`if (descriptor.bottomOnly === true) continue` 删掉后,14 个相关 spec、158 条
断言全绿,只有挂载 lane 能抓住「原生 guide 条目从 0 变 1」——这半边当时只有
部署级守护。

- tests/native-registration.spec.ts 新增「a bottomOnly descriptor never
  reaches the native surface」:断言注册表的**事件日志**里没有该 id、没有它的
  slot,guide 条目只有 files 与 git;正控(其余描述符确实注册了)在前,所以
  这条不会因为「什么都没注册」而空过。实测删掉那行 skip 后:本次相关的 8 个
  spec / 171 条用例中只有这条红(170 绿)。
- tests/terminal-tab.spec.tsx:「已退出只说一次」那条断言原先**不判别**——
  只翻 info.state 时 statusOf 本来就返回 undefined,门在不在都一样。现在把
  phase 也置为 disconnected(statusOf 有自己的一行),断言状态行恰好 1 个、
  唯一按钮是「新建终端」、且不含 disconnected 文案。实测去掉
  TerminalView.tsx 的 `missing || ended` 门即红。
- tests/terminal-tab.spec.tsx 新增「新建终端」的**真实路由**用例:此前被假
  betterSidebar.updateTab 掩盖,现在接真 service,覆盖 surface.update 认领
  与 store.reduce(patchTab) 两半(bottomOnly 类型永远没有原生记录,落 store
  是它唯一的真实路径)。
- src/client/builtins/tabs.tsx:onClose 不再以 `scope?.sessionId ?? ''` 调宿主
  close(),缺 scope 直接 return——空 sessionId 会让宿主 no-op 并让 shell 一直
  挂着一个 per-session 槽位。
2026-10-06 00:06:37 +08:00
Menghuan1918 2f66c921df docs: 同步 #774 的接入契约、设计文档与内置清单
「接入 API 即文档」:src/client/service.ts 与 src/client/builtins/ 变了,
唯一权威接入文档必须跟着变。

- docs/external-plugin-guide.md:`bottomOnly` 全字段说明(含与 `hidden`
  的区别、`openTab` 落点改道、为什么不注册原生承载面);承载面表把
  「终端(已交还宿主)」拆成三条——宿主一条 + 插件底部一条(彼此独立)、
  `bottomOnly`、底部终端的恢复语义;`target: 'side'` 行补上唯一的例外;
  guide 条目行补「`bottomOnly` 同样不占行」;§4.4 内置清单加
  `terminal-bottom` 行(5 → 6)。
- docs/plans/2026-10-05-bottom-terminal-tab.md:设计文档。五条已定决策、
  从装好的钉版包里读出来的宿主契约(含 view() 的 createWhenMissing 分支、
  SnapshotStore、帧协议、issue 枚举)、三条恢复语义的由来、降级矩阵、
  证据清单,以及**未验证项**(真 Windows / 真浏览器观感 / 本轮是否跑过
  真实挂载 lane)。
- README.md / README_EN.md / CHANGELOG.md / AGENTS.md:内置 5 tab → 6 tab
  的计数同步(README 的终端行与排障行补上底部终端与它的失败模式)、
  Unreleased 词条、AGENTS 的 chunk 名清单与关键测试守护条目。
2026-10-05 23:42:49 +08:00
Menghuan1918 1ff8fa3514 feat(terminal): 底部工作台终端 tab terminal-bottom(#774)
底部 + 菜单里开得出 shell,刷新后认回同一个 shell,且**不**变成宿主
右列终端的第二个入口。

实现分三层:

1. 宿主能力层(src/client/terminal-client.ts,核心 bundle 安全):结构化
   探测 `ctx.webTerminals`(view/close/recover 三个函数都在才算数)+
   身份助手。**不写进 dsh.client.inject**:注入一个不存在的服务会把整行
   拖成 pending,插件在无终端控制器的部署上会整体不加载;也**不**
   value-import 任何 @deepseek-ai/*(纯度门),类型面手工声明。
2. chunk 层(src/client/TerminalView.tsx + terminal.module.css +
   chunks/terminal.tsx + terminal-lazy.tsx):xterm 与它的样式表整份打进
   lib/client-terminal.js(750 KB),核心包一处都没有;chunk 名在 9 处
   镜像(tsdown / bundle-route / chunk-loader / package.json.files /
   package-registry / bundle-route.spec),另两处 spec 从 CHUNK_NAMES 派生。
3. 描述符层(builtins/tabs.tsx):第 6 个内置类型,`bottomOnly: true`
   (见上一个 commit)、`single`、`available` 读同一份探测、`onClose`
   结束进程。

三条恢复语义的由来:

- **contentId 恒定,terminalId 不写进 tab.meta**:宿主 view() 显式传
  terminalId 会关掉「缺了就建」分支,一个过期 id 会把页签永久卡在
  missingTerminal;宿主自己的 (sessionId, contentId) → 终端 id 持久绑定
  本来就能在刷新后认回同一个 shell。
- **「新建终端」换代号**:DSH 重启后 PTY 没了而 localStorage 绑定还在,
  恒定 contentId 会永远认领死绑定。tab.meta.terminalRun(默认 0)+1 换
  一代 contentId 让宿主另铸进程;key 与 contentId 一起换(views 按
  (sessionId, key) 记忆化)。
- **关页签才结束进程**:宿主的契约是「视图跨 DOM 卸载存活」,这正是刷新
  能认回同一个 shell 的原因,所以卸载不 close;但不 close 会让每个关掉
  的终端永久占一个 per-session 终端槽位(terminalLimit),因此 descriptor
  的 onClose → webTerminals.close() 是唯一且必须存在的回收路径。

测试(判别性证据见交付报告):
- tests/terminal-tab.spec.tsx 14 条:view() 调用形状与 contentId 恒定性、
  mount/detach、write/resize 转发与上限夹紧、snapshot 重放 + acknowledge、
  无服务降级、missingTerminal → 换代号、onClose → close()。
- tests/builtins.spec.ts 内置清单 5 → 6,并新增「terminal-bottom 是
  bottomOnly、其余内置都不是」。
- tests/chunk-artifact.spec.ts 新增产物包含性断言:chunk 里必须有
  xterm(xterm-char-measure-element / @xterm/xterm/lib/xterm.js),
  lib/client.js 与 lib/client-registry.js 里一处都不许有。
- tests/e2e/mount.e2e.ts 第三条真实浏览器用例:先开原生右列(guide 基线
  = 宿主 terminal 恰好 1 条)→ 展开底部工作台(data-active + 布局推挤
  > 0)→ 点空面板的 Terminal 卡片 → 断言 tab 挂载、.xterm 在、chunk 有
  响应、状态不停在 unavailable/loading、宿主 terminal 条目仍为 1 且
  terminal-bottom 条目为 0、无 pageerror / 插件 console 错误。

依赖:@xterm/xterm@^6.0.0 + @xterm/addon-fit@^0.11.0(与宿主自用版本一致,
安装期零脚本,不触市场拒绝名单)。lockfile 只手工拼接这 2 个包的 4 个块:
pnpm add 会顺手重解析无关 caret 范围,产出 99+/69- 的噪声 diff。
2026-10-05 23:42:45 +08:00
Menghuan1918 95db9e4d42 feat(tabs): TabDescriptor.bottomOnly —— 只投底部、永不占原生承载面
#774 的第一条硬约束是「插件的底部终端绝不能变成宿主右列里的第二个
终端入口」(挂载 lane 钉住宿主 terminal guide 条目恰好 1 条)。已有的
两个字段都做不到:`hidden` 会连底部 + 菜单一起摘掉
(buildNewTabOptions 过滤 !hidden),而注册成普通描述符就会自动拿到
原生 tab 类型 + guide 条目。

新增一个显式的 `bottomOnly?: boolean`,效果两处,缺一不可:

- `openTab` 的原生分支条件加 `descriptor.bottomOnly !== true`:落点强制
  bottom(连 `target: 'side'` 也改道)。原生栏里的 tab 不在底部工作台的
  分栏树里,把只投底部的页面送进原生栏是归属矛盾。
- 原生承载面(src/client/native/index.ts 的 sync())跳过它:既不注册
  tab 类型,也不占 guide 条目。

字段带完整文档注释(含与 hidden 的区别、内置用例 terminal-bottom)。
接入文档同步在下一个 docs commit。
2026-10-05 23:42:40 +08:00
Menghuan1918 6776f28f73 feat(i18n): 底部终端词条 terminalNew / terminalUnavailable / terminalGone
#774 的底部工作台终端需要三句话:宿主没挂终端控制器时的说明、绑定
指向的进程已消失时的说明、以及「新建终端」这个动作本身。三者进
locales.ts 的 zh/en 与全部 19 份第三语言词典——键集必须 20 份相等
(tests/locales.spec.ts 守护),只加一份会让整套词典红。

插在 terminalShellNotFound 之后(终端词的既有聚簇),三份中文变体
(zh-HK / zh-MO / zh-TW)沿用「終端」措辞,与各自词典里的 terminal
一致。
2026-10-05 23:42:37 +08:00
Menghuan1918 f0a038a1f5 merge fix/131-count-nits into dev(#131 收尾:纯重命名 0/0 不再计入分组合计(消除空计数簇);计数簇字号改用字体令牌) 2026-10-05 22:46:22 +08:00
Menghuan1918 045df89046 merge fix/212-blame-memo into dev(#212 收尾:变更集被清空(提交/丢弃)时同样失效 blame memo——原先只覆盖「变更集被重算」,会把提交前的 blame 一直答下去) 2026-10-05 22:46:22 +08:00
Menghuan1918 504d428b79 fix(git-lens): 纯重命名不再计入分组合计,计数簇改用字体令牌(#131)
(a) numstat 为 0/0 的条目(纯重命名、仅改权限)行上什么都不打印,但
sumLineCounts 仍把它计进 files,于是「只含纯重命名的分组」在分组头渲染
出一个空的 +N −M 计数簇。合计函数改为跳过两侧都为 0 的条目:合计=「行上
真的打印出来的数字之和」,与既有「二进制 / 未跟踪不贡献任何数」同一条
口径。只改这一个源头,两个分组头共用的 files > 0 门控不用动。

(b) .lineCounts 的裸 font-size: 10px 换成 font: var(--dsw-font-xxxs-11)
(11px/14px,weight 400),并按简写要求在其后用 font-family 覆盖回
--ds-font-family-code 代码字体。前后值:10px(行高继承 18px)→ 11px/14px;
行与分组头都是 28px 固定高度、文字 18px 行高,故布局不变,只有数字本身
大 1px。

测试:
- change-tree-counts:新增 0/0 条目不参与合计(纯重命名 / 仅改权限),
  同时钉住「改了内容的 rename 仍贡献数字」。
- changes-tab:新增「只含纯重命名的两个分组都查不到 [data-lines="group"]
  空计数簇」用例(并断言两个重命名行确实渲染了,避免空过),配一条对照
  用例「组内真有数字时计数簇照常出现且数字正确」;另加一条样式守护,钉住
  .lineCounts 走 --dsw-font-* 令牌、不含裸 font-size px。
- 还原源码/CSS 改动后这三条全红(空 span 被断言到、font 令牌断言失败)。
2026-10-05 22:39:22 +08:00
Menghuan1918 ce8366fb11 fix(editor): blame memo 在变更集消失时也失效(#212)
effect 原先在「文件已无变更集」(提交 / 丢弃后 entry === undefined)的
早退分支里直接 setKinds(EMPTY_KINDS) 返回,forgetBlame 只在有变更集的
分支才跑。于是提交前 hover 过的行继续返回提交前的 blame——包括
「Not Committed Yet」这类未提交占位——直到该文件再次产生变更集,或
memo 触顶 500 被整体清空。

把 forgetBlame 提到早退之前:变更集被重算与被清空都是失效条件。不改
过期时间,也不加缓存层。

测试:
- 新增(判别性)「提交前 hover → 变更集消失 → 再取同一行」用例,断言第
  二次重新请求且不再返回提交前答案;还原源码改动后该用例红在
  `expected "vi.fn()" to be called 2 times, but got 1 times`。
- 补一条原无守护的用例:挂载 code 视图后 api.gitBlame 调用数为 0(不预
  取),同时断言变更集确实读到了(gitDiffHead 1 次 + 色条 gutter 在
  DOM 里),避免断言因「gutter 根本没装」而空过。
- 既有的「同一行 hover 两次只打一次 git」保持为 memo 生效的守护。
2026-10-05 22:36:10 +08:00
Menghuan1918 bce22cfaf1 merge feat/212-editor-git-gutter into dev(#212 编辑器变更提示:code 视图行号槽着色 + 左侧细色条 + hover blame,一个布尔开关,样式极简) 2026-10-05 22:32:26 +08:00
Menghuan1918 218c5f2b09 merge feat/131-git-line-counts into dev(#131 增删行数:numstat 随既有 status 一次取回显示分组合计与单文件 +/-,未跟踪显示「新文件」,不新增轮询器) 2026-10-05 22:32:26 +08:00
Menghuan1918 c3083b6b3f merge fix/194-git-sticky-header into dev(#194 源代码管理拆「不滚动头 + 内层滚动体」:分支条与提交框不再随列表滚走,删掉提交框的 sticky 吸底) 2026-10-05 22:32:26 +08:00
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 99eb9190e0 feat(git-lens): 变更行数统计(numstat 随既有 status 一次取回,分组头合计 + 文件行增删,未跟踪显示新文件)(#131) 2026-10-05 22:19:26 +08:00
Menghuan1918 97ba41d441 fix(git-lens): 分支条与提交框移出滚动体,只有列表内层滚动(#194) 2026-10-05 22:13:00 +08:00
Menghuan1918 39e7b587d8 merge feat/109-tab-context-menu into dev(#109 Tab 右键菜单补「全部关闭」与「在资源管理器中定位」,含 20 份词典与文档同步) 2026-10-05 21:59:25 +08:00
Menghuan1918 27b6d6323b merge fix/186-dir-hover-title into dev(#186 目录行悬停显示完整路径;不做横向滚动) 2026-10-05 21:59:25 +08:00
Menghuan1918 7f7ec0b901 merge fix/864-desktop-window-contract into dev(#864 顶部保留区优先读壳的 desktopWindow 契约;识别 extended 模式;不解决 #430) 2026-10-05 21:59:25 +08:00
Menghuan1918 69eb35fb5f merge fix/617-panel-host-height into dev(#616 高度修复:面板宿主显式声明 height: 100vh,皮肤页级 filter/backdrop-filter 下不再塌成 0;只取贡献者 PR #617 的 CSS 那一半) 2026-10-05 21:59:25 +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 e88b7e02ed feat(tab-bar): Tab 右键菜单补「关闭全部页签」与「在资源管理器中定位」 2026-10-05 21:53:08 +08:00
Menghuan1918 85fa15a315 fix(panel-host): 面板宿主补显式 100vh 高度,修掉皮肤包含块下右侧栏整条塌陷(#616) 2026-10-05 21:46:26 +08:00
Menghuan1918 f5a22b781e fix(explorer): 目录行与工作区根行补齐悬停完整路径(#186) 2026-10-05 21:46:13 +08:00
Menghuan1918 38ceecb051 test(sidebar-crash): 修掉 afterEach 不清挂载导致的定时器泄漏(既有 flake,CI 间歇红)
现象:`ci` 的 Test 步骤红,但日志里 173 files / 1962 tests **全部通过**,只有一个未捕获错误:
`ReferenceError: window is not defined`,栈落在 src/client/session-phase.ts:44 的 setPhase。

根因:本 spec 的 afterEach 用 document.body.innerHTML = '' **直接清 DOM,从不 root.unmount()**
→ 所有 effect 的 cleanup 都不执行 → 组件里的 setInterval 全部继续armed(实测每个用例泄漏
**5 个**),活过 jsdom 销毁;之后轮询落到 catch 分支调 setPhase,React 去读已不存在的 window。
是否触发取决于调度时序(本次 ubuntu runner 明显更慢:49s vs 21s),所以同树另一次运行全绿。

修法(源头在 harness,不在产品代码):
① mountSidebar 把 unmount 收进 mountedRoots(并做成幂等,显式 unmount 过的用例不会被二次卸载);
② afterEach **先卸载**(这正是跑 cleanup 的那一步),再清 body;
③ 新增不变量断言:afterEach 里若仍有存活 interval 即失败 —— 定时器不得活过一个用例。

判别性验证:把 ② 的卸载去掉、保留守卫与断言 → **4 个用例红**
(`every interval started by a test must be cleared before it ends: expected 5 to be +0`);
恢复后 6/6 绿,该 spec 连跑 8 次全绿。另加一条「先证明轮询真的被 armed」的用例,避免守卫空转。

全量:173 files / 1963 passed | 13 skipped(新增 1 例),typecheck 0,eslint 0。
2026-10-05 11:32:16 +08:00
Menghuan1918 d51a46075d fix(search-engines): 目录命中去掉 fd 打印的尾部分隔符(Windows lane 暴露的真实缺陷)
fd 的目录命中带尾部分隔符('src/util/'),rg --files 只报文件,所以只有 --type d 那一路带着它。
走查契约没有尾分隔符('src/util'),而一整类消费者会把这些行与走查输出比较(dirs 集合、
kept.has(dir) 子集判定、行标签),所以规范化必须在两条引擎、两次调用共用的这个点上收口。

从未暴露的原因:fd 只存在于 Windows lane(ubuntu 与开发机都没有),而那条真实引擎用例此前
红在 fixture 的非法文件名字符上——修掉 fixture 才让它第一次真正跑到断言。

新增 3 条不依赖真机引擎的判别性用例(旧实现在其上 3/3 红):POSIX 形状、Windows 反斜杠形状、
以及被尾部剥离塌空的裸根。全量 1962 passed。
2026-10-05 03:09:38 +08:00
Menghuan1918 9c9ec5aaeb docs(agents): 补两条本次 CI 红的教训(Windows 非法文件名字符 / 按入参平台选 node:path 方言)
§6「测试不得依赖非普适二进制」旁新增两条同族规则——两条都是「本地永远绿、Windows lane 必红」
的形态:Win32 非法文件名字符不能出现在 fixture 里;按 platform 入参推导路径必须用同方言的
posix/win32,否则函数在不同 OS 上不是同一个函数。
2026-10-05 02:59:36 +08:00
Menghuan1918 74549f73da merge fix/post-integration into dev(修集成批带出的 3 条 CI 红)
① src/search-engines.ts 的 bundledRgCandidates 原是「按入参 platform 推导路径,却用宿主
   sep/dirname 走查」——Windows runner 上 POSIX 起始路径的 endsWith('\\node_modules') 永不命中,
   argv[1] 走查一个 root 都产不出。改为按 platform 选 node:path 方言(posix/win32),函数成为入参的纯函数。
② tests/search-engines.spec.ts 的真实引擎用例建了名为 a*b.ts 的 fixture——'*' 在 Windows 是非法
   文件名字符,fixture 自己 ENOENT。按平台换成合法见证对(win32 用良构的 a[b])。
③ tests/e2e/zz-expand-refresh.e2e.ts 的「展开必然发请求」前提已被 compact 预取改变
   (probeCompactRows 把「唯一子项是文件」的目录也标 compact,客户端在层级缓存变化时预取)。
   断言改为预取感知:允许 0 或恰好该层级,但禁止任何更宽范围的 fs.trees,且子行必须出现。

Refs #303 Refs #264
2026-10-05 02:58:53 +08:00
Menghuan1918 cc4a462408 fix(search-engines,e2e): Windows 路径推导按入参平台、fixture 换合法元字符、展开断言改为预取感知
集成批 17556fd 在 CI 上暴露三处红(Ubuntu `ci` 绿、Windows 测试红 2 条、挂载 lane 红 1 条),
逐条根因与修法:

1) tests/search-engines.spec.ts > bundledRgCandidates > walks every node_modules level
   above the CLI entry (argv[1])(仅 Windows 红)
   CI: AssertionError: expected [ …(8) ] to include '\Applications\Dsh.app\Contents\Resour…'
   根因:bundledRgCandidates() 按「传入的 platform」推导候选,内部却用宿主的 sep / dirname / join。
   测试传的是 POSIX 路径(/Applications/Dsh.app/…),Windows runner 上 sep === '\\' →
   endsWith('<sep>node_modules') 永不成立 → argv[1] 走查一个 root 都产不出,期望项缺失。
   修法(修源头,不改测试语义):按 platform 选 node:path 方言
   (`const P = platform === 'win32' ? win32 : posix`),walkRoots 与 %APPDATA% / execPath /
   profile / 候选拼装一律走 P.dirname / P.join / P.sep。函数自此是入参的纯函数:darwin 在任何
   宿主上都产出 '/'-joined 候选,win32 都产出 '\'-joined 候选。
   测试同步:darwin 用例期望改用 posix.join、win32 用例改用 win32.join——宿主 join 正是
   Windows 上把 POSIX 期望拼成反斜杠、POSIX 上又把 win32 期望拼成混合分隔符的原因;
   argv[1] 那条补齐 win32 反向断言(在 macOS 上直接跑出真实反斜杠形状),%APPDATA%、
   ~/.dsh profile、APPDATA 缺席三条从「结构包含」收紧为精确 pin win32 形状。

2) tests/search-engines.spec.ts > real engines (only when installed) > matches literals,
   splits dirs, skips noise when an engine is installed(仅 Windows 红)
   CI: Error: ENOENT: no such file or directory, open
   'C:\Users\RUNNER~1\AppData\Local\Temp\dsh-sidebar-engine-real-oCa7RG\a*b.ts'
   (tests/search-engines.spec.ts:432)
   根因:为验证「模式里的元字符按字面处理」而真建了一个叫 a*b.ts 的文件——'*'(连同 ? : " < > |)
   是 Windows 非法文件名字符,fixture 自己就 ENOENT,一条断言都没跑到。
   修法:按 platform 选一对「两平台都合法、且非字面解读必然命中诱饵」的见证。POSIX 保留
   query 'a*b' / literal 'a*b.ts' / decoy 'anb.ts';win32 改用 '[' ']'(Windows 合法文件名
   字符)——query 'a[b]' / literal 'a[b].ts' / decoy 'ab.ts'。'a[b]' 是 glob 字符组,漏转义时
   匹配的是 'ab.ts' 而不是字面文件(实测 rg 15.2.0:未转义 '*a[b]*' 返回 ab.ts,转义
   '*a\[b\]*' 返回 a[b].ts)。刻意不用未闭合的 'a[b':rg 直接拒绝该 glob(unclosed character
   class),引擎被判 broken 后回退普通 walk,断言会被兜底意外满足。整条用例不跳过、
   「元字符不当通配符」的断言不削弱。

3) tests/e2e/zz-expand-refresh.e2e.ts > a folder toggle re-lists that folder and nothing else
   (挂载 lane 红)
   CI: Expected: "fs.trees[bravo]" / Received: undefined,同用例 phase dump:
   D-expand-bravo: requests: [], domAdded: 1, ...
   A-expand-big:   requests: ["fs.trees[big]"], domAdded: 41, ...
   根因(是预期行为,不是缺陷):src/fs-tree.ts 的 probeCompactRows 明确把「唯一子项是文件」的
   目录也标 compact(客户端据此预取并稳定折叠标签),而 bravo 恰好只有一个文件;FileTree.tsx
   的 loadLevels(compactLoadTargets(...)) 在**层级缓存变化时**就列了 bravo(根层到货即可触发),
   阶段 D 的展开直接命中缓存 → 零请求,但子行确实出现。旧断言
   sibling.requests[0] === 'fs.trees[bravo]' 编码的是「展开必然发请求」这条已不成立的前提。
   修法:断言改为预取感知——允许 0 或恰好该层级两种取值,且必须同时证明不存在更大范围的
   fs.trees 请求(requests.length ≤ 1 且每一条 === 'fs.trees[bravo]'),并要求子行出现
   (added ≥ 1);注释写明「零请求是预取命中,不是没展开」以及「预取发生在层级缓存变化时」,
   免得后人又把它当 bug 改回去。展开 big(40 子项、非 compact)仍必须恰好发 fs.trees[big]
   (防「重列整个可见集」的主守卫保留),tree body 不被替换、socket 不新增、collapse 无
   killed rows、拓扑/展开语义等既有守卫一律保留。

门禁(本地,最终状态):
  pnpm typecheck                       → exit 0
  pnpm exec vitest run --maxWorkers=3 tests/search-engines.spec.ts tests/fs-search.spec.ts \
       tests/fs-tree-compact.spec.ts tests/exclude-patterns.spec.ts → 4 files / 71 tests passed, exit 0
  pnpm exec vitest run --maxWorkers=3  → 172 files / 1943 passed | 13 skipped, exit 0
  pnpm lint                            → exit 0
  pnpm check:engines                   → exit 0(本机无 fd:SKIPPED,rg 实跑通过)

未验证:真机 fd(本机未安装,win32 fixture 分支用真实 rg 在同一台机器上端到端验过)与
plugin-mount lane(挂载 lane 需下载真实 DSH + Playwright,未在本地运行,交由 CI 验证)。

Refs #303
Refs #264
2026-10-05 02:58:04 +08:00
Menghuan1918 b5b3d78ea8 merge test/pr-642-route into dev(补 git.suggest-message 宿主路由契约 16 例 + 设计文档改名)
路由级契约(模型回退链四级 / 提示词与 512 token·最低 reasoningEffort·30s 超时参数面 /
返回形状 / 四类错误映射 / 只读 git 的安全不变式)此前无任何用例覆盖。
所有断言做过变异验证(6 次改坏实现,每次恰好目标用例变红)。

Refs #642
2026-10-05 02:53:42 +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
Menghuan1918 0a0a1b6185 merge integ/ports into dev(#303 引擎搜索 / #584 反代 base path / #839 sidechat tab 绑定 / #642 AI 提交信息 / #434 Push·Pull 五个移植的集成批)
集成取舍:fs.search 的引擎路径与 #264 的排除模式共用同一个探针实例(引擎输出后置过滤,
被排除目录整棵子树消失、过滤发生在行额切片之前);#434 与 #642 的「建议提交信息」只留
#642 的一份实现,#434 只取 Push/Pull 并并入既有提交行。

Refs #303 Refs #584 Refs #839 Refs #642 Refs #434
2026-10-05 02:44:47 +08:00
Menghuan1918 17bdae9975 docs(fs-search): 说明引擎行额与排除后置过滤的相互作用
引擎自己的上限(maxMatches + 1 哨兵)在 dispatch 的后置过滤之前生效,所以「前
maxMatches 行恰好全被排除」的根会返回更短的列表但 truncated: true——与遍历被
行额截断时给出的信号一致,不是静默缺口。这条限制写进 dispatch 的文档注释,
避免后人误以为后置过滤能补足到行额。
2026-10-05 02:42:09 +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
Menghuan1918andrainmanhhh 4c61cc59cd Merge port/pr-642:AI 生成提交信息(Ctrl+G / 多行提交框 / 可固定生成模型)
无冲突。本分支是「建议提交信息」的唯一实现来源(纯逻辑 src/commit-message.ts +
三条宿主路由 ctx.llm / agentDefaultModel / 设置缝 + CommitModelSettings.tsx +
多行 textarea / Ctrl+G / ✨ 按钮);随后合入的 port/pr-434 只取其 Push/Pull 部分,
434 的重复 suggest 接线/图标/CSS/词典键在那一批里删除。

Co-authored-by: rainmanhhh <13862623+rainmanhhh@users.noreply.github.com>
2026-10-05 02:38:21 +08:00
Menghuan1918andwaser0434 055367b446 Merge port/pr-839:原生侧边对话 tab 跨重导航绑定到自己的线程
无冲突(port 已按证据卡把记账从裸 tab id 改成 viewKey(sessionId, id))。
合并侧核对证据卡两条口径:revision 账本按 viewKey 记账且 retain(sessions)
一并清理;updateTab 带 seat session 而不是多会话同名 id 猜一个。

Co-authored-by: waser0434 <178004182+Waser750@users.noreply.github.com>
2026-10-05 02:38:09 +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
Menghuan1918andshyuan-hub 21c8856755 merge #264 into dev(文件树面包屑折叠与可配置排除模式;按 dev 现行架构重写移植,原作者 @shyuan-hub)
本批为移植(非原分支解冲突):贡献者分支基于旧基线,改动面已与 dev 现状错位,
故按当前架构重写实现,原始 PR 由 @shyuan-hub 提出。

Refs #264

Co-authored-by: shyuan-hub <311810858+shyuan-hub@users.noreply.github.com>
2026-10-05 02:35:42 +08:00
Menghuan1918 f02b0fa3d3 fix(active-worktree): 探测真实路径而非大小写折叠后的 identity key
#802 把 tool call 里的候选路径按 pathKeyOf()(小写 + 分隔符归一)当 map key 记账,
随后又把这个 key 本身交给 git rev-parse --show-toplevel 去探测。Linux 区分大小写,
…/iHpOqm 折叠成 …/ihpoqm 后 stat 与 git 全部失败,候选被静默丢弃,函数回退到会话
cwd——跨仓 linked worktree 永不跟随。macOS / Windows 的文件系统折叠大小写,所以本地
全绿;dev 上 b2599b3、9b97e6f、3bd5e19 三次 ci 全红在
"follows a linked worktree of a DIFFERENT repository named by the tool calls"。

现在候选以 { path, score } 记账:key 仍只用于身份比较,探测一律用 path。回归用例断言
探测入参里出现原始大小写的路径(旧代码是小写变体),因此在 macOS 上同样是红的,
不依赖宿主文件系统是否折叠大小写。

Refs #802
2026-10-05 02:35:18 +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
Menghuan1918andrainmanhhh 6615f63602 feat(git): AI 生成提交信息(Ctrl+G、多行提交框、可固定生成模型)
移植 PR #642(refs/tmp/pr642 → 当前 dev 重写,不机械解冲突)。

复用(与 dev clean 或纯逻辑无冲突面):
- src/commit-message.ts 纯逻辑模块原样取用:prompt 契约、provider/model 路由
  词法、reasoning effort 取最低档、宽容的 provider/model 目录读取、建议文本清理。
- host 半边(git.suggest-message / git.commit-model / git.models 三条路由 +
  pinned / 会话 / agent-default-model 三级路由解析)按 dev 现状重贴:ctx.llm、
  agentDefaultModel、git.status/diff、sessionId 参数名逐条对照本机 0.2.0-rc.1 核实。
- 设置缝复用 dev 已有的 SidebarSettingsRenderProps + settings.render(PR 侧写在
  同一接口上,零适配)。
- 三个新 spec 原样取用,只有 git-suggest 的 harness 改了「visible 默认 true」——
  dev 的共享 git-status store 只在可见时订阅,不可见时 snapshot 恒 null,
  commit bar 根本不渲染(PR 作者当年跑绿的是本机未提交状态)。

丢弃 / 按 dev 重写:
- PR 的 GitLens 客户端半边基于 #471 重写前的 GitLens:提交栏在 dev 已是
  primitives Input + commitBar/commitRow/commitInput,且 Ctrl/Cmd+Enter 提交
  已存在(重复实现)。现按 dev 的 .commitRow 结构重做多行 textarea + 自动增高,
  保留既有快捷键,并追加 Ctrl/Cmd+G。
- 六个 Icon*16 具名导入在 0.2.0-rc.1 一个不剩(§3.1 第 2 条:缺导出 = render 期
  Element type is invalid),改用 IconSparkleRegular size={14}。
- CSS 类名跟随 dev 的 commit* 前缀(PR 的 gitCommit*/gitSuggest*/gitError 在 dev
  已不存在;错误行改走 dev 的 Notice,不新增自绘错误样式)。
- 消息 source kind 用生产者自有值 plugin:dsh-better-sidebar:0.1.7 起
  kind:'plugin' 会被 format v4 硬拒。
- locales:dev 已删 commitError 锚点,且 19 份词典与 locales.ts 必须键集相等,
  故按各文件在 commit 行后逐份插入,不整份取 PR 侧。

验收:pnpm typecheck 0;pnpm exec vitest run --maxWorkers=3 全绿(163 files /
1836 tests);新增 spec 单独跑绿;真机挂载冒烟未跑(见报告)。

Refs #642

Co-authored-by: rainmanhhh <13862623+rainmanhhh@users.noreply.github.com>
2026-10-05 02:19:58 +08:00
Menghuan1918andwaser0434 900b1592e1 fix(sidechat): bind the native side chat tab to its thread across re-navigation
The native right sidebar keeps at most ONE page tab per kind, so a side chat
tab is never a copy: every open re-delivers the same tab with fresh navigation
params and an incremented `navigation.revision` (verified in the pinned host's
client bundle: `TabDomain.navigate` replaces the whole target and bumps the
revision, and `openContent` settles an already-held page tab through it). Two
opposite mistakes followed from that: `records.ensure` only read the seed
`meta` when it MINTED a record (so the header thread menu closed and nothing
changed — #762), while adopting it on every pass would clobber the thread id
the view writes back through `updateTab` (the orphan `Side: New thread` half of
#684).

Adopt a navigation's `params.meta` exactly once per revision, and reattach an
unbound auto-creating tab to the thread its session was last in instead of
minting another empty one.

Rewritten against the current dev tree rather than merged from the PR:

- #776 (7cf9626) made a record key `(seat session, native tab id)`; the
  revision ledger is keyed the same way and is dropped together with the
  record — in `drop` AND in `retain(sessions)`, which also forgets records.
- dev's existing branch never wrote `meta` and folds a url seed into
  `nextPath`, so the PR's url/meta merge has no counterpart here and is
  deliberately not ported: "revision unchanged" simply leaves `meta` alone,
  which is what keeps #684's other half fixed.
- `updateTab` takes the seat session as its third argument (same commit), so
  the reattach names it like the rest of the view does.
- The "newest real thread, placeholders last" heuristic already exists on dev
  (477f627, the archive fallback); it is extracted into `newestThreadId` and
  reused instead of being copied a second time.
- The remembered thread uses the client store's key space
  (`dsh-sidebar:v1:sidechat-thread`), not the PR's `dsh-better-sidebar:*`.
- `openNewThread` starts the thread first and parks it for `createTab`, and an
  auto-creating tab no longer offers a manual create button while it binds.

Tests (the PR reported none): the revision gate, its no-revision guard (both
fail on the unported adapter), the call-site wiring through `NativeTabBody`,
plus the two dev-side records cases around them.

Refs #839

Co-authored-by: waser0434 <178004182+Waser750@users.noreply.github.com>
2026-10-05 02:19:58 +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 3bd5e1947b Merge pull request #845 from ingeb0rga/fix/ime-guard-synthetic-229
fix(ime-guard): trust keyCode 229 only inside a live composition context
2026-10-05 02:02:20 +08:00
Atlas Zeng 680972dfb1 Merge pull request #612 from wang-kaopu/fix/issue-591-wsl-open-with
fix(open-with): handle external open actions under WSL
2026-10-05 02:02:02 +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
Atlas Zeng ecac7e551d Merge pull request #574 from bulingbuling688/fix/explorer-workspace-mentions
fix(explorer): align directory mentions with workspace-root grammar
2026-10-05 02:01:24 +08:00