Menghuan1918
5bacf5fa0c
修复提交图标签缺失并校验标签分页快照
2026-10-26 15:19:02 +08:00
Menghuan1918
8c08758afd
merge #956 : fix(sidebar): worktree 会话的根选择与地址基准(#947 / #950 / #952)
2026-10-26 15:00:57 +08:00
Menghuan1918
22eb6ebddf
merge #929 : fix(tree): 改名/删除的调解覆盖后台会话的页签 + 标题只在派生自文件名时跟随(#915 后续)
2026-10-26 15:00:55 +08:00
Menghuan1918
787d873a8c
fix(tasks): restore graph expansion and configurable branch folding
...
Reset per-gesture travel before node guards so a preceding background pan cannot suppress the next card click. Index and iteratively lay out graph topology, memoize agent card contents, and project complete settled branches under independent existing-settings preferences.
Keep unknown real workflow catalogs and explicitly opened descendant paths visible. Add regression coverage and real rc.1 browser/baseline validation evidence.
2026-10-23 12:38:23 +08:00
ymac
099128d1b6
merge origin/dev into fix/worktree-root-address-base
...
四处冲突,都不是「选一边」能了事的:
1) `src/active-worktree.ts` 的头注释:上游这半个月把模块重写了一遍(cwd 解析收敛:
TTL 15s、在飞去重、三个缓存加 LRU 上界、`working-directory/change` 作为证据边界),
本分支加的是「工作区内只有同仓库的 linked worktree 才采纳」(#952)。两边都保留:
一句讲采纳判定,一句讲证据边界。
2/3) `isLinkedWorktree` 一带:上游保留布尔缓存 + 每次探测,本分支把它换成
`gitIdentityOf`(一次 `rev-parse` 同时给出 git dir 与 common dir,并带自己的缓存),
由它派生出 `isLinkedWorktree` 与 `isAdoptableTop`。合并后**只留身份缓存**
(布尔缓存成为同一趟探测的第二份副本,且负结果两边都缓存),`cachePut` 给身份缓存
补上 LRU 上界,模块头注释的「三个缓存」正好仍是三个。
4) `AGENTS.md`:上游把 §3 整体搬进 `docs/host-contracts.md`(原 §3.4 的 1–12 条按原编号),
本分支往旧 §3.4 追加了第 13 条(会话地址基准)。取上游的 `AGENTS.md`,把第 13 条
按新家的体例写进 `docs/host-contracts.md` §B(编号 13 接在第 12 条后),并把四处
「第 1–12 条」更新为「第 1–13 条」。
顺带:`tests/active-worktree.spec.ts` 的 `rmSync` 导入在上游侧被同一个文件的重排吃掉,
补回。
门禁:typecheck 干净;全量 vitest 2691 passed / 17 skipped / 1 failed(唯一红是既有的
smoke 写 `$HOME` 被本机沙箱 EPERM 拒);`active-worktree` / `worktree-address` /
`native-surface` 70 passed。
2026-10-18 23:19:59 +08:00
Menghuan1918
66c91091bc
chore(release): adapt to DSH 0.2.1-rc.1 for 0.28.0
2026-10-17 14:03:22 +08:00
Menghuan1918
6417547bb5
merge origin/dev: include Context diagnostics and graph layout fixes
...
# Conflicts:
# CHANGELOG.md
2026-10-17 11:52:48 +08:00
Menghuan1918
38d94bdb98
fix(git): let commit graph fill available sidebar height
...
Replace the 460px viewport cap with flex allocation. Bound the graph section minimum so long history scrolls internally instead of stretching the outer list. Verify tall and narrow panes, preview selection, folding and long Changes lists in the mounted host.
2026-10-17 11:33:55 +08:00
Menghuan1918
93c43b0ac9
feat: add optional Context diagnostics navigation
...
Use an activation-scoped Cordis controller for session, agent, and job-owner entries. Reuse native Context tabs, cancel stale navigation, and close source overlays without canceling pending requests.
Verify optional capability lifecycle, truthful job ownership, three real dsh-context configurations, and the existing mount regression suite.
2026-10-17 02:20:53 +08:00
Menghuan1918
4ebd3e9bdd
chore: adapt sidebar to DSH 0.2.1-alpha.5
2026-10-17 02:12:44 +08:00
Menghuan1918
b5fec8d9a2
chore(release): prepare 0.27.0 Git page integration
2026-10-16 21:57:02 +08:00
Menghuan1918
0ba7edf444
fix(git): keep selected change rows inside their groups
...
Restore selection declarations removed with logRow during graph integration. Dangling selectors had inherited absolute positioning and borders from indent guides. Add parsed CSS and mounted browser regression coverage for staged, unstaged and conflict rows.
2026-10-16 21:45:57 +08:00
Menghuan1918
71c8243a2b
docs: Git 页面合并车的 CHANGELOG 段、融合设计文档与接入文档/AGENTS 同步
...
- CHANGELOG 顶部新增 Unreleased 段(11 个 PR 的逐条说明与贡献者署名);
- 新增 docs/plans/2026-10-16-git-page-vscode-scm-merge.md(决策 D2/D5、被剔除的夹带、
有意偏差、守住的不变量、未做清单、过程中修掉的三处 CI 红);
- guide:页签名、Source Control 视角、changes.ops 的 wait 长轮询口径、guide 条目名;
- AGENTS §5/§6:内置 tab 名与测试地图补入本批新增/改写的 spec。
2026-10-16 17:31:41 +08:00
Menghuan1918
40ed740f3a
merge pr-944 ( #944 feat(git): Git 内容区改为 VS Code Source Control 结构) into dev(@hairyf)
...
冲突解决(按 D4 与仓库现役不变量):
- status() 改为 porcelain v2(branch/upstream/ahead-behind/detached/operation 一次读回),
但保留 dev 的行/字段上限、pathspec 化 numstat 与 #909 的分侧计数;v2 记录遍历抽成
porcelainV2Tokens,状态解析与 pathspec 提取共用同一份字段知识;
- GitLens 的 Merge/Staged/Changes 三组取 #944,两组各读自己那一侧(#909),
Merge 组不印行数(冲突不是行数故事,也不许把某一侧当「这个数」);
sideEntries 保留(每组只读自己那一半的 XY 字母);
- ChangesTab 保留 #939 的官方 Tabs 外观与 a11y 包装、刷新按 #944 只留给本轮文件镜头;
- 测试:git.spec 导入取并集、rmSync 清理改回 removeTree、smoke 的 branch/detached 断言
按 porcelain v2 语义改写,其余用例按新契约微调(band 顺序、changesOps 第 4 参 wait)。
剔除夹带(D4):.agents/skills/handle/SKILL.md、eslint/vitest 的 soruce/vscode 忽略项、
webRuntime→connection.requestRejection 栅栏与 ownEntryId 放宽(index.ts / context-types.ts
取 dev)、栅栏类测试桩与注释一并回退,栅栏归属留给 0.2.1 兼容批。
2026-10-16 17:14:06 +08:00
Menghuan1918
9f630d1618
merge pr-940 ( #940 fix(changes): 本轮文件操作改为平铺行) into dev(@hairyf)
...
冲突解决:README.md 取 dev(PR 基于拆分前的旧中英双 README,改动目标已不存在),
README_EN.md 保持删除;guide 的 usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--no-lazy-fetch]
[--no-optional-locks] [--no-advice] [--bare] [--git-dir=<path>]
[--work-tree=<path>] [--namespace=<name>] [--config-env=<name>=<envvar>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore working tree files
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
backfill Download missing objects in a partial clone
branch List, create, or delete branches
commit Record changes to the repository
history EXPERIMENTAL: Rewrite history
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Set `HEAD` or the index to a known state
switch Switch branches
tag Create, list, delete or verify tags
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system. 行合并「平铺措辞 + 下划线 Tabs 说明」;
editor-host.spec.tsx 的 RENDER_WAIT_MS 注释保留 dev 的 CI 史,并补记 PR 的夹具泄漏结论。
2026-10-16 16:38:37 +08:00
Menghuan1918
1de5e44394
merge pr-939 ( #939 fix(changes): 镜头切换器改用官方 Tabs 样式) into dev(@hairyf)
2026-10-16 16:31:17 +08:00
ymac
f826e63658
docs: 地址基准与 worktree 根选择的规则与设计(#947 / #950 / #952)
...
- AGENTS §3.4 新增第 13 条:会话地址的基准是会话 header cwd,构造端与消费端都
经 addressBaseOf 取基准、在消费边界解析成绝对路径;工作区内部的 linked worktree
只有同一仓库(--git-common-dir 相等)才算「会话搬走了」。
- 接入指南 §10 新增同名条目(消费插件自己也解析文件地址时照同一条规则),并补上
openSidebarFile 的新签名 `{ line?, cwd? }`。
- 新增 docs/plans/2026-10-14-worktree-root-and-address-base.md:三个症状、根因
(宿主两端自洽 / 插件换基准 / 判定只看拓扑)、口径 A/B 决策表与实测真值表、
逐文件实施、复现与正式用例、残留(裸相对路径聊天链接属上游 worktree 无感)。
2026-10-14 23:18:15 +08:00
hairyf
5efc7beae0
Merge remote-tracking branch 'origin/dev' into feat/git-scm-941
...
# Conflicts:
# eslint.config.js
2026-10-13 23:19:26 +08:00
Menghuan1918
8171beb5a2
chore(release): v0.26.0 —— 版本号、CHANGELOG 定版与补齐、README 与指南同步
...
**版本号三处同步**:`package.json` / `dsh.plugin.json` / `src/client/service.ts`
的 `SIDEBAR_SERVICE_VERSION` 0.25.0 → 0.26.0(`tests/manifest-consistency.spec.ts`
钉住前两者一致;service.ts 里其余 `v0.25.0+` 是历史功能标注,未动)。
**CHANGELOG**:`### Unreleased` 定版为 `### v0.26.0`;删掉任务面板那批的**首轮
旧稿重复块**(61–75 行与定稿重复且措辞互相矛盾,合并遗留);补上此前完全缺失的
三条——
- PR #925 侧边对话整批(实时推送 / 排队可见 / per-thread 模型选择 / 幽灵输入精确
清扫 / 底栏重构);
- 文件树的「加载中」占位把子树永久卡死(占位所有权跟着请求走 + 丢弃时补发一次);
- `.jsonl` 预览谎报「文件过大」(阈值决定提示,不是组件决定);
- 预览插件目录收录音频预览插件(#881)。
另外把 `.delta/` 排除那条工具修复并入 git 轮询条目的测试小节。
**README / README_EN**:修掉「v0.24.1 起要求 0.2.0-rc.2+」这处事实错误(v0.24.1 的
peer 是 `^0.2.0-rc.1`,v0.25.0 才是 `^0.2.0-rc.2`)、跟着过时的「`latest` 仍是
0.1.7-rc.2」、以及支持线表格与徽章 alt 里的旧版本号;**补上此前从未写过的 v0.25.0
条目**并新增 v0.26.0 条目(四件大事 + 性能段)。README_EN 同步。
**CHANGELOG_EN**:停在 v0.24.1 已两版(无门禁守护),补 v0.26.0 与 v0.25.0,
并把头部说明改成「中文 CHANGELOG 为逐条权威、本文件是英文摘要且历史上滞后」。
**指南**:§4.4 内置清单的 viewer 数 3 → 4(补 `jsonl`);`terminal-bottom` 的
`single` 列与实际不符(#926 已去掉 `single`、改为 `createTab` 每次铸新 id),
两处「`contentId` 恒定」同步订正为每页签一个实例。
2026-10-13 22:44:05 +08:00
hairyf
228b753ad2
fix(git): finalize reviewed SCM groups and scope-safe actions
2026-10-13 22:42:16 +08:00
hairyf
0f9472b57f
fix(host): resolve settings namespace for file-mounted plugin
2026-10-13 22:41:06 +08:00
hairyf
428347da13
fix(host): use native connection admission for HTTP and WebSocket routes
2026-10-13 20:37:43 +08:00
hairyf
3a1cf3d4b7
fix(changes): flatten session operation rows
2026-10-13 16:18:07 +08:00
hairyf
872a975e15
fix(changes): reuse official conversation Tabs styling
2026-10-13 15:49:04 +08:00
ymac
3f7a344a49
docs: 记录 #915 后续——标题只在来自文件名时才跟随改名
...
- CHANGELOG:`### Unreleased` 置顶补这一条(含判别性实测)。
- 指南 §7:`updateTab` 的 JSDoc 补「派生标题跟着改名、作者自设的标题原样
保留」——这条 UI 行为由 service 的写面决定,按 AGENTS §5 同批同步。
2026-10-12 08:49:56 +08:00
ymac
2d850a5261
docs: 记录 #915 后续——后台会话页签的调解与定向写入
...
- CHANGELOG:`### Unreleased` 置顶补这一条(含两条判别性实测)。
- 指南 §7:`updateTab` / `closeTab` 的 JSDoc 补「指到不在屏的会话时写进它
自己的布局(定向通道,不发布、不通知)」——AGENTS §5 要求 service.ts 的
行为变更同批同步指南。
2026-10-12 08:48:37 +08:00
Menghuan1918
77854af361
docs: 独立验证后的收尾(#915 条目事实性修正 + 补 #910/#911/#901 条目 + updateTab 的 JSDoc 合并)
...
独立验证(3 个未参与解冲突的 agent)在这批合入后抓出的问题:
- CHANGELOG #915 条目里「写回时保留该页签自己的拼写」与实现矛盾:记录写的是调用方
给的新名(绝对拼写),保留旧拼写的是**改名标记**的 from(tree-mutations.ts:186-191)。
- #910 / #911 / #901 三条用户可见修复在本批合入时都没有 CHANGELOG 条目,补上(按合入
顺序「新在上」:901 → 915 → 916 → 911 → 910)。
- #915 条目里「原生枚举没有进消费插件的公开面」措辞过强:本批确实新增了 3 个导出成员
(NativePathTab / SidebarSurface.pathTabs? / @internal 的 nativePathTabs),改成
「没有当成消费 API 宣传」。
- src/client/service.ts 的 updateTab 上叠了两个 JSDoc 块,TSDoc 只挂最后一块、解释
sessionId 的那块成了浮空注释——合并成一块(原文档面)。
- 指南 §7 的 updateTab 签名补上第三个参数 sessionId?(该行此前就漏了)。
typecheck 干净,全量 2432 passed / 17 skipped。
2026-10-12 02:00:52 +08:00
Menghuan1918
db7216eac8
docs: 补 #915 的 CHANGELOG 条目与指南 §7 的原生承载面行为说明(#912 未带文档面)
...
- CHANGELOG:`### Unreleased` 置顶补 #915 条目(按 #912 的实际实现写;被取代的
PR #917 那段里的 `ctx.betterSidebar.pathTabs()` / `store.reduceFor` / 「标题只在
派生自文件名时跟随」三处说法与实现不符,未照搬)。
- 指南 §7:`updateTab` 的 JSDoc 补「写入在原生承载面上是稳的」(导航门控)与
「文件树改名/删除调解覆盖原生页签」——AGENTS §5 要求 service.ts 的行为变更
同批同步指南;§7 的接口块在 ```ts 围栏内,所以写成 JSDoc 续行而不是散文段。\n
2026-10-12 01:52:52 +08:00
Atlas Zeng
4bb914ef4a
Merge pull request #916 from yanzhaohui1999/fix/826-line-nav-mode
...
fix(editor): 行号落地四处收尾:能切回预览、插件预览也跳行、换文件不继承行号、落地有光标(#826)
2026-10-12 01:39:20 +08:00
Menghuan1918
ecb347eb11
merge origin/dev into fix/826-line-nav-mode(#826 行号落地四处收尾 合上 dev 的 #924/#925 与流式/任务批)
...
两处冲突的解法:
- CHANGELOG.md:dev 的 v0.25.0 落版提交已把「#826 第二半」条目移进已发布的 `### v0.25.0`,
因此该条目全篇只保留一份——留在 v0.25.0 原位,并采用 #916 修正后的措辞
(「并高亮该行」→「并给编辑器焦点(CodeMirror 只在获焦时画光标)」);
#916 新增的「引用行号的四处收尾(#914 回归报告)」条目置于 `### Unreleased` 最上方(该节新在上);
dev 的其余段落(Unreleased 与 v0.25.0 两节)逐字未动。
- src/client/service.ts:保留 dev 新的 `FileViewerProps.content` 文档(超限见 `largeFile`)
与 #924/#925 带来的侧边对话 / 流式面,叠加 #916 的 `onLineConsumed` 文档;
`OpenTabSeed.line`、`createBetterSidebarService` 的三处 seed 透传与 `updateTab` 文档补充按 #916 落地。
验证:pnpm typecheck 通过;pnpm test 203 文件 / 2419 用例全绿(17 skip),
含 #916 的 tests/editor-line-nav-mode.spec.tsx 等 6 个 spec。
2026-10-12 01:27:18 +08:00
Menghuan1918
293b0e12ea
merge origin/dev into fix/fs-write-missing-conflict(#911:带基线保存时目标已删除判 fs-conflict,语义落进 dev 的 writeWorkspaceText)
...
#924 把 fs.write 从 /sidebar/api 的 JSON 路由移到了 raw /sidebar/write →
src/fs-operations.ts 的 writeWorkspaceText,所以 #911 只改 src/index.ts 里那段
内联实现已经不存在了:冲突取 dev 侧(新的 fs.readPage 路由 + 已迁走的 fs.write),
把语义重落到 writeWorkspaceText,并同步改文档、客户端注释与其两个新用例。
解冲突的四个文件:
- src/index.ts:整份取 dev(#911 在此处的改动全部落在已被 #924 删除的内联实现里)
- src/fs-operations.ts(非冲突文件,语义落点):基线检查 current !== undefined && current !== expected
→ current !== expected;stat 失败(目标或父目录被删除)同样判 409,不再 mkdir -p 重建
- src/client/api.ts:保留 dev 的 fsRead 三态 + 新增 fsReadPage,fsWrite 注释合入「目标已不存在也判冲突」
- docs/external-plugin-guide.md:保留 dev 的 fs.read / fs.readPage / fs.write(raw) 三行,往 fs.write 行补该语义
- tests/fs-write-route.spec.ts:保留 dev 的两个新用例,并把 #911 的两个用例改写到 raw 路由
(invoke(route.api,'fs.read') 取基线 + invokeWrite(route,…) 保存)
2026-10-12 01:26:19 +08:00
Menghuan1918
51c1650928
feat(preview): 超大文件改追加式滚动 + 加载全部按钮
...
按用户要求对齐 VS Code 的 output/log 面板:
- 滚到底**追加**下一页而不是替换当前页:读者读过的内容不会被抽走,
行号跨页连续;footer 改成「已加载 第 a–b 行/条记录 · 已读/总大小」
- 超限提示条最右侧新增「加载全部」按钮,加载中显示字节进度,到 EOF 置灰
- 游标模型整体删除(不再有 prev/next 与页码),只剩一个只向前的累加器,
比原来的 LRU 缓存 + 页表简单得多
唯一 VS Code 不需要而这里必须有的:行数上限 MAX_PREVIEW_ROWS = 50000。
它的 TextModel 与视图都虚拟化,模型塞进一个 GB、DOM 仍很小;这里渲染的是
真实元素,没有上限就是「加载全部」一点即卡死。到顶后停止追加并提示下载。
上限放在 hook 里(useTextPager 的 maxLines 参数)而不是视图按**已渲染**
行数判断——这是测试抓出来的:loadAll 在 await 循环中推进时 React 还没重
渲染,读渲染态的数字会滞后好几页把上限冲过去(spec 里 worker 十秒 OOM)。
另一个测试抓出的真 bug:appendOnce 原来从 setState 渲染态读 nextOffset,
在同一批 await 里拿到的是**上一页**的偏移,于是 loadAll 会反复请求同一页
(同样是 OOM)。游标改由 nextOffsetRef/atEndRef 在响应到达时同步写入。
测试:新增 tests/text-pages.spec.ts(9 例:追加不丢页、EOF 终态、loadAll
串行推进、上限截断与 atCap、失败中止、reload 清空、行数计账),
editor-large-file 补 6 例视图行为(滚动追加、中途不追加、自动填充视口、
加载全部分页、上限提示、默认上限不误报);chunk-artifact 的 externals
桩表补 react.memo(editor chunk 现在在模块求值期 memo 一行组件)。
2026-10-12 00:11:07 +08:00
Menghuan1918
62b797665f
docs: 接入指南 / README / AGENTS / CHANGELOG 与设计文档同步
...
- 指南 §5.2 / §5.3 / §6:FileViewerProps 的 truncated → size + largeFile、
新增 visible;fs.read 三态;新增 fs.readPage;fs.write 迁到 raw 路由
- 指南 §6.1:打包改原生命令的完整说明(工具探测顺序、-y 与符号链接环、
公共祖先定位、临时文件 + 流式下发、unavailable 501),删掉已不存在的
ZIP_MAX_ENTRIES / ZIP_MAX_BYTES 与 src/zip.ts 的说法
- README / README_EN:挂载示例的四个限额收缩为 listLimit,并说明三个键
已删除、旧 profile 残留值会被静默忽略
- AGENTS §6 测试地图:6 tab + 4 viewer、新增的六个守护 spec
- CHANGELOG / CHANGELOG_EN:未发布段
- docs/plans/2026-10-11-streaming-transfer-jsonl-preview.md:设计过程、
与 VS Code Web 的对照(含「VS Code 并不分页」的纠错)与实施偏差记录
另修一处 lint:jsonl.ts 的 truncate 助手在重写摘要后成了死代码
2026-10-11 22:43:30 +08:00
ymac
6dd0486f5c
fix(editor): 换文件 / 重命名时丢掉继承来的 landing line(#826 收尾之三)
...
`updateTab` 的补丁只有 title/path/meta,所以两条「插件自己改路径」的路都把上一个
文件的行号留在了记录里:合并模式在页头路径框输另一个文件、以及文件树里重命名
打开的文件(`retargetPathTabs`)。后果与 reload 那条同症状——新文件跳到旧行号,
markdown 还被拉进编辑态。宿主导航那条路径本来就有清理规则
(`params.line !== existing.tab.line`),插件自己写的路径没有。
规则统一为「**改 path 就是一次新的打开**」,瞬态行号随之清掉,落在两个记录层:
`patchTab`(store 分支)与原生记录的 `update()`(`updateTab` 的 native 分支);
只改 title / meta 的补丁不动它(同一文件,行号仍属于当前这次导航)。
测试:native-tab-line.spec.ts 加两例(换 path 清掉、只改 title 保留),
editor-line-nav-mode.spec.tsx 的第四条从「模拟 updateTab 的结果」改成驱动真实
`service.updateTab` 并断言记录里 `line` 消失、编辑器留在预览态。
2026-10-11 15:56:49 +08:00
ymac
68d6c33025
fix(markdown): 预览里的 #L131 链接也带上行号(#826 收尾之二)
...
插件自绘的 markdown 预览(编辑器预览 / 侧边对话转录 / 变更阅读窗 / 任务窗口)
里点 `./other.md#L42`,文件打开了却不跳行——而且停在预览态,源码被当成段落
渲染成一坨。聊天正文里同一个链接能跳:那一侧的 `navigation.params.line` 由宿主
解析后落进记录,而插件这一侧的 delegate `openFile(path, { line })` 收到的行号
只被当成「这是行号不是标题锚点」的判据,随后 `openSidebarFile` 就把它丢了
(种子没有 line 字段,原生分支的 `surface.openResource` 也没传——末跳本身是
支持的)。
补齐三跳:`use-markdown-surface` 把 `options.line` 传下去(拿不到时按宿主语法
自己解析片段,新增 `lineOfHostFragment`,区间取起始行),`openSidebarFile` 与
`OpenTabSeed` 各带一个可选 `line`,`openTab` 的原生分支转发给
`surface.openResource`、底部工作台的 mint 落进 tab。落地后的行为与聊天正文那条
一致:跳到那一行,markdown/html 离开预览(预览里没有源码行号),并且——承上一条
提交——读者随时能点回预览。
测试:markdown-surface.spec.tsx 走真实宿主 MarkdownText 点链接,钉住 `#L42` 与
`#L20-L25` 进记录、标题锚点仍然只走 parked 片段;markdown-navigation.spec.ts 钉
新解析器;file-open-claim.spec.ts 钉种子透传与「不传就不带这个键」。
2026-10-11 12:02:55 +08:00
ymac
46a870a471
fix(editor): 引用行号不再永久占有 markdown 的模式(#826 收尾)
...
跳到 #L131 后回不到预览:TextEditor 收到行号会把 markdown/html 强制切到编辑态,
而「这条导航是否已经消费过」记在组件实例里(landedAtRef)。EditorHost 的每次
reload 都用 loading 行替换 viewer(页头刷新、「编辑 → 预览」边沿 #167 part B、
预览态保存后的刷新、#855 自动刷新),重建出的实例又是 preview 模式 + 空记忆,
于是同一个行号再次强制切编辑——读者点「预览」当场被切回去。
记忆改由宿主持有(它比 viewer 活得久):TextEditor 定位完成后回调
`onLineConsumed()`,EditorHost 记住已消费的 `${path}#${line}` 并停止再下发,
直到换文件(新的一次打开)或换行号(新引用)。公开面纯增量:
`FileViewerProps.onLineConsumed?: () => void`,不消费 `line` 的第三方 viewer
行为不变。
测试:tests/editor-line-nav-mode.spec.tsx(新,3 例,真 TextEditor 过 EditorHost:
落地后能回预览 / 刷新不回弹 / 同文件新行号仍落地),text-editor-line-jump.spec.tsx
补 2 例钉住消费契约(定位后恰好一次、普通打开不消费)。
2026-10-11 11:43:51 +08:00
unsc9
d6d927bf6a
fix(fs): 带基线保存时目标已不存在判冲突,不再无提示重建被删的文件
...
`fs.write` 的乐观并发门只在「读得到磁盘 mtime 且与基线不符」时报冲突。目标
已被删除或改名走时,`stat` 失败被 `.catch(() => undefined)` 吃掉,代码把
「读不到」当成「没有基线可比」,于是整段门禁跳过、直接写盘:文件被重建,被
一并删掉的父目录也被 `mkdir -p` 重建,客户端清掉 dirty 并显示「已保存」——
用户刚做的删除被无提示地推翻。
数字基线只可能来自一次成功的读取,也就是那个路径当时确实有文件;所以「读不
到」是磁盘上的删除/改名,不是「新建」意图——新建走 `fs.createFile`,上传走
上传写入,都不经过这条分支。据此把 `current === undefined` 单独判成 409
`fs-conflict`(消息写明 no longer exists on disk)。
改动:
- `src/index.ts`:冲突门拆出「目标不存在」这一支
- `docs/external-plugin-guide.md` 的 `fs.write` 行、`src/client/api.ts` 的
`fsWrite` 注释:同步这条语义
- `tests/fs-write-route.spec.ts` 两条新用例:目标文件被删(409,不重建、无
临时文件残留)、父目录被删(409,目录不被重建)
客户端沿用既有的 `fs-conflict` 横幅(「文件已在磁盘上被其它来源改动。保存已
中止,你的修改仍留在编辑器里。」):删除属于「磁盘上被改动」,草稿保留与
重载按钮都仍然成立,因此不新增 20 份词典的词条。
2026-10-10 21:40:49 +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
45285014d9
merge fix/826-file-link-line-jump into dev(#826 第二半:行号不再被解析完就扔掉。两种写法合流到同一个字段——#L131 由宿主解析成 navigation.params.line、path:131 由插件在 path-line.ts 切出,都落到 SidebarTab.line,再经 FileViewerProps.line 交给 viewer;TextEditor 到达时定位一次并高亮,越界钳到最后一行,区间只取起始行。line 是瞬态(sanitizePersistedTab 白名单不含它,刷新不把读者拽回旧行);markdown/html 收到行号先强制切到编辑态再定位,避开预览自己的挂载滚动恢复。公开面是纯增量:FileViewerProps.line?: number)
...
# Conflicts:
# docs/external-plugin-guide.md
2026-10-08 22:20:45 +08:00
NolanHo
0d9fee85b8
fix(fs-search): direct-open for pasted paths + fragment path matching ( #879 )
...
A query carrying a path separator can never match an entry NAME — names
never contain separators — so pasting any path into the search box was
structurally guaranteed to return {matches:[],truncated:true} while the
walk burned its full 100k-visit budget (measured: 1.9s on a Rust repo
whose two worktree forests alone held 97k entries; real directories were
never reached).
searchFiles now routes by query shape, all three modalities sharing one
result contract:
- A query naming one path (absolute, ~/…, ./x, ../x) resolves through
resolveTarget — the SAME primitive fs.read uses, so ~ expands (#713 ),
dot-anchored spellings join onto the session cwd, and win32
WSL/dsh-remote namespaces reinterpret — then stats the target. The hit
is the RESOLVED path (resolve() strips shell-completion trailing
separators, which the client's exact-string row comparisons could never
match); a missing target answers empty immediately. Directory targets
ride the #801 dirs contract. The exclude pref does not apply: a pasted
path is explicit intent, same as the fs.read the click performs.
- A separator-carrying relative fragment (records/exp1) matches by
root-relative PATH in the walk; the engines are name matchers (fd has
no --full-path here, rg's globs are single-segment) so argv
construction is untouched.
- Plain name queries are unchanged, and no NAME query is stolen: on
POSIX a backslash is a name character (the ~\ gesture counts only on
win32; util.ts~ / ~$doc.docx / .env stay name queries).
SKIP_DIR_NAMES gains the budget-eating forests seen in the wild:
.worktrees/.worktree (git worktree layouts), target, venv/.venv and
__pycache__ — shared by the walk and both engine argvs as before.
Client: a directory hit OUTSIDE the cwd (newly reachable via the paste
branch) only clears the query — the tree is cwd-rooted, and the old
ancestorDirs call synthesized junk expanded entries for foreign paths.
Verified: vitest fs-search/smoke/search-persist suites green; full run
2171 passed with one failure proven pre-existing on the clean tree
(git.spec checkout case, host git lacks --end-of-options; #841 );
typecheck/lint clean.
2026-10-06 08:25:30 -07:00
Menghuan1918
34ce191981
docs: 修正 #855 的用例数、脏态出口口径与轮询叠加口径
...
- **[硬数字]** CHANGELOG 的 `tests/editor-auto-refresh.spec.tsx` 用例数
11 → 14(原本就少 1,加上本批新增 2 例);同批核对:既有 #167 的 4 条、
2.5s 节奏、「N 个编辑器 tab 每 tick 1 个请求」均属实。
- **[用户可见承诺]** 删掉「dirty / 编辑态由既有的『编辑 → 预览』边沿补刷」
这句不成立的话:该边沿**自身带 dirty 守卫**(`EditorHost.tsx` 的边沿判定
要求 `dirty !== true`,`tests/editor-refresh.spec.tsx` 的 B 例两半都钉住了:
干净时 fsRead 1→2,dirty 时仍是 1)。按事实改写为:未 dirty 时点页头
「预览」会重载并拿到新内容;dirty 时该边沿被抑制,真正的两条出口是**页头
刷新按钮**(`window.confirm` 后重载)与**「保存 → `fs-conflict` 横幅的
reload」**(保存带 `mtimeMs` 基线,不会静默覆盖模型字节)。结论句:dirty
期间保持旧内容直到用户显式动作,**不存在看不到新内容的死路**。指南 §5.2、
指南行为差异表、CHANGELOG、设计文档 §4.2 四处同步。
- **[叠加口径]** 同一会话同时开着文件变动页(会话透镜)与编辑器时,该会话
每 tick 是 **2 个** `changes.ops` 请求——「每 tick 1 个」只算编辑器这一份。
一次性探针实测:会话透镜单独 1/tick、编辑器单独 1/tick、两者同开 2/tick
(记进 CHANGELOG、指南行为差异表与设计文档 §4.1)。
- 设计文档 §5/§6 的用例数与门禁数字同步为本次实测(184 文件 2152 通过 /
13 跳过 / 0 失败)。
2026-10-06 00:55:52 +08:00
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
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
2f66c921df
docs: 同步 #774 的接入契约、设计文档与内置清单
...
「接入 API 即文档」:src/client/service.ts 与 src/client/builtins/ 变了,
唯一权威接入文档必须跟着变。
- docs/external-plugin-guide.md:`bottomOnly` 全字段说明(含与 `hidden`
的区别、`openTab` 落点改道、为什么不注册原生承载面);承载面表把
「终端(已交还宿主)」拆成三条——宿主一条 + 插件底部一条(彼此独立)、
`bottomOnly`、底部终端的恢复语义;`target: 'side'` 行补上唯一的例外;
guide 条目行补「`bottomOnly` 同样不占行」;§4.4 内置清单加
`terminal-bottom` 行(5 → 6)。
- docs/plans/2026-10-05-bottom-terminal-tab.md:设计文档。五条已定决策、
从装好的钉版包里读出来的宿主契约(含 view() 的 createWhenMissing 分支、
SnapshotStore、帧协议、issue 枚举)、三条恢复语义的由来、降级矩阵、
证据清单,以及**未验证项**(真 Windows / 真浏览器观感 / 本轮是否跑过
真实挂载 lane)。
- README.md / README_EN.md / CHANGELOG.md / AGENTS.md:内置 5 tab → 6 tab
的计数同步(README 的终端行与排障行补上底部终端与它的失败模式)、
Unreleased 词条、AGENTS 的 chunk 名清单与关键测试守护条目。
2026-10-05 23:42:49 +08:00
Menghuan1918
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
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
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
ymac
5f90f1d466
Merge remote-tracking branch 'origin/dev' into fix/826-file-link-line-jump
...
# Conflicts:
# CHANGELOG.md
# src/client/FileTree.tsx
# src/client/desktop-env.ts
2026-10-05 22:20:24 +08:00
ymac
415d517fb0
fix(editor): make a file reference land on its line ( #826 second half)
...
`fileParamsOf` already split the `path:line` spec off the address (#828 )
but kept only `spec.path` — so both spellings opened the file and left the
reader on line 1: `path:131` dropped the parsed line, and the host's own
`#L131` fragment was already delivered as `navigation.params.line` and
dropped just the same.
Carry the line the rest of the way: address → `SidebarTab.line` →
`FileViewerProps.line` → one reveal in the text editor. Both spellings
land on the same row.
Three decisions:
- `line` is transient: `sanitizePersistedTab` copies a whitelist and this
field is deliberately left out of it, so a reload does not yank the
reader back to a line a link named days ago. Same treatment as
`revealed`.
- markdown/html flip out of preview when a line is present: preview has no
source lines to put a cursor on, and its own mount-time scroll restore
would fight the jump (both write the same `scrollTop`). The reference
asked for source, so the flip does not record the key and the re-run
after the mode change does the jump — which also dissolves the conflict
instead of arbitrating it.
- A range keeps only its first line and the column is dropped: the editor
has exactly one cursor.
The record must also be able to DROP the line, not only set it — an
in-place switch from `a.ts:131` to a bare `a.ts` would otherwise leave 131
behind and the editor would bounce the reader back on every notification.
Comparing against the current value instead of "was one passed" also keeps
the synthetic record's identity when neither side has one, which matters
because the host keeps visited bodies mounted.
2026-10-05 22:17:44 +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