Commit Graph
655 Commits
Author SHA1 Message Date
Menghuan1918andwaser0434 900b1592e1 fix(sidechat): bind the native side chat tab to its thread across re-navigation
The native right sidebar keeps at most ONE page tab per kind, so a side chat
tab is never a copy: every open re-delivers the same tab with fresh navigation
params and an incremented `navigation.revision` (verified in the pinned host's
client bundle: `TabDomain.navigate` replaces the whole target and bumps the
revision, and `openContent` settles an already-held page tab through it). Two
opposite mistakes followed from that: `records.ensure` only read the seed
`meta` when it MINTED a record (so the header thread menu closed and nothing
changed — #762), while adopting it on every pass would clobber the thread id
the view writes back through `updateTab` (the orphan `Side: New thread` half of
#684).

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

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

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

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

Refs #839

Co-authored-by: waser0434 <178004182+Waser750@users.noreply.github.com>
2026-10-05 02:19:58 +08:00
Menghuan1918 f871002448 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
2026-10-05 02:13:53 +08:00
Menghuan1918andshyuan-hub 5254c031b1 feat(explorer): 文件树面包屑折叠 + VS Code 风格可配置排除模式(移植 #264)
按当前 dev 重写贡献者 PR #264 的两项核心意图:

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

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

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

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

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

Refs #264

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

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

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

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

Refs #434

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

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

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

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

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

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

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

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

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

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

Refs #303

Co-authored-by: Cold Cloud <64406210+yanzhaohui1999@users.noreply.github.com>
2026-10-05 02:10:45 +08:00
Atlas Zeng 3bd5e1947b Merge pull request #845 from ingeb0rga/fix/ime-guard-synthetic-229
fix(ime-guard): trust keyCode 229 only inside a live composition context
2026-10-05 02:02:20 +08:00
Atlas Zeng 680972dfb1 Merge pull request #612 from wang-kaopu/fix/issue-591-wsl-open-with
fix(open-with): handle external open actions under WSL
2026-10-05 02:02:02 +08:00
Atlas Zeng 244d7d9fd3 Merge pull request #600 from nyantused-cpun/feat/editor-draft-protection
feat(editor): 未保存草稿保护、保存冲突检测与内置查找替换
2026-10-05 02:01:42 +08:00
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
Menghuan1918 7a30d74cdf merge #612 into dev(WSL 下外部打开:绝对路径调用 Windows explorer/rundll32,VS Code/Cursor 的 file URL 转 Remote-WSL,spawn 失败不再被吞)
#612 严格覆盖 #575:两者都做 WSL 检测与 reveal 走 Windows Explorer,但 #575 用
`explorer.exe` 裸名 + 往子进程 PATH 追加 /mnt/c/WINDOWS,而 #612 先用绝对路径
`/usr/bin/wslpath -u` 解析 Windows 可执行文件,因此在 appendWindowsPath=false
(issue #591 的实际环境)下同样成立;#612 另加 issue #591 点名的第二半:URL 侧
改走 Windows rundll32 协议处理器、vscode/cursor 的本地 file URL 转
`vscode-remote/wsl+<distro>`,以及把原先被 `child.on('error')` 吞掉的启动失败
改成 reject 路由。#575 相对 #612 没有任何独有能力,按被超集取代处理。

解冲突(唯一冲突文件 tests/open-external.spec.ts,两侧插在同一锚点,两段都留):
- describe('revealCommand'):dev 的 android/termux-open 用例 + PR 的 wsl 用例;
- describe('urlCommand'):dev 的 android/termux-open-url 用例 + PR 的 wsl 用例
  与新增的 describe('wslRemoteEditorUrl') 整块。
src/open-external.ts 三方合并干净(dev 的 case 'android' 与 PR 的 if (options.wsl)
分支共存)。

Refs #612
Refs #591
2026-10-05 01:53:26 +08:00
Atlas Zeng 9b97e6f273 Merge pull request #523 from wang-kaopu/fix/506-gbk-encoding
fix(editor): preserve original text file encoding
2026-10-05 01:51:01 +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 c386652817 merge #523 into dev(非 UTF-8 文件编码检测,写路由按 dev 新形状解冲突)
冲突只有两处上下文搬迁,均在 src/index.ts:
- 导入块:保留 dev 的 fs-batch / active-worktree 两行(含其注释),其后追加
  PR 的 text-encoding 导入。
- fs.write:保留 dev 的写路由新形状(每请求唯一临时名 + flag:'wx'),
  并把 PR 的 encodeText(content, encoding) 接进去(encoding 仍在重命名前
  用 encodingOfFile(path) 从磁盘上的原文件探测)。

一并修掉证据实测的截断误判:读上限(readLimit / 64KiB 嗅探窗口)落在多字节
字符中间时,残留的部分字节会被 GBK 探测当成一个合法双字节字,导致 > 上限的
UTF-8 文件整段乱码、保存还可能按错编码落盘(Node v26 实测:三字节汉字缺 2
字节时 utf8=fatal 失败、gbk=成功)。现 decodeTextBytes 接受 truncated 标记,
在截断且尾部确为不完整 UTF-8 序列时按 UTF-8 处理(内容仍沿用原先的 U+FFFD
渲染);完整但不合法的尾部序列照旧交给传统编码探测。测试补齐:单测(三字节 /
四字节截断、完整非法序列不被误裁、>64KiB 嗅探边界)+ 路由级(GBK round-trip、
512KiB readLimit 截断的中文 UTF-8 读取)。

Refs #523
2026-10-05 01:42:41 +08:00
Menghuan1918 91625f6ae4 test(sidechat): cover the header archive button and the thread rebind
The archive action and its `fallbackThreadId` rebind are this change's whole
risk surface and shipped without coverage. Three cases on the existing
SideChatView harness (fake ctx extended with the two host faces the button
probes, no second harness):

- clicking archive calls uiWorkspace.archiveSession(id, { stopActivity: true })
  exactly once and rebinds tab.meta to the newest remaining thread;
- a running thread disables the button, and the click sends no request;
- with no thread left the tab unbinds to `{}` instead of staying bound to the
  session the host just archived.

Refs #840
2026-10-05 01:41:40 +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 1d2e892a89 Merge PR #845: fix(ime-guard) trust keyCode 229 only inside a live composition context
Refs #845
Refs #833
2026-10-05 01:39:59 +08:00
Atlas Zeng b2599b390b Merge pull request #802 from zhanghunuaa/feat/follow-active-worktree
feat(sidebar): 文件树跟随会话实际所在的 git worktree(含跨仓库 linked worktree)
2026-10-05 01:39:22 +08:00
Atlas Zeng 086deb05d7 Merge pull request #803 from MengJiapeng/fix/multi-repo-git-history
fix(git): keep history and status on the selected child repository
2026-10-05 01:38:35 +08:00
Atlas Zeng d694b868b9 Merge pull request #828 from yanzhaohui1999/fix/826-file-link-line-suffix
fix(editor): 正文里 `[path](path:131)` 的链接去掉行号后缀再打开(#826 第一半)
2026-10-05 01:38:18 +08:00
Menghuan1918 03575e1b67 merge fix/479-quote-directory-mention(Refs #479) 2026-10-05 01:37:27 +08:00
Menghuan1918 3b5fabe2a4 merge fix/765-git-path-base(Refs #765) 2026-10-05 01:37:27 +08:00
Menghuan1918 c5d8b13aa7 merge #802 into dev(文件树跟随活动 worktree,按 dev 原位解冲突)
三处冲突都是 main/dev 侧后插入行与变量改名造成的上下文漂移,被改的目标代码在
dev 上逐字仍在,按 dev 原位解(不是回退到 PR 的旧上下文):

- src/index.ts 导入区:保留 dev 新增的 FS_TREES_MAX_PATHS 导入与注释,同时加
  activeWorktreeRootOf 导入——两边都要;
- src/index.ts /sidebar/file 路由:保留 dev 的路径解析注释(dev 里本来就重复了
  一份,本次不顺手清理,避免把无关改动混进合并),cwd 改走 activeWorktreeRootOf;
- src/client/Sidebar.tsx:删掉 summaryCwd(改由 useSessionRoot 提供根),保留
  dev 插入的「空白会话」注释;
- src/client/native/tab-adapter.tsx:保留 dev 的 seat/scope 双会话命名与注释,
  useSessionCwd(ctx, scopeSessionId) → useSessionRoot(ctx, scopeSessionId)。

落地方另修三处(PR 自带 spec 在本机 macOS 上红,逐条有实测证据):

1. src/active-worktree.ts 的 normalizeActivePath 把分隔符一律折成反斜杠,POSIX
   路径随即不再 isAbsolute 而被 addActivePath 丢弃——该特性在 Linux/macOS 上
   静默空转(只在 Windows 上有效)。改为折成平台分隔符 sep;Windows 上 sep 就是
   反斜杠,行为不变。
2. active-worktree.ts 的根缓存改到 git 探测之前查询,并缓存「不在仓库里」这一
   结果:探测是一次真实 spawn(实测 ~6.5ms/次),此前每个 watch 帧、每个路由
   调用都要付一遍。dev 的 tests/zip.spec.ts「第 5 个并发构建被拒」正因此从 5/5
   绿变成 5/5 红(A/B:只回退 cwdOf 包装即恢复绿),本改动后该用例恢复 5/5 绿。
3. tests/active-worktree.spec.ts 的期望值改用 realpathSync.native:根来自
   `git rev-parse --show-toplevel`,本就是规范化路径,macOS 的 /var →
   /private/var 会让 resolve() 断言恒红(与 tests/git-worktree.spec.ts 同款写法)。

Refs #802
2026-10-05 01:35:58 +08:00
Menghuan1918 eed2fee0e6 fix(client): 含空格的目录 @ 引用补引号,让宿主能识别成 folder(#479)
宿主的两处 token 读取都只认「引号闭合」的目录写法:
`FOLDER_REF_RE`(dsh-client-ui-conversation)的引号分支是 `@"[^"\n]*\/`,
消息气泡的 `@"[^"\n]+"` 也只在闭合时才把 token 判成 folder;而插件目录分支
原先直接拼 `@${rel}/`,含空格目录 `@my dir/` 在补全扫描里完全不命中、在气泡里
退化成只覆盖 `my` 的 file 芯片——文件分支经 fileMention 加引号,目录分支没有,
同一套引号规则被写了两遍,只有一份对。

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

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

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

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

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

Refs #828
2026-10-05 01:30:34 +08:00
Menghuan1918 130d45dbc7 fix(git): git.diff/git.discard 按仓库根解析状态行路径,不再打中子目录同名文件(#765)
根因:`resolveGitPath` 对相对路径先试「会话相对」(`join(cwd, raw)` 存在即采用),
仓库根只作兜底;而变更树的行携带的本来就是**仓库根相对**路径(`git status` 原样
透传)。于是会话 cwd 位于仓库子目录、且该子目录里恰有同名文件时,`git.discard`
还原的是子目录那份(issue 的「还原错文件」),`git.diff` 预览的也是子目录那份
(「预览错内容」)——`git -C <repoRoot> checkout -- <解析结果>` 按其自身基准执行,
与「会话相对」这个猜出来的基准不一致。

只改这两条路由:它们是**状态行驱动**的路径,基准由 git 自己给定(仓库根),新增
`resolveStatusPath` 显式按仓库根判定,与后面 spawn 的 `git -C <repoRoot>` 同基准。
`fs.read` 的会话相对优先语义**保持原样**:编辑器 / 文件树的相对路径本就是会话相对
的(`tests/smoke.spec.ts` 的 `src/git.ts` 一类契约),改成仓库根优先会推翻既有
语义;未跟踪文件的 diff 回退本就送绝对路径,不受影响。`src/git.ts` 零改动。

测试:`tests/smoke.spec.ts` 新增「子目录同名文件」用例(会话 cwd=<repo>/pkg,
`git.discard {path:'README.md'}` 命中仓库根那份、子目录那份仍脏;`git.diff` 预览
仓库根那份),修复前两条均红、修复后全绿。

Refs #765
2026-10-05 01:30:34 +08:00
Menghuan1918 4a03e131e5 fix(diff): 会话镜头 diff 的超大输入退化为全删全增,不再建稠密 LCS 表(#734)
rows.ts 的 lcsTable 是无护栏的稠密普通数组矩阵(每单元约 8 字节),成本
完全由输入行数乘积决定。实测:1000×1000 → 8MB、3000×3000 → 71MB、
5000×5000 → 193MB、10000×10000 → heapDelta 765MB(峰值 RSS 865MB)。
会话镜头把上一次 write 的完整文件内容当 prior 传进 diffOf(ops.ts 对
content 无字节/行数截断),选中一个 op 就在 useMemo 里同步跑完,因此一份
万行文件的改动预览会一次性吃掉数百 MB 主线程内存。

护栏落在 diffLines 内部、lcsTable 调用之前(它是会话镜头唯一的 LCS 入口,
一处覆盖 diffOf 的三个分支):新增导出常量 MAX_LCS_CELLS = 4_000_000
(≈32MB,仍精确覆盖 2000×2000 的重写配对),判定
oldLines.length * newLines.length;超限不建表,直接产出全删(oldLines
顺序,oldLine 1..n)+ 全增(newLines 顺序,newLine 1..m)。

退化路径同时跳过 pairMods:在没有找到任何对齐的情况下,del 段与 add 段
会被成对标成 mod,那不是「已判定为改写」。所以退化语义是无 context、无
mod,只有 del/add。10000×10000(中间改一行制造错位)实测 0.44–0.96ms,
原实现为 592ms/765MB;渲染侧既有 MAX_ROWS = 600 截断,无需新增提示文案。

测试新增规模用例(20000 行、kind 全为 del/add、两侧行号严格递增
1..10000、单次耗时 < 2000ms,阈值按慢 CI 放宽)与边界用例(恰好
MAX_LCS_CELLS 时仍走表路径)。

Refs #734
2026-10-05 01:29:00 +08:00
Atlas Zeng 5cf7768dbb Merge pull request #842 from UNscientific-9/fix/checkout-end-of-options
fix(git): checkout 的分支名不再被当成选项(补 4100e16 漏掉的那处)
2026-10-05 01:25:51 +08:00
Atlas Zeng d3df20e8c9 Merge pull request #837 from dat-lequoc/fix/editor-visibility-remeasure
fix(editor): remeasure parked CodeMirror views
2026-10-05 01:25:36 +08:00
Andrei Sviryd 7599d4ac02 fix(ime-guard): trust keyCode 229 only inside a live composition context
Synthetic 229 keydowns emitted outside any IME (layout-switcher
utilities, e.g. KeyRay's layout swap: backspaces + one keydown carrying
the whole converted word via CGEventKeyboardSetUnicodeString, which
Chromium reports as keyCode 229 / isComposing=false) were swallowed by
the document-capture guard, so only the backspaces landed and the
replacement text silently disappeared.

Now the legacy 229 signal is trusted only while a composition is live,
plus a 50ms grace window after compositionend (covers legacy engines'
closing 229 keydown with isComposing === false, e.g. Safari). Real IME
composition keys (isComposing === true) are unaffected.
2026-10-04 20:16:44 +03:00
Menghuan1918 aa2644befa test(sidechat): 钉住畸形 assistant content 不抛错(#557 移植)
PR #557 的实现部分已被主线的 src/assistant-live.ts 取代,但它新增的这条
用例有独立价值:守 src/sidechat-core.ts 的 messageTexts / resultBlocks 三道
守卫——单条畸形行(content 非数组、message 缺 content、block 非对象、text
非字符串)不得让整个 open-turn 快照变空。

按原样移植,**不**带上该 PR 同时删掉的两条回归用例(producer round-trip /
LEGACY 0.1.6-wrapped),那两条在 dev 上是通过的。

Refs #557
Co-authored-by: later0day <later0day@users.noreply.github.com>
2026-10-05 00:56:36 +08:00
Menghuan1918 d35f622e66 merge dev into fix/host-load-without-session-log-offset-runtime
# Conflicts:
#	src/sidechat-routes.ts
2026-10-05 00:55:34 +08:00
Atlas Zeng 00801f5289 Merge pull request #818 from btsd321/feat/tabbar-right-actions
feat(tabbar): 新增 TabDescriptor.rightActions,活跃 tab 可注入 tab 栏右侧操作区
2026-10-05 00:54:50 +08:00
Atlas Zeng e864dabe6f Merge pull request #814 from ZinChl/fix/tasks-fold-guards
fix(tasks): 任务页折叠守卫的三处不一致(根卡死控制 / run 成员绕过 leaf 测试 / 文档矛盾)(#784)
2026-10-05 00:54:34 +08:00
Atlas Zeng c571e96c65 Merge pull request #813 from ZinChl/fix/subagent-running-after-restart
fix(tasks): 会话「驻留」不再当作「agent 在跑」——崩溃重启后的子代理状态(#800)
2026-10-05 00:54:18 +08:00
Atlas Zeng c7980cee7c Merge pull request #811 from ZinChl/fix/fs-trees-batch-split
fix(files): fs.trees 按宿主上限分块,展开集 ≥64 的会话不再整树报错(#799)
2026-10-05 00:53:58 +08:00
Atlas Zeng ce3527ca1e Merge pull request #809 from ZinChl/fix/archive-status-session-scope
fix(files): 修「压缩并下载」必然失败——archive.status 缺 sessionId + ready 交接无护栏(#798)
2026-10-05 00:53:43 +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
Atlas Zeng 10e99dba7e Merge pull request #806 from ZinChl/fix/search-result-directory-click
fix(files): 搜索结果里的目录行改为导航文件树,不再当文件打开(#801)
2026-10-05 00:53:09 +08:00
unsc9 9c248d0933 fix(git): checkout 的分支名不再被当成选项(补 4100e16 漏掉的那处)
`git.checkout` 把调用方给的分支名当裸操作数拼进 argv,所以 `-f` 被 git 的选项解析器吃掉,直接强制覆盖工作区并丢弃未保存的改动(`--work-tree=…` 则重定向 checkout)。同批加固 4100e16 给 show / commitDiff / revert / cherryPick 四个兄弟调用都加了 `--end-of-options`,只漏了这一处。

实测(真实 git,临时仓库):加哨兵前 `checkout -f` 退出码 0 且未保存改动被覆盖;加哨兵后 `-f` 与 `--work-tree=…` 均被拒且改动保留,正常分支名照常切换。

回归用例:tests/git.spec.ts「never lets a branch operand reach git as an option (checkout)」。
2026-10-04 21:47:17 +08:00
LE Quoc Dat db563ca76c fix(editor): remeasure parked CodeMirror views 2026-10-03 20:54:00 +00:00
ymac 2c5b7621dd fix(editor): 正文里 [path](path:131) 的链接去掉行号后缀再打开 (#826)
DSH 的 markdown 链接语法只认 GitHub 的 `#L131` 片段:目的地没有 `#` 时
`parseFileLink` 把整串当文件名返回。于是模型按编译器诊断的通用写法输出的
`[a/b.c](a/b.c:131)` 变成一次对 `b.c:131` 的文件打开,编辑器读不到、右侧栏
红字报「文件不存在」。

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

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

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

测试:新增 tests/path-line.spec.ts(9 例,含全部「必须原样通过」的反例);
tests/native-surface.spec.ts 补 fileParamsOf 四例 + editor 类型对带行号地址的
标题。typecheck / lint 全绿;全量 1503 passed,tests/locales.spec.ts 的 ja
词典缺 key 在干净 origin/main 上同样失败(既有问题,不在本 PR 范围)。
2026-10-01 22:05:56 +08:00
HuanLinOTO 9cc40472f8 fix(paths): Copilot review 四条全修——共享解析契约贯穿 media/html/fs 变更入口
- html 路由 decoder 保留 ~ 首段原样(~/x.html 不再被拼成绝对 /~/x.html),
  encoder/decoder 往返与相对资产解析均保持 ~ 标记(#713)
- media/download 路由去掉 isAbsolute 预拼接,raw 直达 ensureWorkspacePath
  (~ 展开不再被 cwd 前缀遮蔽);fs.trees 同型守卫
- fs-operations 的 rename/remove/mkdir(resolveEntry)与 upload(base)全部
  改走 resolveTarget 共享契约,会话相对路径四入口齐活(#646/#713)
- session-path 的 fs 落盘 remote-mirror 用例改为 Windows-only(win32.join 的
  meta 路径拼写在 POSIX 上不指向已创建文件,修 ubuntu ci 红)

新用例 8 个;四处变异验证(还原任一修复对应测试必红)。
2026-10-01 18:41:27 +08:00
HuanLinOTO 0500aa045a Merge PR #789 (ported): fix(files): 在途层渲染 loading 行,消除新展开文件夹的空目录闪烁(移植到 loadLevels 新形状,#693 #687) 2026-10-01 17:46:52 +08:00
HuanLinOTO 14320952be fix(train): 清理 fs-write-relative-path.spec 的未用导入(lint) 2026-10-01 17:26:29 +08:00
HuanLinOTO aa82c4aed7 fix(train): #697 测试 harness 适配 #776 的 mounted 观测——会话列表从来沒有 current 字段(AGENTS §3.4.9) 2026-10-01 17:25:16 +08:00