Menghuan1918
1748c7b0d4
feat(editor): LLM 改完文件后自动刷新正在看的预览(#855)
...
模型在会话里 write/edit 一个正开着的文件后,侧栏里仍是旧内容,只能手点刷新或
关掉重开——加载 effect 的依赖里没有任何一项会因写盘而变化,keepMounted 又让
切走再切回不重挂。
信号源用插件自有的 `changes.ops` 增量流(宿主按 seq > afterSeq 下发 tool/call +
tool/result,客户端折成文件操作),不新增第二个轮询机制:没有 fs.watch,也没有
任何周期性的 fsRead 指纹轮询。
- 新增 src/client/ops-stream.ts:每会话一条流 + 成员选举一个 leader,只有 leader
跑 usePolling(self-scheduling,2.5s,与文件变动页会话透镜同一路由同一节奏)。
一个会话开 N 个编辑器 tab 每 tick 仍只有 1 个 changes.ops 请求;成员全部离开即
停轮询但保留游标与已发布状态,页签回来时补折离开期间错过的增量。
- 只发布结算成功的 write/edit(running === false && !isError);第一帧是基线,
打开前已结算的写入一律不触发。
- 命中判定 fileOpKey(cwd, path):resolveSidebarPath 归一相对路径 + `.`/`..` 词法
折叠 + 分隔符统一 + Windows 盘符/UNC 大小写折叠。
- EditorHost:命中且非 dirty、非编辑态时 setReloadSeq(+1)——复用页头刷新按钮那条
完全相同的加载路径,手动入口原样保留。脏态优先:dirty 时绝不覆盖用户输入。
测试 tests/editor-auto-refresh.spec.tsx(12 例,jsdom + 假计时器),逐条做了
「还原源码即红」的变异验证;#167 的既有 4 条未改动。
docs:接入指南 §5.2 与行为差异表、CHANGELOG、设计文档。
2026-10-06 00:34:42 +08:00
Menghuan1918
76cf851a45
merge feat/363-md-cross-file-anchors into dev(#363 Markdown 跨文件 / 锚点导航:官方 MarkdownDelegateProvider + %23 片段载体认领本地 .md 链接、标题获得与 GitHub 一致的 slug id、空锚点隐藏、跨文件待处理锚点表;含验证 reject 后的修复:slug 不 trim/不折叠空白/删 VS16 使两份 README 的 TOC 锚点 0/15→15/15、共享围栏 mask 修 ~~~ 与图片 pass 的既有盲区、滚动宿主祖先分支的 shipped 用例)
...
# Conflicts:
# CHANGELOG.md
2026-10-06 00:19:47 +08:00
Menghuan1918
fab329d469
fix(markdown): match GitHub's heading slug and mask ~~~ fences ( #363 )
...
Two defects the independent verification rejected, plus the test gaps they
left behind.
1. `githubHeadingSlug` was not GitHub's slugger. It trimmed and collapsed
whitespace runs (GitHub does neither: every space becomes its own dash) and
kept `\p{M}`, which left the variation selector of `🖼️ ` inside the id. The
consequence was the issue's main scenario: the repo's OWN READMEs resolved
**0 of 15** table-of-contents anchors, and the click was claimed yet did
nothing (`scrollTop` stayed 0). The slug is now `toLowerCase()`, drop
pictographs / `\uFE00-\uFE0F` / regional indicators / `\p{C}`, drop
everything that is not a letter, digit, combining mark, space, `-` or `_`,
then each space → `-`. Emoji are removed here because GitHub removes them
while RENDERING the heading (to `<img>`) before its slugger runs; that is
the one deliberate difference from `github-slugger`, and it is what turns
`🚀 安装` into GitHub's real `-安装`.
2. Both source rewriters inlined a fence mask that only recognised ```, so a
link or image demonstrated inside a `~~~` fence was rewritten
(`[y](./b.md#u)` → `[y](./b.md%23u)`; the image half predates this feature:
`rewriteLocalImageUrls('~~~\n\n~~~')` already produced a
`/sidebar/file` URL on 58d7f71 ). One shared mask now lives in
`src/client/markdown-code.ts` (CommonMark: 3+ backticks OR 3+ tildes, a
closing fence no shorter than its opener, an unclosed fence running to the
end of the text) and both passes use it.
Evidence (all on the merged tree, HEAD after `git merge origin/dev`):
- Real `TextEditor` + real host `MarkdownText`, every TOC anchor clicked:
README.md `0/15 → 15/15`, README_EN.md `0/15 → 15/15` (shipped as a case in
tests/markdown-surface.spec.tsx; the id-level counts are 0/16 → 16/16).
- Parity against the actual `github-slugger@2.0.0` regex (vendored in
tests/helpers/github-slug-reference.ts), plus explicit emoji/VS16 cases.
- Mutation: restoring the old trim+collapse+`\p{M}` slug reddens 9 cases
(both README cases included); dropping the tilde fence reddens the new
fence case in BOTH the link and the image spec; forcing `scrollHostFor` to
return the container reddens the two new ancestor-scroller cases.
- `scrollHostFor`'s ancestor branch was unreachable from the shipped suite
(the mutation above used to leave 33/33 green): tests/markdown-surface.spec.tsx
now injects the computed style (`overflowY: auto` + `scrollHeight`/
`clientHeight`) and asserts the write lands on the ancestor, that neither
`window.scrollTo` nor `scrollIntoView` is called, and that the container's
own `scrollTop` is never written.
Also: the untrue "exactly like GitHub does" comment, four-form fence cases per
pass (``` / ```` / ~~~ / an inline span inside ~~~), a CHANGELOG entry, and the
recorded narrow edges (a destination with an escaped parenthesis or a
single-quoted title is not claimed — plain text, unchanged; `#L24` does not
jump to a line).
Gates: typecheck / lint clean, `vitest run --maxWorkers=3` 182 files, 2120
passed | 13 skipped; `pnpm build` complete; mount lane
(`DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount`)
9 passed (2.0m), exit 0. The bare `pnpm test:mount` now dies in preflight
because the installed CLI is 0.2.0-rc.2 while the baseline pins 0.2.0-rc.1;
the lane count is 9 rather than the verifier's 11 because merging origin/dev
removed the two WCO/preset cases with the titleBar mechanism.
2026-10-06 00:19:11 +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
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
5b768c86f3
Merge remote-tracking branch 'origin/dev' into feat/363-md-cross-file-anchors
2026-10-06 00:05:02 +08:00
Menghuan1918
ab0d40dee8
test(markdown): give each case its own session; encode a query inside a carried fragment ( #363 )
2026-10-05 23:51:31 +08:00
Menghuan1918
cfe84c99b3
feat(markdown): claim local .md links and navigate headings across files ( #363 )
...
Markdown surfaces the plugin draws (editor preview, side-chat transcript,
changes reading pane, task note) now open local markdown links in the sidebar
and follow same-page / cross-file heading anchors.
The host renderer decides what a local destination even is: without a
`MarkdownDelegateProvider.openFile` a local link renders as plain text (there is
no `a[href]` to intercept), and `parseFileLink` accepts a fragment only in the
line grammar (`#L24`), so a heading fragment makes the whole destination
unparseable. So the claim is scoped by the provider (one per surface) and a
SOURCE pass carries a heading fragment past the parser as `%23` — the same shape
markdown-images.ts already uses for relative image destinations. Destinations
the plugin does not claim (non-markdown, remote, queried) keep rendering exactly
as they do today.
- `markdown-navigation.ts`: pure link judge + GitHub heading slugs (Chinese kept,
duplicates `-1`, authored ids reserved first), collapsed-anchor hiding, the
source rewrite, the jump that scrolls the surface's OWN scroller (never
`window`/`scrollIntoView`), and the session+path keyed pending fragment table.
- `use-markdown-surface.ts`: one hook per surface — the container callback ref
(DOM pass + mutation re-runs + pending fragment) and the delegate's `openFile`.
2026-10-05 23:43:14 +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
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
70d0f8fa09
Merge branch 'dev' into pr/817-dev
2026-10-05 23:18:36 +08:00
Menghuan1918
235212e72a
merge fix/412-win32-open-external into dev(#412 Windows 在应用中打开:cmd start → rundll32 候选链,元字符 URL 跳过 cmd;全失败返回结构化错误并落到 UI 提示条,不再静默成功)
2026-10-05 23:17:33 +08:00
Menghuan1918
f894786e1f
fix(sidebar): 补齐 #817 的两条设置项文案(zh 写成了英文、en 未改)+ 同步接入指南
...
复核节点在 de1e76e 上实测出三处必修项,本提交逐条收口(行为零改动):
- R1(用户可见回归):`locales.ts` 的 **zh** 词典里 `settingsSubagentDesc` /
`settingsJobsDesc` 被写成了**英文**句——紧邻的 `settingsSubagentTitle` 仍是
中文,`active: 'zh'` 下这两行设置项直接显示英文。现改回简体中文,内容与已改
好的 zh-TW / zh-HK / zh-MO 三份对应(页面仍创建 + 未读红点 + 不抢焦点 +
关闭后不再自动创建)。
- R2(同根、写反的另一半):**en** 词典的这两条**根本没改**,仍是旧行为原文
("Activate the Tasks page when…"——而现在的行为恰恰是不接管)。现把 de1e76e
写进 zh 的那两句英文挪到它们本该在的 en 上。
- R3(违反 AGENTS §5「接入 API 即文档」):`docs/external-plugin-guide.md` 补上
本次新增的两个公共 API——`OpenTabSeed.reveal?: boolean`(§7 的 seed 接口块)
与 `BetterSidebarService.clearUnread(type, sessionId)`(§7 服务方法清单),
并在 §0 的承载面要点里加一行索引;措辞与既有条目一致,均标 **v0.25.0+**。
- N1:`tests/sidebar-auto-activation.spec.tsx` 删掉一条误导性死代码
(`reduceFor(... unread: [])` 对断言是空操作:它只写 bySession + 落盘,既不更新
snapshot 也不 notify;证伪见提交后报告——保留该行、去掉 `activateTab` 一行,
用例照样红)。
- N3:unread 的持久化往返此前零测试(`sanitizeState` 的 `Array.isArray(record.unread)`
分支无人守护)。`tests/state.spec.ts` 新增判别性用例:写入未读 → 落盘 → **新
store** `setSession` 读回。还原该分支后用例红在 `state.unread === undefined`。
文案核对:改后 `active:'zh'` 返回简体中文、`active:'en'` 返回新英文句;20 份词典
的这两条现在与 de1e76e 之前的版本**逐份不同**、且没有任何一份还留着旧句。
门禁:`pnpm typecheck` / `pnpm lint` / `pnpm exec vitest run --maxWorkers=3`
(179 文件 / 2058 passed + 13 skipped)全绿。
2026-10-05 23:13:23 +08:00
Menghuan1918
307513561b
fix(explorer): Shift 连选改用渲染序(#132)
...
`visibleRows` 的 walk 枚举的是层级缓存的宿主序(`level.entries`),而
`renderLevel` 画的是 `sortEntries(level.entries, sort)` —— 排序控制一旦
离开默认档,Shift 连选的坐标系就和用户看到的行序错位:视觉上连续的一段
只选中两端,中间被排序挪过位置的行漏选(实测 `[beta, Gamma.MD]` vs
`[beta, zdir, Gamma.MD]`)。
危害不止观感:批量条的 Copy paths / Zip and download / Delete selected 都
作用于这个错误集合,而批量删除确认框只显示数量、不列路径。
让 walk 跑同一个 `sortEntries(...)`,并把 `sort` 加进依赖数组——两条路
(渲染 / 选择)从此共用一份有序视图。
判别性用例 tests/file-tree-select-order.spec.tsx:夹具宿主序
`[zdir(dir), alpha.ts, beta, Gamma.MD]`,非默认档
`{key:'type', dirsFirst:false}` 下渲染序为
`[beta, zdir, Gamma.MD, alpha.ts]`;Ctrl 点第 1 行 + Shift 点第 3 行必须选中
恰好这 3 行。在还原后的源码上该用例红(`expected [ 'beta', 'Gamma.MD' ] to
deeply equal [ 'beta', 'zdir', 'Gamma.MD' ]`),修复后绿。
2026-10-05 23:11:11 +08:00
Menghuan1918
de1e76e2f5
feat(sidebar): 后台激活的页面不再顶掉读者,改为标记未读红点
...
维护者在 #817 上批准了「后台自动激活不接管右侧栏」的行为,并要求同批补上
「后台新开了页面」的提示:事件不能丢,但也不能把读者正在看的页面顶走。
行为:
- 被门控跳过的那次激活仍然创建任务管理页,只是不再抢焦点
(`OpenTabSeed.reveal: false` → 宿主 `revealIfOpened: false`,即
「放置但不聚焦」;页面类型本来就没有自己的聚焦路径,已经存在的页面
再开一次也只是一次聚焦,正是门控要拒绝的那件事)。
- 该页在原生右栏芯片与插件底部工作台对应页签上显示一个静态小红点
(`aria-label` = 新词条 `tabUnread`,颜色取既有 `--dsw-alias-danger`)。
- 读者切到该页即清除标记:底部工作台走 service.activateTab;原生栏的
点击插件看不见(`ISidebarRight` 只有 `active()` 读取器,没有选中事件流),
所以由宿主自己的芯片按 `tab.visible` 清除——非可见芯片不清除,
否则宿主为每个展开页签都画标题,红点刚亮就会被抹掉。
- 标记存进会话状态的 `unread: TabType[]`(随布局持久化,跨挂载/跨会话/
刷新都在),两个承载面读同一份,不会各自为政。
文案:20 份词典同批更新两条设置项描述(门控行为变了)+ 新增 `tabUnread`
词条(ja 真日文)。
测试:`tests/sidebar-auto-activation.spec.tsx` 的门控两条改为断言
「页面仍创建 + revealIfOpened:false + 标记出现」,并加红点生命周期与
「已在任务页/正常激活不标红」三条;新增 `tests/native-tab-unread.spec.tsx`
钉住原生芯片这一承载面(画点、按 visible 清除、非可见不清除、别的类型
不串味、不破坏可访问名)。判别性用 6 处镜像还原逐条证伪(见报告)。
2026-10-05 23:03:40 +08:00
Menghuan1918
f6f7629b23
fix(open-external): Windows「在应用中打开」改为 cmd start → rundll32 候选链,全失败不再静默成功(#412)
...
现象(#412):Windows 上右键「在应用中打开」经常没反应。核实:`urlCommand` 的 win32 分支
只有 `rundll32.exe url.dll,FileProtocolHandler <url>` 一条候选,而 rundll32.exe 在任何
Windows 上都存在、spawn 必然成功 → 路由回 `{started:true}`,UI 拿不到任何失败信息。
修法:
① `urlCommand` → `urlCommands(...): ExternalCommand[]`(有序候选链):win32 为
`cmd.exe /d /c start "" <url>` → `rundll32.exe url.dll,FileProtocolHandler <url>`
(空首参是 start 的窗口标题,缺了它带引号的 URL 会被当成标题、只弹空控制台);
darwin / linux / android / WSL 仍是单元素,语义逐字不变。
② URL 含 cmd 元字符(& % ^ ! | < > ")或控制字符时**跳过 cmd 分支**直接走 rundll32:
Node 的 argv 引用拦不住 `cmd /c` 的第二次解析(%VAR% 展开、&/| 截断、^ 吞字符、"
打乱引用),而 rundll32 以单个 argv 收到 URL、什么都不解释。
③ `launchExternal` 顺序尝试候选:只有 Node 发出 `spawn` 才算成功,同步抛错与 `error`
事件都推进到下一候选;**全部候选失败**时抛 `SidebarError('internal', …)`,消息里逐个
列出命令与底层报错(走既有 `{ok:false,error:{code,message}}` 信封)。
④ 调用方一并改形状:`EditorHost.openWith` 返回「是否被接受」(失败仍 console.error 留痕),
`FileTree` 据此把失败渲染进既有 `openInAppFailed` 错误条——复用词条,未新增词典 key。
测试:
- tests/open-external.spec.ts:候选链顺序、元字符跳过规则、空格 URL 仍是单个 argv、
失败回退顺序、全失败错误形状(含 `&` URL 只尝试 rundll32、reveal 分支的 path 措辞)。
- tests/open-external-windows.spec.ts(Windows lane,pnpm test:windows):只注入两个
「不可能存在」的可执行名(`WindowsOpenerOptions` 测试缝),走**真实 spawn** 断言两条
候选都失败时错误被回报而不是静默成功;**绝不拉起任何应用**(detached:true 会开真窗口,
所以生产命令名一个都不在测试里出现)。
- tests/file-tree-open-with.spec.tsx / tests/editor-host.spec.tsx:被拒(返回 false)与
抛错的打开都必须落进错误条,console-only 即红。
判别性(临时还原源码改动后跑新增用例,随后逐字恢复、md5 校验一致):
- 候选链退回单 rundll32(`if (false && …)`)→ 9 red(含 Windows lane 两条)
- spawn error 仍回 `{started:true}`(旧的「从不失败」契约)→ 6 red
- 去掉元字符跳过 → 11 red
- FileTree 不再上报失败 → 3 red
- EditorHost 恢复吞错 → 1 red
限制(写入设计文档):`start` 与 rundll32 在 handler 忽略 URL 时都退出 0,
「已启动但没打开」仍不可从退出码探测。
2026-10-05 22:58:01 +08:00
Menghuan1918 and finley08
0655b88629
feat(explorer): 资源管理器补「新建文件」+ 排序三档(#132)
...
第一部分:新建文件(移植贡献者 PR #832 的交互语义,写路径改落服务端)
- 新增路由 fs.createFile → fs-operations.ts 的 createWorkspaceFile:单段名、
已存在即拒(fs-error 409,同一句 "x" already exists,绝不截断同名文件,
落盘用 wx)、拒绝 Windows 非法字符(< > : " | ? * 与控制字符)与保留设备名
(CON / PRN / AUX / NUL / COM1-9 / LPT1-9,带不带扩展名都拒)、路径穿越
(..、a/b、a\b)与空名一律 bad-request 400
- src/client/api.ts 镜像 fsCreateFile;FileTree 目录行右键「新建文件」与
「新建文件夹」并列,复用同一套行内输入(Enter 提交 / Escape 取消 / 失焦提交
/ IME 保护,图标跟随输入名),两者互斥;客户端先在已加载层做大小写不敏感的
占用检查(newFileExists),服务端仍是最终裁决
- 词条 newFile / newFilePlaceholder / newFileInvalid / newFileExists 进入
locales.ts 的 zh/en 与 19 份第三语言词典(ja 为真日文)
第二部分:排序三档(名称 / 类型 / 文件夹优先开关)
- 新增 src/client/file-tree-sort.ts:对 level.entries 的副本排序,不改服务端、
不原地重排共享目录缓存;默认(名称 + 文件夹优先)与宿主 fs-tree.ts 的
compareEntries 逐元素一致
- 控件落在文件树头部既有工具区(TreePanel 搜索行的刷新按钮旁):IconButton +
Menu(名称 / 类型打勾 + 文件夹优先独立开关),沿用既有控件样式与可访问名
- 「按修改时间」不在本批范围
测试:tests/fs-create-file.spec.ts(11)、tests/file-tree-new-file.spec.tsx(11)、
tests/file-tree-sort.spec.tsx(12),并修 tests/file-tree-hover-title.spec.tsx 的
夹具顺序(原夹具不是任何宿主会返回的目录序)
Co-authored-by: finley08 <fazhang08@163.com >
2026-10-05 22:57:58 +08:00
Menghuan1918
9c18f05441
Merge remote-tracking branch 'origin/dev' into pr/817-dev
2026-10-05 22:48:47 +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
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
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 and Ahdong&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
Menghuan1918 and rainmanhhh
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
Menghuan1918 and waser0434
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
Menghuan1918 and idoall
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
Menghuan1918 and idoall
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
Menghuan1918 and rainmanhhh
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
Menghuan1918 and waser0434
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
Menghuan1918 and shyuan-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
Menghuan1918 and Ahdong&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
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
244d7d9fd3
Merge pull request #600 from nyantused-cpun/feat/editor-draft-protection
...
feat(editor): 未保存草稿保护、保存冲突检测与内置查找替换
2026-10-05 02:01:42 +08:00
Menghuan1918
783ac9feb6
merge #600 into dev(草稿保护/冲突门/替换;删掉与 #587 重复的查找接线与词典键,换掉已删图标名)
...
贡献者 PR #600(feat/editor-draft-protection,head a14c1e8)以 --no-ff 落到 dev
基线(9b97e6f)。贡献者的提交原样保留,冲突解决体现为本次合并结果。
保留(PR 独有):
- 草稿保护:src/client/editor-dirty.ts(脏稿登记表 + confirmDiscardDraft)、EditorHost
的登记/卸载清理、Sidebar 的 closeTab 门与 beforeunload、closePathTabs 的确认参数。
- 保存冲突门:fs.read 回报 mtimeMs、fs.write 的 expectedMtimeMs(409 fs-conflict,在写
临时文件之前判定)、TextEditor 的 mtimeRef + 冲突横幅 + onReload、wire 的
fs-conflict 码,以及 fs-write-route / text-editor-conflict 两个新 spec。
- 查找/替换入口:TextEditor 工具栏放大镜按钮(打开 #587 的面板;可编辑视图的面板自带
替换行),文案用 #587 的 searchFind。
删除(与 #587 / 2e22b90 重复的部分):
- TextEditor 里重复的那份查找接线:本地 searchPhrases()、EditorState.phrases.of(...)、
search({ top: true })、编辑器 keymap 里的 ...searchKeymap,以及 search / searchKeymap
两个 import——#587 的 src/client/cm-search.ts 已提供同一套(面板、keymap、phrases 隔间、
令牌主题)。
- 20 份词典里被 #587 取代的 10 个键:find / replace / findNext / findPrevious / findAll /
findMatchCase / findRegexp / findByWord / replaceOne / replaceAll(命名以先落的 #587 为准:
searchFind / searchReplace / searchNext / searchPrevious / searchAll / searchMatchCase /
searchWholeWord / searchRegexp / searchReplaceAll)。
- src/index.ts 里已被 2e22b90 覆盖的临时文件改名(.dsh-write-<uuid>):保留 dev 的
.dsh-sidebar-tmp-<uuid>,tests/fs-write-route.spec.ts 的残留断言改指 dev 命名。
- tests/text-editor-search.spec.tsx 中与 editor-find.spec.tsx 重复的三个用例(en/zh 文案、
Mod-f),只留「工具栏按钮开面板并切到编辑态」这一个独有用例。
- README / README_EN / 指南里未实现的 Ctrl/Cmd + H 声明(PR 从未绑定 Mod-h,且浏览器保留
该组合键),改为如实描述「Ctrl/Cmd + F 的面板含替换行」,并补上 #587 已支持的
Ctrl/Cmd + G / Shift + Ctrl/Cmd + G / Ctrl/Cmd + D。
其它解冲突取舍(dev 上下文已漂移,不复活 PR 基线代码):
- 图标:IconSearchOutline16 在宿主图标整族改名后已不存在,换为 IconSearchOutlineRegular
size={16}(显式尺寸;旧 16 后缀已删,不传会按新默认尺寸)。
- 采纳 dev 侧:fs.read 的 ensureWorkspacePath 两参调用、truncation 横幅不带 mode 条件、
fs.write 的编码探测与 invalidateDirectoryCache、Sidebar 的 closeTab 里 PR 基线的终端
pty 释放块(dev 已移走)与 summaryCwd/pushedBottomHeight/collapsed 块(dev 已删)。
- 测试 harness 跟随 dev:ctx.sidebarRight.mounted、bottomSplits、先打开底部工作台、
apply() 需要的 ctx.on、api 模块改为部分 mock(保留 sessionPhase / sessionCwd)。
- 取舍记录写入 docs/plans/2026-09-09-editor-draft-protection-design.md。
Refs #600
2026-10-05 01:58:18 +08:00
Menghuan1918
9c8d5c62ed
merge #574 into dev(工作区提及重放到 reference-in-chat 新载体,复用 mentionFor)
...
冲突是载体搬迁,不是语义作废:
- `@` 回调的载体在 dev 已是 src/client/reference-in-chat.ts(#479 eed2fee 抽出的
两侧共享入口)。PR 新增的 `insertWorkspaceReference` 与 `directoryMention`
落在 conversation-draft.ts(它要用同模块的 appendToDraft /
insertFileReference / mentionFor),由该入口转发;Sidebar.tsx 只保留转发,
native/tab-adapter.tsx 与之同步,两个调用点不再传 cwd(工作区 root 由
`ctx.get('workspaces')` 的会话成员匹配得到,不再回退会话 cwd)。
- PR 的 `directoryMention` 改为委托 dev 的共用构造器 `mentionFor(path, 'folder')`
(#479 把「尾斜杠进引号」的规则收进它),不再自建一套引号规则;
`insertWorkspaceReference` 的文件分支同样换成 `mentionFor(path, 'file')`。
- tests/paths.spec.ts:`resolveSidebarPath` 的导入走已搬迁的 src/client/paths.ts
(produced-files.ts 已不存在),并存的 preview URL 用例与 workspaceRelativePath
用例两块都保留。
- tests/reference-in-chat.spec.ts(#479 验收 spec):fake ctx 补上它现在要读的
workspaces 面、调用点去掉 cwd,三处草稿断言跟随本 PR 的目录尾随分隔空格;
引号与宿主 token 可读性的断言逐字未动。
Refs #574
2026-10-05 01:55:36 +08:00
Menghuan1918
9c4b5dada2
fix(ime-guard): capture 守卫收窄到 composition 窗口,FileTree 保留保守的 229 判定(#833)
...
PR #845 把 isImeComposition 从「keyCode === 229 无条件算 IME」改成「229 只在
composition 上下文里算 IME」,修好了 #833(KeyRay 布局切换发出的 229 keydown 被
capture 静默吞掉)。但那同一个谓词还被 FileTree 的两处提交处理器当「非拦截式
早退」用,收窄之后 legacy 引擎在组合期发出的裸 229 Enter 会穿透到处理器:输入法
选字时的回车直接把重命名 / 新建文件夹提交掉。(本树实测探针:同一 4 行处理器
形状,用旧谓词 commits=1,用新谓词 commits=0。)
两处口径本来就该不同,因为假阳性代价不同:
- capture 守卫的假阳性 = stopPropagation(),全页所有下游监听器都收不到这个键,
正是毁掉 KeyRay 的那一步 → 必须收窄到 composition 窗口。
- FileTree 的假阳性 = 少处理一个键(它不 stopPropagation),假阴性却会提交一个
半成品名字 → 取过近似更划算。
新导出 isLikelyImeKey(isComposing === true || keyCode === 229)承载后者;
isImeComposition 保持现状(守卫仍用它,#833 的修复不受本次改动影响)。
宿主旁证:DSH core 两处都是保守形状、且都不 stopPropagation ——
ui-user-questions 的 QuestionComposer 完全没有 composition 跟踪,只有
`isComposing || keyCode === 229`;ui-conversation 的 InputBar(issue #535)把
composition ref 与裸 229 做或。所以「保守析取」是宿主口径,本插件是唯一因为
capture 语义而不能照抄的地方 —— 文件头原来那句 follows the DSH core convention
据此改写为两谓词分工。
改动面:
- src/client/ime-guard.ts:新导出 + 文件头两谓词分工说明;isImeComposition 的
「the pure decision」措辞改正(它读模块级 composition 状态),实现未动。
- src/client/FileTree.tsx:1536 / :1567:改用 isLikelyImeKey,两处失真注释改准。
- tests/ime-guard.spec.ts:新谓词用例 + FileTree 处理器形状的回归用例(点明它
守的是 FileTree 语义而非 capture 守卫);顺手去掉 :57 与 :61 重复的同一断言。
Refs #833
2026-10-05 01:54:17 +08:00
Atlas Zeng
bbae8b812c
Merge pull request #840 from Waser750/feat/sidechat-archive-thread
...
feat(sidechat): archive the bound side chat thread from the header
2026-10-05 01:50:41 +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
Menghuan1918
b2e63d01f6
Merge branch 'pr-840' into resolve/pr-840
2026-10-05 01:40:01 +08:00