Commit Graph
72 Commits
Author SHA1 Message Date
Menghuan1918 c765c3eb49 test: 三条负载/时序敏感用例改成确定性(同一 commit 两次跑结果相反的那三条)
1. `mount.e2e.ts` 的底部工作台入口:入口的既有产品规则是「宿主右侧栏展开时不渲染」,
   而该用例先打开右侧栏、再去等这个入口,实际是在赌 500ms 复检窗口——同一 commit
   一次绿一次红(trace 里该元素在开右侧栏前存在、之后消失)。改为「展开断言 guide →
   收起右侧栏 → 点入口 → 最后重新展开右侧栏做 shadowing 断言」,每一步都等可观测状态。
2. `perf.e2e.ts` 的 `session.cwd` 门槛:15s 窗口 / 5s 节奏下,一个轮询器本身就报 3–4
   次,而「宿主右侧栏是否真的收起了」决定是一个还是两个轮询器。改为 `< visited * 2`
   (修复前 4 个页签是 15),既不再依赖视觉状态,也仍然区分「每会话」与「每页签」。
3. `editor-host.spec.tsx` 的渲染预算 20s → 60s(describe 时钟 35s → 120s)。实测同一
   commit:绿的那次本文件 609ms、红的那次 50554ms(本机 108ms),且三条 `fs.trees`
   应答都在等待开始前就落了地——80× 的 worker 停顿,不是等待太短。断言语义不变:
   行始终不出现仍然失败。
2026-10-16 01:06:50 +08:00
Menghuan1918 57fe6e657d test: 临时目录清理统一走 removeTree(修 Windows 上的 ENOTEMPTY 竞态)
CI 在 windows lane 上红在**清理**而不是断言:
`rmSync(scratch, { recursive: true, force: true })` 抛
`ENOTEMPTY: rmdir …archives-pvpAWR`——刚被 kill 的 zip/tar 子进程(以及刚关闭的
fs.watch / 刚结束的 git 子进程)还没被系统释放句柄,删除于是失败在一个**已经通过**
的用例的 afterEach 里(那一次 2466 个用例全过,只有清理挂掉,整个 lane 变红)。

`maxRetries` + `retryDelay` 正是 Node 为这种场景提供的对策,因此新增
`tests/temp-tree.ts` 的 `removeTree()`,把 30 份 spec(175 处 `{ recursive, force }`
写法)统一换过去,并清掉随之不再使用的 `rmSync` 导入。POSIX 上首次即成功、不触发
重试,行为不变。

本地:typecheck / lint 干净,全量 210 文件 / 2524 通过。
2026-10-16 00:51:11 +08:00
Menghuan1918 ebfb207f08 test(perf): 稳态门禁(跨模块计时器/布局/请求 + 客户端定时器清单)
单模块用例各盯自己的 hook;这条只问跨模块的问题:把真实 Sidebar 壳挂起来、
什么都不给看时,它手里还握着多少会自己跑起来的东西。

- 非 blank 会话只允许存在**一条** 500ms 表(共享的宿主面板展开态),且不得存在 5s
  表(每 tab 轮询已收敛为按会话 + 可见性);收起工作台时壳自己不得发 session.cwd;
  隐藏页面时那条 500ms 表也必须消失,恢复即可重挂。
- 兜底入口在非 blank 会话渲染 null:宿主角落控件在场(measure() 能走到让位走查)
  时命中测试必须为 0——before 侧真机实测 1620 次,after 侧 0。
- 末节是**客户端 setInterval 站点清单**:8 个站点逐一登记「它什么时候停」,新增未
  登记的周期任务即红,登记了门控词却把门控删掉也红(绊线)。
- perf lane 新增 steady-state 指标与两条硬断言(兜底入口不渲染即不得命中测试、
  session.cwd 必须按会话而非按访问过的页签计数)。真机 A/B:500ms 表 3→1、
  5s 表 5→0、空闲窗 session.cwd 15→0、命中测试 1620→0、rect 5190→30。
2026-10-15 23:05:43 +08:00
Menghuan1918 5330eab474 feat(sidechat): 实时推送 + 排队可见 + per-thread 模型选择 + 底栏重构
侧边对话的四处用户痛点,加上「实时 fork」与「隐藏会话」两条路线的可行性结论。
全部结论都有真机复现取证(在运行中的宿主上建线程 + 读真实 session 日志)。

- 排队信息漏入:create 的 `inbox.clear()` 围栏确实生效(真机复现:子会话
  request 只有 [boundary, 问题]);但幽灵来源比文档更宽——父会话 mid-turn 且
  工具未返回时,种子被截断在 `turn/start` 之前,而 inbox 的「领取」splice 发生
  在其后,于是**父会话本轮已领取的输入**在种子折叠里仍是 pending;而冷恢复
  路径完全没有围栏。修法:create 保留硬围栏(本线程自己不可能有排队输入),
  resume 改为 `inheritedPendingIds` 只折继承前缀得到幽灵 id → `inbox.remove(id)`
  精确清扫,绝不误杀用户自己排的队。
- 消息不及时:新增 `/sidebar/ws/sidechat` 推送(`session/event` 60ms、
  `agent/assistant-stream` 250ms 去抖,**纯失效帧**,客户端带 afterSeq 重拉),
  2s 轮询降级为 15s 兜底,断线自愈。
- 模型选不了:宿主对 `origin:'subagent'` 会话**显式禁用**自带选择器,
  `sessionController.selectModel` 又被 subagent fence 挡;插件因此自建
  `sidechat.models`(直通宿主模型目录)与 `sidechat.model`(append
  `model/selection` + `installModelSelection`),并让 `sidechat.info` 报**有效**
  选择而不是冻结的创建期 options。
- 排队可见 / 回显 / spinner / 错误行:`sidechat.events` 增返 `pending`(claim
  顺序)、`sidechat.dequeue` 按 id 撤销或清空、发送即本地回显、立即 thinking
  行、`turn/end{error}` 与失败 attempt 渲染成可见错误行;另修掉「首问未 claim
  时连发第二条会注入第二对 boundary+question」(新增 `boundaryPending`)。
- 底栏重构(用户反馈「注意力全在底栏,看不到上栏的保存为新会话」):顶栏整条
  删除,`[+新建][线程][保存][归档] … [模型选择器][发送/停止]` 与主会话底栏对齐
  (图标靠左、选择器靠右完整显示,agent 徽标不再显示);推理强度改为**平铺行**
  ——宿主 `Menu` 的 submenu 只能开在父项右侧(无翻转开关)且会让整个面板失去
  滚动,钉在侧栏右缘必然被裁;每个控件加宿主 `Tooltip` 悬停气泡(锚在启用的
  span 上,禁用态才解释得了「为什么不能点」),替代原生 title。

设计文档:docs/plans/2026-10-12-sidechat-native-surface.md(含取证、判定、
实施偏差与未验证项);AGENTS §3.4 第 4/10 条同步。

门禁:`tsc --noEmit` / `eslint .` / `vitest run`(2268 passed / 17 skipped)全绿;
宿主半 build + pack 后真实挂载进 sidechat-test profile 并验证新路由与 WS 通道。
2026-10-12 00:56:34 +08:00
Menghuan1918 a0cfd30b48 chore(release): v0.25.0 —— 支持线前移到 DSH 0.2.0-rc.2(npm latest)
- 版本 0.24.1 → 0.25.0;CHANGELOG 的 Unreleased 段落成 v0.25.0。
- **支持线**:peer 下限 `^0.2.0-rc.1` → `^0.2.0-rc.2`,CI 与挂载 lane 的钉版同步 →
  `@deepseek-ai/dsh@0.2.0-rc.2`(`latest` 现在正是这一版),31 个 `@deepseek-ai/*`
  devDependencies 与 lockfile 同批抬到 rc.2,`dsh.plugin.json` 的 engines 同步。
- **0.2.0-rc.1 及更早(含 0.1.7 线)请固定 v0.24.1**:caret 范围跨不过预发布元组,
  `^0.2.0-rc.2` 对 rc.1 判定为 false,会被宿主启动预检整行静默禁用。
- 文档同步:AGENTS §2/§3.0、README / README_EN 的徽章与支持线、接入指南的活跃提法
  (历史发布记录与 docs/plans 里的 rc.1 保留原样,那是记录不是声明)。
- 本版内容与贡献者致谢见 CHANGELOG 的 v0.25.0 段。

门禁:rc.2 上 typecheck / lint 干净,全量 189 文件 2213 通过(唯一红是
`fs-watch.spec.ts` 真起 fs.watch 的并行负载 flake,单跑 6/6 绿,与本版无关)。
2026-10-10 01:16:38 +08:00
Menghuan1918 8e3447b27a revert: 回退「只在未展开时显示底部入口」——把「没展开」理解成了底栏,实际是指右侧面板 2026-10-10 00:35:46 +08:00
Menghuan1918 31b11ef3b8 feat(dock): 底部入口只在未展开时出现(展开态交给面板自己的 ×)
产品决定(用户提的):底栏展开后不再显示头部入口 —— 收起由面板页签条右端那个 ×
负责,头部再来一个「收起」既冗余,又多一个「展开态该把入口摆哪儿」的状态。

- `BottomDockToggle`:`bottomOpen === true` 时返回 null(不再切 aria-label /
  aria-pressed,那个「收起」形态整个去掉)。
- `DockFallback`:同样在展开态不渲染(连空壳也省掉)。

顺带的效果:备用入口与宿主 chrome 争位置这件事,只在**未展开**这一个状态下需要处理。

测试:
- `tests/dock-fallback.spec.tsx` 新增「展开态一个入口都没有」用例(9 条全绿)。
- `tests/e2e/blank-session-dock-entry.e2e.ts` 按新语义改写 —— 原先断言展开后
  `data-active='true'`,现在断言**入口退场、屏上 0 个**,并补上「用面板自己的 ×
  收起后,会话头入口回来且仍只有一套」。**真机跑过:1 passed**。

全量 189 文件 / 2215 通过,typecheck / lint 干净。
2026-10-10 00:33:32 +08:00
Menghuan1918 e4a4c3fa4c merge origin/dev into feat/774-terminal-tab(#774 收尾前置)
dev 前进 12 个提交(titleBar 让位机制整体移除、#132 新建文件与排序三档、
#817 后台激活改标记未读、#412 Windows「在应用中打开」候选链等)。两处冲突,
都是「双方各自新增的内容」,无实质取舍:

- CHANGELOG.md:Unreleased 保留双方条目。#774 一组在最上(本分支的新条目),
  其后是 dev 的「移除 titleBar 让位机制」「#132 新建文件 / 排序」一组,再往下
  是既有的 #109 / #203 一组(与文件里原有的空行分组一致)。
- tests/e2e/mount.e2e.ts:只在下一条用例的标题行冲突——保留本分支新增的底部
  终端用例(#774),标题取 dev 侧的新名(`a shell-stamped render URL mounts
  normally; …`;dev 已把 WCO / preset 两条场景删掉)。
- 21 份词典、AGENTS.md、docs/external-plugin-guide.md、README 自动合并:dev 删的
  12 个 titleBar 词典 key 保持删除,本分支新增的 3 个 terminal 词条保持新增。
2026-10-06 00:07:23 +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 85c7d12785 chore(shell): 删除 titleBar 让位机制及全部相关配置(#430)
插件自 v0.19.0 起不再自绘顶部 chrome:`223b254` 把那三条读 strip 的规则
(`top: calc(var(--dsh-title-bar-strip, 40px) + 3px)` / 右面板
`padding-top: var(--dsh-title-bar-strip, 40px)` / 折叠态 `+14px`)连同自绘
chrome 一起删掉了。此后「位置兼容模式」四方案仍在写
`--dsh-title-bar-strip` + `body[data-dsh-title-bar-compat]`,但**没有任何
消费者**:`src/**/*.css` 零命中,宿主也不读这条契约(DSH 核心整树 grep
`windowControlsOverlay|dsh-desktop-titlebar-inset|titlebarInset|
title-bar-strip|title-bar-compat` 与 `desktopWindow` 全部零命中)。结果是
用户改设置只写变量、什么都不动,而设置项描述(「标题栏条带高度:侧边栏
按钮与内容下移的像素数」)与现实不符。整套删除,不留兼容层。

删除范围(先做了完整消费者普查,见新增的设计文档):
- 计算与写入:`src/client/titlebar-strip.ts`、`src/client/wco.ts`、
  `src/client/shell-presets.ts` 三个文件整体删除;`Sidebar.tsx` 里的 strip
  计算 + 写 `--dsh-title-bar-strip` / `body[data-dsh-title-bar-compat]` 的
  effect 与 `titleBarCompat` 局部量一并清理。
- 壳信号:`desktop-env.ts` 的 `parseDesktopEnv` / `DesktopEnv` /
  `probeDesktopWindow` 与 `context-types.ts` 的 `SidebarDesktopWindowService`
  (含 Insets / DragRegion)删除。#864 新增的 `desktopWindow` 优先读取随之
  消失。**`desktop-env.ts` 文件保留**:同文件的 `hostTransportBase()` 另有
  3 个消费者(`host-route-url.ts` / `TextEditor.tsx` / `changes/DiffPane.tsx`),
  是反向代理前缀与 `dsh-app://` 自定义 scheme 的解析基准,与本机制无关。
- 配置:`titleBarScheme` / `titleBarPresetId` / `titleBarCompat` /
  `titleBarStripPx` 及 `TITLE_BAR_STRIP_{MIN,MAX,DEFAULT}` / `TITLE_BAR_SCHEMES`
  / `TitleBarScheme` / `clampTitleBarStrip`(`prefs-shared.ts` 的字段与默认值、
  `config.ts` 的 schema 字段、`client/prefs.ts` 的读迁移逻辑)。
- 设置界面:常规行的方案下拉 + 「自定义方案」齿轮弹窗 + `titleBarSchemeValue`
  / `onSchemeSelect` / `detectedEnv` / `stripSettingsOpen` 全部删除;
  **自定义 CSS 逃生口保留**,搬到独立的「自定义 CSS」分组,并去掉 scheme
  门控(非空即生效)。`SideCardSection.module.css` 的死样式 `.rowGear` 同步删。
- 词典:21 份(`locales.ts` 的 zh + en 与 19 个 `locales-*.ts`)同步删除 12 个
  只服务这些设置的 key(`settingsTitleBar*` / `settingsScheme*` /
  `presetDshDesktopDesc`);`settingsCustomCssPlaceholder` 的示例改为
  `[data-dsh-bottom-panel]` + `--dsw-font-mono`,不再引用已删变量。
- 文档:指南 §12.1 重写(删四方案 / strip 取值链 / 壳信号 / 迁移,保留用户
  空间 CSS 与两条拖拽区退出)、§7 的 `toggles` 键清单、AGENTS §5 皮肤契约与
  「契约反向引用」;新增 `docs/plans/2026-10-05-remove-titlebar-compat-strip.md`
  记录普查结论与去留理由。`docs/plans/` 的历史文档未改。

迁移安全(旧偏好数据被安全忽略):四个已删键在 OPEN 的宿主 schema 里是未知键,
解析不报错、不写回(`plugin-shape.spec.ts`);客户端 `parsePrefs` 只按声明字段
构造结果,旧键不进入 UI(`prefs.spec.ts`);一次性 `settings.yaml` 回迁按
`Config.dict` 的声明字段过滤,已删键被丢弃而非转发(`smoke.spec.ts`)。
三条新断言都做过变异证伪:让 `parsePrefs` 透传原记录 / 让 schema 重新声明
`titleBarCompat` / 去掉回迁的声明字段过滤,对应用例分别红在
「不要带上已删键」「解析结果不得含该字段」「回迁不得保留该键」。

测试:删除 `tests/titlebar-strip.spec.ts` / `wco.spec.ts` /
`shell-presets.spec.ts` / `desktop-window-strip.spec.tsx` /
`desktop-env.spec.ts`(五个文件断言的行为已整体移除,不留断言已删行为的测试);
`prefs.spec.ts` / `plugin-shape.spec.ts` / `smoke.spec.ts` /
`side-card-section{,-rows}.spec.tsx` 的夹具与断言改写;`mount.e2e.ts` 删掉 WCO
与壳预设两个场景,URL 戳记场景保留挂载与拖拽区断言、只删 strip 断言,
自定义 CSS 场景改为只写 `customCss`。

门禁:`pnpm typecheck`(0 错误)/ `pnpm lint`(0 问题)/
`pnpm exec vitest run --maxWorkers=3` —— 179 文件 / 2075 passed + 13 skipped
(删除前基线 184 文件 / 2117 passed + 13 skipped;差额 = 5 个被删 spec 的
41 条 + `prefs.spec.ts` 净减 1 条)。词典 parity(`locales.spec.ts`)与皮肤
契约(`theme.spec.ts`)均绿。
2026-10-05 23:38:04 +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 f20bd4b0f4 merge #587 into dev(编辑器内查找,README 发布历史与 TextEditor 上下文解冲突)
Ctrl/Cmd+F 文件内查找:接入 @codemirror/search 的 search({top:true}) +
searchKeymap,面板文案走 phrases facet(CmSearchPhrases 隔间,语言切换
就地 reconfigure),20 份词典各新增 15 键。

解冲突:
- README.md / README_EN.md:dev 重排了发布历史,冲突整块为过期上下文,
  取 dev 侧;仅把 PR 的「文件内查找」快捷键表 1 行按 dev 版式补回。
- src/client/TextEditor.tsx:dev 的 #733 readOnly 行与 PR 的查找接线
  插在同一锚点,两段都留(查找两行在 themeComp.of(dark) 之后,仍先于
  编辑器自有 keymap,Escape 优先次序与 Mod-s 归属不变)。

Refs #587
2026-10-05 01:40:51 +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
HuanLinOTO b1c17af429 Merge PR #779: fix(markdown): render anchors without a stray close tag and keep <details> summaries as direct children 2026-10-01 17:18:09 +08:00
ymac 4f57cf886e test(e2e): read the on-screen seat from the visible panel, not any seat
The lane's `onScreenSession` walked every `[data-sidebar-right-session]` element
and took the first without a `hidden` attribute. On 0.2.x the host marks BOTH
each RETAINED seat (one per Conversation stays in the DOM) AND each seat's panel
with that attribute, so the walk could name a background Conversation and the
A → B → A round trip failed on `selectConversation` (real mount lane: expected
`session-eeb1…`, read `session-b8e4…`, 60s timeout).

Read the panel that is actually laid out (`[data-sidebar-right-panel]:visible`) —
the same `:visible` convention the rest of this lane already uses — and keep a
visible-seat fallback. Mount lane: 10/10 (was 9/10).
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
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 98a446bbfc fix(sidebar): 点击展开时文件树整体重建(两处根因)+ v0.24.1
用户报告:「点击展开的时候,文件树会频繁整体刷新,看起来非常难受」。

根因 1(主):src/client/native/index.ts 的 sync() 把 files 接管项当成多余注册。
它按 KIND 记账、永远不在 wanted 里,于是每次 sync 都被 dispose + 重建;而
disposeSubscriptions 同时订阅了 service 与 store,**任何会话状态写入**(展开/收起、
切 tab、拖底部工作台、选中…)都会跑一遍 sync。替换 slot 注册 = 宿主换 slot entry →
插件 tab body 被 unmount/remount → 文件树丢失层缓存、滚动位置与目录 watcher,并重新
fs.trees([root, ...expanded]) 重列整棵可见树。机械证明(临时插桩,已回退):
  [probe-sync] enter live=[editor,git,subagent,sidechat,diff,files]
  [probe-registerSlots] slot inject ran for dsh-better-sidebar:files
  [probe-body] unmount tab3 kind=files
  [probe-body] mount tab3 kind=files
修法:wantsFiles 提前,删除循环里对 files 接管项 skip(禁用 editor 时仍照旧释放)。

根因 2(次):FileTree.tsx 的 retryDir 先把该层缓存删掉再请求,行被「Loading…」
占位替换后重建——目录有外部写入(构建 / 格式化 / 模型跑 bash)时整层闪空。
修法:复用既有 force 路径 loadLevels([dir], { force: true }),保留旧行直到新答案到达
(与 refreshTick 的强制刷新路径行为一致)。

判别性证据(回退任一修复即红)
- tests/native-surface.spec.ts:三次 store 写入不得产生任何注册/注销 → 回退后
  registered 6 → 12、disposed 全是 dsh-better-sidebar:files
- tests/file-tree-batch-load.spec.tsx:重列期间旧行仍在屏 → 回退后层被删空
- 新增真实宿主 lane tests/e2e/zz-expand-refresh.e2e.ts(quiescence 判据,无固定 sleep;
  zz- 前缀保证它最后跑,因为它会自建 workspace + session):A1 展开只请求被展开那一层、
  A2 tab body 存活(不重开 watch socket)、A3 屏上行数不归零;回退修复 1 后退出码 1
  (Error: expanding a folder must ask for that folder, not the whole visible set)

修复后实测(40 子项目录,同一探针/机器/工作区)
| 阶段 | fs.trees payload | 新开 ws | DOM +/- | 被删行 | body 替换 | 层内最小行数 |
| 展开 big | [big](原 [root, big]) | 0(原 1) | +41/-1 | 0(原 45) | 0(原是) | 40(原 40) |
| 外部写入 big | [big] | 0 | +1/-0(原 +41/-40) | 0 | 0 | 40(原 0) |
| 展开 bravo | [bravo] | 0 | +2/-1 | 0(原 45) | 0(原是) | 41 |

证伪记录:新建 fs.watch(dir,{persistent:false}) 在 macOS 上无改动时 0 事件(Node 微
探针两遍 + 8 轮真实时序 + 浏览器侧从未收到 {dir} 陈旧帧)→ src/fs-watch.ts 与
use-dir-watch.ts 一行未改。

验证:pnpm typecheck / lint / test(136 文件 1486 通过 9 跳过,基线 1484 + 新增 2)/ build
全绿;DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = 8/8。
版本 0.24.0 → 0.24.1(package.json / dsh.plugin.json / SIDEBAR_SERVICE_VERSION /
README×2 / CHANGELOG×2 同步)。
2026-09-28 22:33:30 +08:00
ymac 77887e2d93 test(e2e): pin the three painted-state losses a kept-alive body must prevent
The comparison with PR #712 left three of its cases uncovered here: #712
parked an unsaved editor draft, an unsaved commit message and the chosen
worktree in module-level memory and tested each by unmounting. This branch
claims the host's `keepMounted` makes that memory unnecessary, but the claim
was only ever exercised for tree expansion and scroll — the draft was
explicitly recorded as unverified, and it is the one loss a reader cannot
re-derive by looking again.

All three are now measured on a real host, in the retention lane's A -> B -> A
round trip:

- an unsaved EDIT typed into the file's editor must still be in the document;
- an unsaved COMMIT MESSAGE must still be in the changes tab's box;
- the CHOSEN WORKTREE must still be selected, rather than re-derived from the
  inventory.

The lane's workspace becomes a real git repo (idempotently: it persists across
local runs) with one staged change — that is what renders a usable commit box —
plus a linked checkout for the worktree choice. Two host details the lane has
to respect, both recorded in comments: the worktree selector only renders when
the inventory holds more than one entry, and paths are compared through
`realpathSync` because macOS /var is a symlink to /private/var while git
reports the resolved form.

Measured: 8/8 on 0.1.7-rc.1 + headless Chromium, and the full unit suite
(113 files / 1141 tests) stays green.
2026-09-28 11:27:50 +08:00
ymac c390bd6540 test(e2e): prove a kept-alive body does not re-read what it already holds
"State survived" is not the same claim as "nothing was silently reloaded":
the retention lane asserted the visible vector (expansion, scroll, chip) but
never looked at the network, so a body that remounted and refetched
everything would have passed it.

The lane now counts the plugin's own reads. These routes are POSTs, so the
path being listed or read travels in the BODY — the counter parses it, which
is what lets one level or file be told apart from a fresh read. It then opens
a real file in conversation A and requires, on return:

- the file is still open as a tab, and selecting it shows the editor without
  a second `fs.read` of its bytes;
- no `fs.read` of that file happened anywhere in the round trip.

Measured against the real host (0.1.7-rc.1, headless Chromium): zero plugin
reads on returning to A — the seat lands on its previous tab and shows the
content it already holds.

One ordering fact this lane had to be taught: opening a file in merged mode
swaps THAT tab's content to the editor, so the tree component unmounts and
its scroll starts over by design (attributed with a probe: hide/show keeps
320, opening a file drops it to 0). The lane therefore re-builds the scroll
offset after the file step before measuring the conversation round trip,
which is the claim the offset is actually evidence for.
2026-09-28 11:27:50 +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
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
Atlas Zeng e46250ae4d Merge pull request #785 from omdsh-dev/fix/native-leak-guard-tests
fix(native): 钉牢 files 接管泄漏的守护断言 + 记录两条不变量
2026-09-28 11:17:35 +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 85b09d888e test(e2e): 页面内条目替换的部署级回归门(真机红→绿)
在 scratch profile 上用**已发布的 npm 0.22.0** 复现了线上那条报错链:页面内客户端
条目替换(宿主 HMR 的 500ms stat-poll 发现已安装 lib/client.js 的 rev 变化 →
teardown → 重新 import)期间,旧激活的 teardown 触发 sync(),让 files 接管在
inactive ctx 上重建 —— 控制台依次出现

  native register files error: ... cannot create effect on inactive context
    registerSlots ← registerFilesKind ← sync ← notify
  native register files error: ... tab type id "dsh-better-sidebar:files" is already registered
    register ← registerFilesKind ← sync ← notify

新用例 tests/e2e/native-reload.e2e.ts 把这条路径固化进挂载 lane(同一 lane 里
mount.e2e.ts 跑完后跑):utimesSync 已安装的 client bundle → 断言宿主元素被替换
(新激活)、无 native register … error、无诊断条、files 接管重新可用。
CLIENT_JS 从 e2e-mount.sh 已 export 的 DSH_HOME 推导,无需改脚本。

实测(同一台机器、同一份用例):
- npm dsh-better-sidebar@0.22.0:3/3 红(每次都是上面那两条栈)
- 本地打包的修复版:3/3 绿

AGENTS.md §2 补一条说明该门与触发方式。
2026-09-28 11:00:23 +08:00
ymac f5ffd10474 fix(markdown): render anchors without a stray close tag and keep <details> summaries as direct children
Two raw-HTML preview defects (client rendering only, no DSH source touched):

- A stray `</a>` from an author's `<a id="x"></a>` was printed as literal text.
  The host renderer emits one text node per raw-HTML token, so the open tag and
  its close tag arrive as siblings; DOMPurify drops a lone close tag (no element
  children), which fell into the inline pass's "no elements means prose, keep
  the text" branch. The pass now deletes a node that is nothing but a close tag,
  keeping the anchor id and leaving comparison prose (`a < b`, `x </ y`) intact.
- A `<details>` fold showed the UA's own "Details" label while the authored
  summary text dropped into the body: `<summary>…</summary>` is a balanced span,
  so analyzeHtmlSegment reduced it to an `html` leaf wrapped in a block div,
  which is not a direct child of `<details>` and therefore not honored as the
  disclosure widget. The renderer now hoists a leaf-leading summary into a real
  `<summary>` element inside its details frame (attributes via the shared props
  extraction, media/anchors still hardened), with no hardcoded label.

Also scope `.editorMd details > summary { cursor: pointer }` so a hoisted
summary keeps its pointer cursor (the old `.editorHtmlBlock summary` rule no
longer matches once it leaves the leaf wrapper).

Tests: 8 new/tightened cases in tests/markdown-html-render.spec.tsx (13 -> 21),
plus a seeded anchor and direct-child summary assertions in the real mount
smoke (tests/e2e/mount.e2e.ts). Verified pnpm test (113 files / 1140 passed),
typecheck, lint, and pnpm test:mount (7/7).

Fixes #778
2026-09-27 19:45:17 +08:00
jorge guerreroandClaude Opus 5.5 fac59ae2f3 fix(desktop): stop panel host from blocking macOS window drag
The shell's base stylesheet makes every direct body child no-drag
(`html[data-platform=darwin] body > :not(#root)`). The viewport-sized
`[data-dsh-panel-host]` layer inherited it, and since app-region ignores
pointer-events it cancelled every window-drag strip beneath it once the
shell recomputed regions.

Take the host and layer out of the app-region computation (`!important`,
the shell selector carries an id's specificity) and keep the panels
themselves no-drag so their controls still receive clicks.

Fixes #772

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 21:45:48 -04:00
Menghuan1918 6586e3e2d3 feat: adapt to DSH 0.1.7-alpha.1 and yield the read-only previews
DSH 0.1.7-alpha.1 is 1299 commits past 0.1.6-alpha.2 and rewrites four
contracts this plugin was built on. The peer floor moves to
^0.1.7-alpha.1 (semver's prerelease rule means ^0.1.6-alpha.2 can never
match a 0.1.7 prerelease); 0.1.6-alpha.2 and earlier stay on v0.19.1.
Released as 0.21.0-alpha.1 (dist-tag alpha).

Hard breaks:
- dsh-settings was rewritten: register(ns, schema) is gone, a form is
  addressed by the plugin row's Loader entry id and read from the
  module's exported Config. The preferences are merged into Config and
  marked volatile — which requires DSH's own schemastery, because only
  that build wraps a volatile field in the cosmokit reference the
  loader's volatile commit walks. With the public package a settings
  write reports success and revision 1 while the effective value never
  changes.
- ui-primitives renamed its whole icon family (IconXxx14/16 ->
  IconXxxRegular/Medium): 26 imported symbols, 17 files. The failing
  mode is render-time, not load-time. Five call sites that relied on the
  old 14px default now pass size={14} explicitly.
- Session format v4 rejects source.kind === 'plugin'; the side-chat
  boundary injection now writes plugin:dsh-better-sidebar, the same kind
  DSH's own v3->v4 migration produces, so historical threads survive.
  Tool results moved to role 'tool' with top-level content/isError; all
  four parsers accept both shapes.
- The client session snapshot dropped subagentsByParent/jobsBySession
  and the on-demand subagent-catalog observation API. The Tasks page
  reads projectionsBySession and a new jobs.list route.

Yields and convergence:
- The read-only previews go to DSH's documentpreview (Office->PDF, a
  spreadsheet worker, zoom, per-directory refresh); editor.canOpen
  refuses those 26 extensions. Markdown, HTML (with its sandbox
  switches) and the editable code buffer stay.
- The host browser kind is desktop-profile-only now, so the web e2e
  lanes expect no browser entry and assert its absence.
- Link takeover claims only urlTarget links and passes the rest to the
  host, fixing a regression from the 0.1.6 round: the fallback pointed
  at a 'browser' type the plugin no longer registers, so http links in
  its own markdown did nothing.

Also fixed, found along the way:
- The file tree refreshes live (new directory watch over the plugin's
  own socket), since the plugin owns the `files` kind.
- ctx.sessions.list has no `current` field at either tag; the three
  readers were dead. They now use ctx.sidebarRight.mounted.
- package.json.files was missing lib/client-locale.js.
- Two genuinely dead call sites: sessions.openSubagent/open/
  refreshSubagents do not exist on the current baseline, so the
  topology click, the jump-back and the retry were all no-ops.
- The test harness window shim lacked addEventListener, which the 0.1.7
  primitives call at module-evaluation time; and the e2e token exchange
  needs Playwright's request stack, not Node's fetch.
2026-09-22 17:09:08 +08:00
Menghuan1918 5912274e41 feat: yield the terminal and browser to DSH 0.1.6's own sidebar types
DSH 0.1.6-alpha.2 ships a right-Sidebar terminal and a right-Sidebar browser
of its own. Both were things this plugin had built from scratch, so keeping
them meant two implementations of one surface plus a plugin that shadows a
host type the product is actively developing.

Terminal: the plugin's whole PTY stack goes — the UI-tab manager, the
agent-owned registry, the lazy node-pty loader, the eight model-facing
terminal_* tools, the xterm view and its font/link/scrollback helpers, and
the cross-session 'pinned terminal' rail that existed only to keep a terminal
alive across a session switch. The host's terminal kind becomes the only
provider, which also retires the node-pty dependency, its pnpm allowBuilds
entry, and the installer's -Repair mode (issue #140's whole class of
'node-pty failed to load' support).

Model-facing capability note: the plugin used to inject terminal_* tools
(off by default). Those are the model's only cross-call persistent terminal,
and DSH's own equivalent (@deepseek-ai/dsh-tool-terminal) is not mounted by
any shipped bundle, so removing them leaves the model with the one-shot
bash/pwsh tools only. That is the accepted cost of not maintaining a second
PTY surface; the README documents how to enable the upstream toolset.

Browser: the plugin's browser tab type is dropped, so the host's own browser
kind owns embedded pages. The DOM-level link takeover STAYS (it is the only
thing that can route an https link to the system browser by protocol, which
the host does not do) but now delegates to the host's browser tab via
ctx.sidebarRight.openTab('browser', …) with a window.open fallback, and the
two settings that only ever configured the plugin's own iframe (sandbox
escape hatch, loopback allowlist) go with it — along with the host-side
browser.probe route they fed.

Cards: the empty-pane welcome cards adopt the host's guide-capsule recipe
(0.5px l4 hairline, 24px radius, layer-1 fill, 56px floor, 14px/20px padding)
so the plugin's 'pick what opens here' surface reads as the same design as
DSH's own. A theme.spec guard pins the geometry and the token-only paint —
including that the upstream-only --dsw-alias-bg-l1/-l2 spellings (defined
nowhere, so their declarations are silently dropped upstream) never appear
here.

Also drops the dead state the removed features left behind (SidebarTab.pin,
nextTerminal, agentWaits, bottomOpenedOnce, the agent-tab helpers, the
pinned-tab memo key), re-points every test fixture that used them at
surviving equivalents, and prunes the specs of the deleted features.
2026-09-21 20:35:11 +08:00
suiyideali e2f53df484 feat(editor): 编辑器内查找——接入 @codemirror/search(Cmd/Ctrl+F)
- src/client/TextEditor.tsx: 共享扩展表新增 search({top:true}) + keymap.of(searchKeymap)
  (Mod-f 打开、面板固定编辑器顶部、Mod-g / Shift-Mod-g 下一个 / 上一个、Mod-Alt-g
  跳转到行、Escape 关闭)。搜索扩展与代码 / markdown 两个 viewer、只读「预览」与
  编辑模式共用同一份扩展表,不存在仅可编辑的分支;search 注册在编辑器自有 keymap
  之前,Escape 优先关面板(面板未开时 closeSearchPanel 返回 false,仍回落到
  simplifySelection),保存键 Mod-s 位置与优先级不变。
- src/client/cm-search.ts(新增): 面板 chrome 走 --dsw-* 令牌(CodeMirror 自带
  面板按 &light 上灰白配色,深色皮肤下会浮出一个白框);phrases facet 放进
  Compartment,语言切换就地 reconfigure(文档 / 撤销历史 / keymap / 滚动不动)。
- i18n: 新增 15 个 search* key——zh/en 在 locales.ts,其余 19 份词典全量补译
  (tests/locales.spec.ts 的 key-set 相等断言);locales.ts 新增 localeSignature(),
  TextEditor 同时订阅 DSH locale 与 better-locale override(tab-cell memo 不比较
  override,只靠父组件重渲染会漏掉 ja 切换)。
- README / README_EN: 快捷键表各加一行「文件内查找 / Find in file」。
- tests/editor-find.spec.tsx(新增): 扩展含 search keymap、Mod-f 开顶部面板、
  Escape 关闭、语言热切换后重开面板文案跟随、Mod-s 保存键仍生效。
- tests/e2e/mount.e2e.ts: 打开 seed 文件后补 Ctrl/Cmd+F → .cm-search 面板可见、
  Escape 关闭的真机断言(真实 Chromium + 懒加载 client-editor.js chunk)。

背景:package.json 里 @codemirror/search 一直是死依赖(src 零 import),编辑器
没有任何查找面板——Cmd+F 不被 CodeMirror 接管,长文件里浏览器原生查找只能命中
已渲染的行。本次只接入文件内查找,终端搜索(@xterm/addon-search)另开 PR。
2026-09-15 10:42:46 +08:00
Menghuan1918 e567bf6924 docs: record the rc.2 baseline (README badges, guide, AGENTS, plan)
- docs/plans/2026-09-10-dsh-0.1.5-rc.2-adaptation.md: the adaptation plan —
  the upstream rc.1 -> rc.2 delta per affected area, why there is no
  plugin-side code change, and the CI failure taxonomy (A real Windows
  timeouts, B the two silent worker deaths, C the mount lane's npm
  ETARGET/OOM) with the evidence and the fix for each.
- AGENTS.md §2/§3: CI pins rc.2, the mount lane's npm flags and their reason
  (floating transitives + staged prerelease publishing), the Windows lane's
  bounded pool and why, and the primitives-dependencies note extended to rc.2.
- README.md / README_EN.md: support badge (v0.19.1, verified on rc.2), the
  install section's stable-release note (rc.1 hosts need no upgrade — the peer
  floor is unchanged) and a v0.19.1 changelog entry covering the two CI fixes.
- docs/external-plugin-guide.md: baseline line -> v0.19.1 / DSH 0.1.5-rc.1+,
  verified on rc.2.
- Comment-only: `DSH 0.1.5-rc.1` -> `0.1.5-rc.1+` where the note describes a
  behaviour that arrived in rc.1 and is unchanged in rc.2 (native guide
  description rendering, in src/client/native/index.ts, src/client/service.ts
  and the three specs that assert it).
2026-09-11 12:02:44 +08:00
Menghuan1918 725b2f7cec feat(dsh): adapt to DSH 0.1.5-rc.1 and restore the guide description
Baseline moves to DSH 0.1.5-rc.1 — the 0.1.5 line's first release
candidate, and the npm `latest` dist-tag now: peer floor ^0.1.5-rc.1,
devDependency pins, the CI mount-lane pin and dsh.plugin.json engines
all follow. 0.1.5-alpha.2 users stay on v0.19.0-alpha.1.

The upstream delta from alpha.2 is small: 373 changed files, mostly
version bumps, sidebar preview polish and test snapshots. Exactly two
changes touch this plugin, and only one needs work:

- `SidebarRightGuideEntry.description` is back (optional). The native
  guide renders it only while it lists at most 4 entries; a longer list
  drops every description. The plugin restores `TabDescriptor.description`
  and the six built-in `guideDesc*` lines (20 dictionaries) verbatim from
  0b6ac5d^, but deliberately does NOT restore the old generic
  `nativeGuideDesc` fallback: the host has no fallback of its own, so a
  descriptor that declares none now ships no `description` field at all
  and renders as a clean title-only capsule.

  Consequence worth knowing: the plugin contributes six guide entries, so
  the default composition is over the 4-entry limit and shows titles only.
  The mount lane proves the restored field end to end by shrinking the
  enabled set to three types through the plugin's own settings route
  (scratch profile only) and requiring the Files capsule to grow its line.

- The built-in `files` type declares a guide description again and uses a
  coloured folder glyph; the plugin owns that kind, so nothing to do.

Verified unchanged from alpha.2 (so nobody re-checks them): the global
main-panel model, the file address grammar (util/workspace-path changed
only its package.json), the native tab-body host contract (.paneBody is
still a block scroller with a definite height), the core/agent/session/
subagent host APIs and the ui-primitives export surface.

Restore caveat fixed in the lane: the settings route merges patches
key-wise, so undoing a temporary `tabsEnabled` change by posting the
original (empty) map leaves the disabled keys behind — the e2e restores
every key it touched explicitly.
2026-09-10 14:41:16 +08:00
Menghuan1918 0b6ac5d267 feat(dsh): adapt to DSH 0.1.5-alpha.2
Baseline moves to DSH 0.1.5-alpha.2 only (peer floor ^0.1.5-alpha.2,
CI pin, manifest engines); alpha.1 users stay on v0.19.0-alpha.0.

Host-contract changes handled:
- the native guide entry lost its `description` field (entries are
  icon+title capsules now): `TabDescriptor.description` and the six
  `guideDesc*` keys plus the `nativeGuideDesc` fallback are removed.
- the file address grammar changed: `fileAddressFor` always returns a
  session-scoped address (absolute paths keep their leading `/`),
  `parseFileAddress` is prefix-based and strips `?`/`#`. The plugin's
  purity-gated mirror follows.
- global main panels replaced the `conversation` root slot with the
  keyed `main` slot (`main.conversation`): the bottom workbench's
  center-column locator now accepts both keys and skips
  `display: contents` slot hosts.

Fixes a pre-existing fill bug the alpha.2 probe made obvious: the native
tab body host is a block scroller with a definite height, so tab roots
that only declared `flex: 1` collapsed to content height and the side
chat composer drifted off the pane bottom. The native adapter now wraps
every tab body in a `height: 100%` column flex host.

Also promotes the dependencies `dsh-client-ui-primitives@0.1.5-alpha.2`
dropped from its manifest (anser / shiki / mdast-util-* / micromark-* /
katex / @shikijs/langs) and the newly unmet `dsh-session-persistence`
peer into devDependencies.
2026-09-09 23:09:48 +08:00
Menghuan1918 223b2545d9 refactor(shell): retire the plugin's own right panel and free windows
DSH 0.1.5 owns the right column (its native Sidebar hosts every tab type
this plugin registers), so the plugin's own right panel, its width drag /
new-session seed prefs, and the free-window feature are gone. The bottom
workbench is the only plugin-owned surface left, and its expand/collapse
control is registered into DSH's session-header utilities list slot (the
header's corner seat belongs to the native sidebar's own control).

- state: one `bottomSplits` tree; `makeDefaultState()` takes no arguments;
  `toggleBottomPanel` / `openTabInBottomPane` are the only landing
  reducers; `setBottomHeight` and `sanitizeState` share the
  `CONVERSATION_MIN` cap (a persisted tall height no longer snaps on the
  first drag).
- service: every landing in the workbench (creation or focus) expands it;
  `SIDEBAR_FEATURES` drops `'floatWindows'`; the open/close/activate tab
  pools cover the single tree.
- shell: `Sidebar.tsx` renders only the bottom workbench; the toggle lives
  in `sidebar/bottom-toggle.tsx`; layout-push pushes height only (no width,
  no `--dsh-sidebar-width`).
- prefs: `openByDefault` / `defaultWidthPercent` / `changesDiffFloat`
  removed from the schema, defaults, client parser, settings page, and all
  20 dictionaries; the retired keys in stored documents are ignored.
- tests: free-window specs deleted, panel/float assertions dropped,
  remaining suites adapted (124 files / 1287 tests); the mount lane asserts
  the header toggle and sweeps the native sidebar's guide page.
- docs: README / README_EN / guide §0,§11 / AGENTS test map.
2026-09-09 15:18:06 +08:00
Menghuan1918 51546f7433 feat(native): render the plugin's tabs in DSH's native right Sidebar
Phase 2 of the 0.1.5 adaptation: the plugin stops drawing its own right
panel and contributes tab TYPES to DSH's native right Sidebar, which owns
the right column. The bottom workbench (terminal dock) stays plugin-owned.

Registrations (src/client/native/):
- every TabDescriptor becomes a native tab type (kind = descriptor.id, the
  default `extension` band) plus a keyed body in `sidebar.right.pane.tab`
  and a live chip title in `sidebar.right.pane.tab.title`
- the `editor` type also claims `dsh-resource://file/**`, so it outranks
  the built-in `text` preview (fallback) and every file the product opens
  lands in the plugin's editor
- the built-in `files` page kind is TAKEN OVER by an extension
  registration of the same kind: `openTab('files')` draws the plugin's
  explorer, and the built-in resumes when the plugin unregisters
- registrations follow the plugin registry + the side-card settings: a
  type registered later (external plugin) gets its native type too, a
  disabled type is unregistered (absent from the guide, refuses opens)

Adapter (src/client/native/tab-adapter.tsx):
- one synthetic plugin `SidebarTab` per native tab id, minted from the
  native record + navigation params (or the descriptor's own createTab,
  which a native guide open bypasses), kept live across navigations and
  updateTab writes
- the explorer's per-tab expansion/reveal sets and the per-kind instance
  counter, which the plugin's own layout used to hold

Service routing (src/client/service.ts):
- `setSurface` installs the native write face; openTab/openFile land
  natively (a path becomes a resource address, a path-less editor open
  becomes the `files` page, the rest carry the seed as navigation params),
  closeTab/updateTab/activateTab recognise native tab ids
- new optional `OpenTabSeed.target` ('right' default, 'bottom' keeps the
  bottom workbench); the bottom panel's own + menu and auto-terminal pass
  'bottom'
- src/client/native/surface.ts probes the controller's per-session writes
  (`openTabIn`/`openResourceIn`/`closeIn`, not in `ISidebarRight`) and
  queues opens for a session whose surface is not mounted yet

Right panel retired behaviourally (Phase 3 deletes the code): Sidebar
renders its bottom workbench only, keeps the panel collapsed, and hides
the right-panel toggle. The panel-specific e2e specs are removed; the
mount lane now drives the native guide (tab sweep), the plugin explorer
inside the native pane (editor/mermaid/README chunks) and the sidechat
host routes.

Verified: pnpm typecheck / lint / build / test (126 files, 1349 tests) /
check:consumer-types, plus pnpm test:mount against a real
@deepseek-ai/dsh@0.1.5-alpha.1 host (7/7).
2026-09-09 11:47:31 +08:00
Menghuan1918 ba0114749f feat(dsh): adapt to DSH 0.1.5-alpha.1
Move the plugin onto the DSH 0.1.5-alpha.1 baseline (peer floor
^0.1.5-alpha.1, CI pinned to the alpha dist-tag) and fix the two host
contract changes that alpha line introduced.

Baseline:
- all @deepseek-ai/dsh-* peer/dev deps -> 0.1.5-alpha.1; optional peer
  @deepseek-ai/dsh-client-ui-sidebar-right (declared, unused until the
  native-surface phase); devDep @deepseek-ai/dsh-agent-loop (inbox fold)
- dsh.plugin.json engines >=0.1.5-alpha.1; version 0.19.0-alpha.0;
  SIDEBAR_SERVICE_VERSION follows

Live assistant stream (assistant/chunk is gone):
- 0.1.5 publishes in-flight model deltas as process-local
  agent/assistant-stream frames instead of durable assistant/chunk events
  and embeds the settled stream in assistant/message / assistant/attempt.
  src/assistant-live.ts folds the frames into a bounded per-session buffer;
  sidechat.events serves the current attempt as `live` rows (replaced every
  poll, never a delta) and the transcript renders them; the inherited
  in-progress snapshot reads message content / attempt stream / live frames.

Cold session reads (persistence.inspect is gone):
- 0.1.5 reads a stored session through an explicit read handle
  (open(id,'read') -> handle.read() -> close()). src/session-store.ts owns
  that protocol; every cold read (sidechat transcript, cold-resume preset,
  session.cwd, changes replay) goes through it.

Dead code and docs:
- drop the remote.session.openWorkspacePath interception: 0.1.5's chat opens
  files through ctx.sidebarRight.openResource instead, so the wrapper had no
  caller and would hijack the host's "open in app" gesture; the
  interceptOpenPath pref, its settings row and its locale keys go with it
- AGENTS.md §3 + external-plugin-guide.md describe the new baseline
- vitest setup bridges Node's localStorage accessor to jsdom's store (the
  pre-existing 26 failures on Node >= 22)
- desktop-layout e2e seeds through host RPC and types into the Lexical
  composer (0.1.5 replaced the textarea) instead of driving the directory
  picker

Verified: pnpm typecheck / lint / build / test (124 files, 1327 tests) /
check:consumer-types, plus pnpm test:mount against a real
@deepseek-ai/dsh@0.1.5-alpha.1 host (18/18).
2026-09-09 11:15:30 +08:00
Menghuan1918 76b57508f4 fix(ui): compact context menus + viewport-clamped submenu flip
减重:全部右键菜单(FileTree 行菜单 / TabBar tab 菜单 / GitLens 文件与
历史菜单 / FreeWindow 标题菜单)与「+」菜单切到宿主 Menu 原语的 compact
密度(26px 行高 / 12px 字 / 164px 卡片),图标随槽位 16→14,「打开方式」
子菜单图钉 20→16,还原工具型右键菜单的趁手感。

越界:宿主子菜单纯 CSS 定位(从父行向上、向右生长)不受视口钳制——树顶
部右键时「打开方式 ▸」子菜单伸出视口上沿,窄面板(280–400px)时伸出右
沿。新增 menu-flip.ts:菜单打开期间在 <body> 发布 data-dsh-sidebar-submenu
="down|left" 方向 token(y < vh/2 → down;x + 400 > vw → left),layout.css
据此翻转子菜单生长方向与 ::before 悬停桥;属性存续期即作用域,宿主自有
菜单不受影响。刻意不做 max-height 滚动钳制——overflow 裁剪会切断悬停桥。

测试:menu-flip.spec.tsx(token 纯函数 + hook 生命周期 + CSS 契约跨文件
一致性);tab-bar / file-tree 两个 spec 追加翻转向量断言;mount.e2e 追加
compact 行高(≤30px)布局级证据。设计偏差记录同步至
docs/plans/2026-08-22-open-with-menu-design.md。
2026-09-04 20:28:35 +08:00
laoyh e12927e8a9 fix: preserve desktop shell layout with side card 2026-09-02 23:37:40 +08:00
Menghuan1918 e06ce8cef1 test: fix the perf lane's resource typing for typecheck
getEntriesByType widens to PerformanceEntry; transferSize/
decodedBodySize live on PerformanceResourceTiming (the e2e specs sit
outside tsconfig.build.json, so the bundler never saw this).
2026-09-01 16:07:33 +08:00
Menghuan1918 cf542d6318 perf: tag the center column instead of a :has() selector; stop re-stringifying the editor doc per keystroke
The bottom-push rule anchored on #root :has(> [data-slot=conversation]):
a :has() match cache invalidates on every #root subtree mutation, and
the streaming chat mutates that subtree constantly — every layout-push
frame (the bottom drag writes --dsh-sidebar-height per frame) paid a
whole-document selector re-evaluation. The shell's locator (which
already holds the measured column node for the ResizeObserver) now
tags it with [data-dsh-center-col]; the rule evaluates once per node.
The tag retargets with the ref on boot swap / HMR node replacement and
is removed on unmount; the drag lane pins exactly-one-tagged-node and
its identity as the conversation slot wrapper's parent. The dead
[data-pane] branch (renamed away in alpha hosts) is gone.

TextEditor: the CodeMirror updateListener re-stringified the WHOLE
document into React state on every keystroke (O(docLength) per key,
re-rendering the shell per key). The listener now only flips the dirty
flag; the preview's draft is snapshotted from the live view when
entering preview (or on a content swap), and save() already reads the
live document.
2026-09-01 16:01:34 +08:00
Menghuan1918 e2699a099e test: add the perf measurement lane (mount latency, longtasks, bundle cost, drag frames)
A measurement harness, not a pass/fail gate (beyond the mount sanity
it shares with the other lanes): an init-script probe samples the
navigationStart → host-attach latency, a longtask collector runs
through the full built-in tab sweep, sidebar-shaped resource entries
report transfer/decoded/duration, and a frame sampler records the
bottom-strip drag's pacing (p50/p95/max) plus the width-leak guard.

Results print as single-line PERF_JSON records so a shell run can tee
and grep them; before/after comparisons land in
docs/plans/2026-08-31-perf-optimization.md. Baseline (main @ d70db8f,
3 runs): mount ≈ 377ms, 2 longtasks ≈ 161ms, drag p95 = 10ms,
width leak = 504px.
2026-09-01 15:58:44 +08:00
Menghuan1918 659c2a20e2 fix: bottom-strip drag no longer leaks the panel width into the host layout
The bottom drag applied the panel's persisted width preference to
--dsh-sidebar-width regardless of panelOpen (only the idle push effect
gated it through layoutPushSize). With the right panel closed, the
first drag frame jumped the variable 0 → ~400px: #root lost 400px
instantly, the host frame's viewport dropped across its 1024px
auto-collapse breakpoint, and the NATIVE left sidebar snapped to its
56px rail — then snapped back on release. The bottom strip is the only
drag reachable with the panel closed, which is why only it showed.

applyDrag now rides the same gate as the push effect for the PUSHED
width; the panel-side DOM writes (panelRef/bottomRef/lastDragSize)
keep the raw width — the bottom panel's right edge derives from it.

The e2e regression pins the pose: panel closed + bottom open, drag the
strip, and every sampled frame must keep the pushed width at 0, the
host grid template, the left column width and #root's right edge
unchanged. Verified red on the old code (leaked 504px).
2026-09-01 15:58:44 +08:00
Menghuan1918 24a3813c63 feat!: 合并 Git 面板与文件追踪为统一「文件变动」tab(双视角 + 统一 diff 栈)
在 PR #471(file-trace)基础上的演进:

- 合并 tab:git tab(id 保留,兼容持久化布局)升级为「文件变动」双视角
  tab——Git 视角(原 GitView 全部能力:staged/unstaged/提交/历史/worktree·
  子仓库选择/右键菜单/确认弹窗)+ 本轮文件视角(原 file-trace:会话事件
  日志实时折叠的模型读写编辑记录,按文件分组、新增类型筛选 chips、相对
  时间);file-trace tab 移除(未随任何版本发布)。
- 统一 diff 组件:新 src/client/diff/ 模块(rows.ts 引擎 + DiffRows/
  DiffFiles 渲染器 + highlight.ts 语法着色)——git diff 与会话操作 diff
  共用一套渲染:mod 改写配对(del-run/add-run 对半标蓝)、行内字符级
  高亮(修复了旧实现旧侧失配不高亮的问题,改为行对象身份键)、上下文
  hunk 折叠、git hunk 间未输出区间按行号范围生成不可展开折叠、语法着色
  色相落位 diff 三色空档、+n −m 统计 chips、行底色 tint;DiffTab 改用
  该栈(git diff tab 从此也有高亮)。
- 交互:两视角共用底部可拖拽预览面板(点击文件/提交/操作即预览,不再
  直接开 diff tab;面板可刷新、可键盘/拖拽调高、git 目标可一键展开为
  独立 diff tab);视角选择与面板高度持久化在 tab.meta;git 行 XY 徽章
  按状态字母着色;选中行高亮。
- i18n:fileTrace* 十键重命名为 changes* 前缀,git 键值更新为「文件
  变动」,新增 7 键(视角/筛选/面板操作),全部 21 个词典同步。
- 结构:src/client/changes/(ChangesTab/GitLens/SessionLens/DiffPane/
  ops)+ src/client/diff/;GitView/DiffView/filetrace/ 删除;git 样式
  从 sidebar.module.css 迁至 changes.module.css。
- 测试:builtins 8→7(git tab 承接 badge pin)、diff-rows(unified
  转换/mod 配对/间隙折叠/统计)、changes-tab(壳交互 jsdom)、
  diff-files-collapse(原 DiffView 折叠行为钉住)、changes-ops(原
  filetrace 数据层)、git-view-worktree 迁移至 GitLens;全量 1122 通过。
- 文档:README ×2 功能矩阵合并、external-plugin-guide §4.4 与内置清单
  7 tab、mount e2e 菜单标题同步。
2026-08-31 01:31:22 +08:00
Menghuan1918 07eebbbad0 feat!: move to the alpha track — DSH 0.1.2-alpha.x only (v0.18.0-alpha.0)
DSH itself is still on its 0.1.2-alpha line (npm `alpha` dist-tag), so the
plugin mirrors it: v0.18.0-alpha.0 publishes under the npm `alpha`
dist-tag and supports DSH 0.1.2-alpha.x only. Stable-DSH (0.1.0-rc.8 ~
0.1.1-rc.2) users stay on v0.17.1 (npm `latest`). Verified end-to-end
against a real 0.1.2-alpha.2 host: full vitest suite, typecheck,
build/pack, consumer type surface, and the headless mount smoke 14/14
(the prerelease version also passes `dsh plugin add file:`).

- peer floor raised `^0.1.0-rc.8` -> `^0.1.2-alpha.2` (the mount install
  no longer warns: the old floor could not semver-match a prerelease
  host); dsh.plugin.json engines.dsh `>=0.1.2-alpha.2`.
- Dropped the pre-alpha compatibility layer:
  - e2e host RPC collapsed from the dot/slash dual dialect to slash-only
    (rpcAttempt; the 404-probe negotiation and its cache are gone), and
    parseLaunchUrl now requires the ?token= launch URL;
  - MarkdownText labels collapsed to the nested single shape (the cast
    became unnecessary against the alpha.2 declarations);
  - the defunct `@deepseek-ai/dsh-client-runtime` row is gone from the
    chunk externals allowlist (chunk-loader / tsdown / two specs) and
    from dsh.client.inject.
- market-manifest guard now allows an exact prerelease version (alpha
  cuts are not the market's verified `latest` target); release.yml picks
  the npm dist-tag from the version (prerelease -> `alpha`, else
  `latest`) so an alpha can never hijack `latest`.
- Docs retargeted: AGENTS.md §2/§3, README/README_EN badges + v0.18.0
  -alpha.0 section + install note (`dsh-better-sidebar@alpha`), guide.
2026-08-30 23:42:16 +08:00
Menghuan1918 28447ca2e8 fix(sidechat): read the transcript through the plugin's own events route
DSH 0.1.2-alpha.1 removed the client `ctx.connection.api` face (Remote
gateway migration), so every Side Chat transcript poll (`sessions.history`)
threw TypeError into the view's catch and was swallowed — the tab rendered
an empty transcript forever, silently (no console error, so the mount lane
never caught it). The successor APIs are not a drop-in either:
session/follow|page reject plain session addresses for origin:'subagent'
logs (agent-busy fence) and paging cannot read past the current cursor.

Move the transcript to the plugin's own wire — one transport for every
DSH generation:

- new `sidechat.events` route: live threads read the in-memory
  `agent.session.events`; cold threads read `sessionPersistence.inspect`
  (both seams exist since 0.1.0-rc.8; alpha.1's inspect returns the
  expanded logical log, never the packed chunk-row encoding). The
  inherited seed is cut host-side (`threadOwnLogEvents`), polls ride an
  `afterSeq` delta, and the response is tail-capped at 8000 events (the
  old client walk ceiling).
- SideChatView.fetchThread is single-path; collectOwnEvents (the client
  walk) is gone, and so are the ctx.connection mirror and inject entry
  (no consumer left).
- transcriptRows keeps re-cutting at session/end-seed as defense in
  depth.

Verification:
- unit: sidechat.events route (seed cut, afterSeq delta + never
  resurrecting the seed, cap, cold/live sources, 404/503/bad-request),
  full suite 1104 passed; typecheck and build (purity gate) green.
- mount e2e vs a real dsh-v0.1.2-alpha.1 source build: 14/14, including
  the Side Chat tab sweep polling sidechat.events (performance resource
  assertion) and live + post-dispose (persisted) route reads.
- mount e2e vs PATH dsh 0.1.0-rc.8: 14/14 (no regression).
2026-08-30 22:25:45 +08:00
Menghuan1918 50e05ecea0 docs(agents): slim AGENTS.md to repo-global rules, single-source the API reference
AGENTS.md (546 -> 63 lines) now carries only project-global development
rules: hard constraints, mount-smoke CI, DSH 0.1.2-alpha.1 adaptation
notes, npm release, a quick-rule list, and a docs/tests map. The
consumer plugin API reference lives solely in
docs/external-plugin-guide.md.

Reference sync:
- README/README_EN: collapse the dual 'full integration docs' links to
  the guide; AGENTS.md stays linked as the repo rules
- shell-presets.ts / mount.e2e.ts comments: skinning contract pointer
  moved from AGENTS.md §8 to guide §12
2026-08-28 21:42:39 +08:00
Menghuan1918 6cfe7a736f feat: adapt to DSH 0.1.2-alpha.1 (Remote gateway + token auth + MarkdownText labels)
Dual-version compatibility: the plugin now works identically on
0.1.0-rc.8 ~ 0.1.1-rc.2 and 0.1.2-alpha.1 (the latter verified against a
source build of the dsh-v0.1.2-alpha.1 tag: mount smoke 14/14 + aggregate
double-mount; 0.1.1-rc.2 re-verified 14/14).

- MarkdownText: alpha.1 renamed the flat optional `codeLabels` prop to a
  required nested `labels: { code: {copyLabel, copiedLabel}, footnotes }`;
  the old prop alone crashes fence rendering with "reading 'code'". All
  four render sites (mermaid / MarkdownHtml / TextEditor / SideChatView)
  now go through src/client/markdown-labels.tsx (dual-shape object passed
  under both prop names).
- e2e mount lanes speak both host dialects (tests/e2e/host-protocol.ts +
  host.ts, unit-locked by tests/e2e-host-protocol.spec.ts):
  - one-time-token browser auth: the launch URL grep extends past the
    `/?token=` query (truncating at `/` loses the token), goto navigates
    the token URL (browser cookie exchange), and stamped navigations
    pre-seed the context cookie via addCookies — the exchange 303 drops
    sibling query params;
  - Remote gateway: dot endpoints first, slash endpoints on 404 fallback,
    with args keyed by the controller parameter name (workspace/create ->
    {request}, session/list -> {_request}; verified on a live host).
- package.json: drop the @deepseek-ai/dsh-client-runtime peer (package
  removed upstream in alpha.1; zero references in the source — the chunk
  externals entry stays and is resolution-tolerant).
- scripts/e2e-mount.sh: fix a latent set -u crash in the npx fallback
  branch ($DSH_CMD followed by a full-width comma parsed as part of the
  variable name).
- CI pin stays at @deepseek-ai/dsh@0.1.1-rc.2 until alpha.1 publishes to
  npm (comment updated); README/AGENTS document the new contracts.
- Version lockstep bumped to 0.17.1.
2026-08-28 04:20:36 +08:00