Commit Graph
825 Commits
Author SHA1 Message Date
Menghuan1918 73fed1689d merge #1059: 重新载入后不再死锁在 fs-conflict(仅 mtime 变化就地更新保存基线)
# Conflicts:
#	CHANGELOG.md
2026-10-26 15:20:23 +08:00
Menghuan1918 44007061bb fix(editor): 重新载入后不再死锁在 fs-conflict(#1059)
根因:保存基线 mtimeRef 只在 [content] effect 里刷新;重新载入返回同样
文本时 content 不变,effect 不跑,下一次保存继续发送旧 expectedMtimeMs。

修复:
- props.mtimeMs 变化时也更新 mtimeRef(只动基线,模式/草稿/脏标记的
  文件切换重置语义保持不动);
- 冲突横幅「Reload from disk」先探测磁盘文本:与上次载入/保存的字节
  一致时说明只有 mtime 变了,就地采用新基线、保留草稿、不经过脏确认;
  文本确实变化时才交回宿主的带确认重载(脏保护不变);
- 记录最近一次成功保存的文本作为比较点:编辑态保存不会重新载入,单靠
  props.content 会滞后于磁盘。

tests/text-editor-conflict.spec.tsx 的横幅回调断言跟随异步探测调整:
探测失败时仍在下一微任务回落宿主重载。
2026-10-26 15:19:12 +08:00
Menghuan1918 5bacf5fa0c 修复提交图标签缺失并校验标签分页快照 2026-10-26 15:19:02 +08:00
Menghuan1918 0dfee1dd84 test(editor): 覆盖仅 mtime 变化的重新载入保存基线(#1059)
两个判别性用例:
- TextEditor 同实例收到新 mtimeMs、content 不变时,保存必须发送新基线;
- 冲突横幅重载:dirty + 仅 mtime 变化 + confirm=false 时就地更新基线并保留草稿;
  磁盘文本确实变化时脏保护仍然生效。

修复前第一个文件的首例失败(100 vs 200),第二个文件的首例失败
(confirm 被调用、横幅不清除)。
2026-10-26 15:17:32 +08:00
Menghuan1918 1eeec0c27e merge #1053: fix(sidebar): keep the bottom workbench toggle while the right panel is open
# Conflicts:
#	CHANGELOG.md
2026-10-26 15:07:36 +08:00
Menghuan1918 6b4f9652f6 merge #1055: fix(markdown): 本地链接里的 Windows 反斜杠统一为正斜杠
# Conflicts:
#	CHANGELOG.md
2026-10-26 15:07:15 +08:00
Menghuan1918 5311467060 merge #981: fix(builtins): archive sidechat sessions when their tabs close 2026-10-26 15:07:01 +08:00
Menghuan1918 01a6fa573b merge #1057: perf(sidebar): 页签内容的会话 scope 改为按内容稳定,消除无关重渲染导致的整文件重读 2026-10-26 15:03:28 +08:00
Menghuan1918 25fd296f99 merge #1052: feat(editor): 「添加到对话」改用引用 chip,正文只在发送时展开
# Conflicts:
#	src/client/conversation-draft.ts
#	src/context-types.ts
#	tests/conversation-draft.spec.ts
#	tests/reference-in-chat.spec.ts
#	tests/sidebar-workspace-reference.spec.tsx
2026-10-26 15:03:28 +08:00
Menghuan1918 f74369d2b6 merge #1002: fix(client): 草稿插入不再整份重写,chip 不再被展平(@ 提及两段式) 2026-10-26 15:02:38 +08:00
Menghuan1918 ad078e4ea4 merge #965: fix(editor): remember the edit scroll position across tab re-seating 2026-10-26 15:02:38 +08:00
Menghuan1918 042ae22bf4 merge #1012: fix(float): 浮窗右下角缩放手柄不再被 tab 内容压住 2026-10-26 15:02:36 +08:00
Menghuan1918 01f126e866 merge #1020: fix: export the plugin icon subpath
# Conflicts:
#	CHANGELOG.md
2026-10-26 15:02:36 +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 28566625b3 merge #1018: fix: 分支过多时继续显示提交历史 (#1013) 2026-10-26 15:00:52 +08:00
unsc9 31dc3b4572 perf(sidebar): give every consumer one stable session scope
A tab body keys memos and effects off `scope` (the diff pane resolves its
media/html routes from it, the editor restores its preview scroll, the side
chat rebuilds its prose-rewrite cache), but the tab cell built
`{ sessionId, cwd }` fresh on every render. Every such dependency therefore
looked changed whenever the cell re-rendered — which the memo comparator
allows exactly when a COMPARED field moves: `expanded` on a directory toggle,
plus `revealed`, `localeRevision`, `tabsVersion`. The diff preview then
re-ran its whole-document rewrite and its content tab re-issued a whole-file
`fs.read`, flashing its loading row.

`useSessionScope` is now the one place a scope for a component tree is built;
the tab cell, the diff tab, the native tab adapter, and the shell's badge /
rightActions / `+` menu / lifecycle-callback seams all use it. Those last
ones are documented external plug-in surfaces, so a plug-in memoizing on
`scope` stops churning on every unrelated re-render too.

Stabilizing the object removes the only path the diff pane's `content` tab
had to re-read after the file changed on disk, so the header's refresh button
now drives it explicitly (the pane owns the gesture; the loader no longer
leaks its internal counter).

Seven comments asserted that the scope object's identity churns on every
render; that premise is gone, so the ones that still apply say what they
actually guard.
2026-10-25 20:41:54 +08:00
wumingguren 828452ae77 fix(markdown): 本地链接里的 Windows 反斜杠统一为正斜杠
Markdown 把 `\_` 当作转义,`[x](C:\ws\_analysis\r.md)` 解析后路径少一个分隔符(变成 `C:\ws_analysis\r.md`),点击时报 ENOENT(issue #1037)。

- rewriteDestination 对所有本地 destination 的路径部分用正斜杠输出(Windows 接受两种写法);无 fragment / line fragment / heading fragment 三条分支都覆盖
- UNC 前缀保持 `\\`,避免被解析成协议相对的 `//host/share`
- 新增 6 条断言:绝对/相对 Windows 路径、heading/line fragment、远程链接、幂等

验证:tsc --noEmit 与 eslint 通过;同一组用例用 Node 直跑通过(本机 vitest 配置打包在 Windows 上失败,CI 执行该 spec)。
2026-10-25 11:57:13 +08:00
WinterXMQ f2ad4b1af8 Merge branch 'dev' into fix/bottom-toggle-with-right-panel 2026-10-25 02:25:33 +08:00
WinterXMQ 788c5149c0 fix(sidebar): keep the bottom workbench toggle while the right panel is open
The header toggle bailed out whenever the host's right sidebar was expanded,
so opening that panel first left the bottom workbench unreachable until it was
collapsed again. The session header's utilities seat and the panel's own
Split / Fullscreen / Collapse cluster sit in two different columns, so they
never overlap.

The blank-session fixed fallback keeps its guard: that entry anchors to the
left of the panel controls and would cover panel content while expanded.

tests/bottom-toggle.spec.tsx pins both behaviours.
2026-10-25 01:31:21 +08:00
unsc9 9598278094 refactor(editor): 删掉真机上永不生效的 DOM 光标探测
宿主 composer 是 Lexical contenteditable,真机页面里 0 个 textarea
(已用无头浏览器核对)。probeComposerCaret / placeComposerCaretAfterInsert
永远返回 null,spliceInsert 的中间插入分支也永远走不到——三段死代码,
连同它们的 jsdom 测试一起删除。appendToDraft 只剩追加语义。

同时清掉 review 指出的注释与文档问题:
- 模块头还写着「从 textarea 探光标」,与同文件后文自相矛盾。
- clipboardText 取短形态的理由写错了:宿主持久化的是 {text, references},
  气泡能跨重挂载恢复。真正的理由是它是草稿串的对外投影。
- 同一句「宿主自带相位/rev 守卫」在 conversation-draft 与 context-types
  各写一遍,后者改为引用。
- 设计文档 §2/§4/§6 已与实现脱节(insertFileReference 已删、phase 语义
  已变、命令气泡是新坑),按当前实现重写。
2026-10-24 21:45:47 +08:00
unsc9 b7d17e8c0a fix(editor): 气泡插入补左侧分隔,并覆盖命令气泡与冻结期
code review 挖出的六处行为问题:

- 宿主只在气泡之后补空格,之前不补,所以往 hello 后插气泡会读成
  hello[chip]。插入前先用同一条 span 通道占一个分隔位。
- 命令气泡(/goal)不在 occurrences 里(宿主只收引用气泡),但它在
  detect 投影里同样只占一个字符。补上按 claim.token 折叠,否则 span
  越界、引用插不进去;setDraft 分支也会把命令气泡碾成字面文本并丢掉
  claim,所以 claimed 状态同样走 span 通道。
- 选区气泡的 ref 是围栏正文而非路径,标成 appearance:file 会让宿主
  把它当可点开的文件,点一下拿整段正文去开文件。改为由调用方决定。
- 宿主可能已经应用了编辑再抛异常,此时报 false 会让调用方再插一份纯
  文本。异常分支先重读 revision 再判断。
- 冻结期(adjudicating/submitting)直接拒绝,不回退。

顺带删掉 insertReferenceOrText 没人覆盖的 fallbackText 参数,修掉
insertWorkspaceReference 对同一路径重复调用 mentionFor。
2026-10-24 21:39:14 +08:00
unsc9 26be90d66f test(e2e): composer 定位改用宿主的 composer slot
首屏占位符名字(Describe what you want to build)在会话有内容后就消失了,
拿它查 composer 会一直超时。改锚定 [data-slot=conversation.composer.bar]:
这是宿主自己的稳定属性,且天然把插件里同样 contenteditable 的 CodeMirror
排除在外,不用再靠 DOM 顺序猜。
2026-10-24 20:50:07 +08:00
unsc9 9067e2cac4 test: 夹具跟上 insertReference facade,e2e 复用权威 composer 定位器
- conversation-draft 的两份 composer 假件合成一个 composerCtx,删掉从未
  被调用或断言的成员(setDraft / snapshot / phase 选项)。
- reference-in-chat、sidebar-workspace-reference 改为断言 facade 调用,
  不再断言 emit 事件。
- mount.e2e 用 host.ts 导出的 composerLocator,不再用
  [contenteditable=true].first() —— 插件自己的 CodeMirror 也是
  contenteditable,按 DOM 顺序取首个会取错。
- 修正设计文档里一条与实现相反的结论(ref 存的是发送正文,不是 label)。
2026-10-24 20:29:59 +08:00
unsc9 1ed872268c test(e2e): 选区气泡探针改用真实拖拽与正确的选择器
三击/合成点击会在 mouseup 之前丢掉选区,浮层不弹;改用 mouse.move/down/up
的真实拖拽。气泡是 composer 里的兄弟装饰节点,不是 role=textbox 的后代,
选择器改按 label 文本在整页范围内定位。

真机 mount lane 已验证通过(23s):预览里选中一行 → 点按钮 → composer
里出现 diagram.md:12 气泡,草稿不含三反引号。
2026-10-24 19:39:55 +08:00
unsc9 8c431db740 test(e2e): 断言选区引用落在 composer 里是气泡,不是围栏正文
真机 mount lane 加一段:预览里选中一行 → 点「添加到对话」→ 断言
composer 里出现 path:lines 气泡,且草稿文本不含三反引号。
宿主若不认 reference-insert 事件、退化成纯文本,这条会直接失败。

同时记录设计与两套坐标系(clipboard / detect)的折算规则。
2026-10-24 19:17:42 +08:00
unsc9 f71a2727f1 feat(editor): 选区引用改成气泡,正文只在发送时展开
选中文字后点「添加到对话」,草稿里插入的不再是一整段围栏正文,而是
一个紧凑气泡(显示 `相对路径:起止行`);发给模型的仍是完整围栏块。
连续引用几段不再把输入框铺满。

- 复用宿主自己的 slash/input-insert-reference 通道(原生 @ 选择器同款)
- 新增 foldClipboardOffset:把草稿偏移折算到宿主的 detect 投影,否则
  草稿里已有气泡时 span 越界、第二次插入必然失败
- 气泡的 clipboardText 取短形态(label),会话重挂载时退化也只是一行
- 宿主没有气泡通道时回退原来的纯文本路径
- appendToDraft 在已有气泡的草稿上改走 span 事件,避免 setDraft 重建
  文档把每个气泡碾平
2026-10-24 19:09:07 +08:00
Menghuan1918 18dade0f63 fix(perf): address the perf-scan review findings 2026-10-24 12:10:17 +08:00
Menghuan1918 a721911d44 perf(worktree): re-arm the active-root TTL when the event cursor is idle 2026-10-24 02:17:12 +08:00
Menghuan1918 81b2e8077e perf(bundle): answer HEAD from the stat without reading the chunk 2026-10-24 02:17:12 +08:00
Menghuan1918 0a4a94c704 perf(graph): window the commit history rows 2026-10-24 02:17:10 +08:00
Menghuan1918 2237f3787b perf(diff): parse a patch once and cap the default expansion 2026-10-24 02:17:10 +08:00
Menghuan1918 b1efd9226b perf(sidechat): cache the per-row prose rewrite 2026-10-24 02:17:07 +08:00
Menghuan1918 4cb7937a37 perf(files): keep parked trees idle and batch the watcher re-arm 2026-10-24 02:17:07 +08:00
Menghuan1918 27a920f85b perf(tasks): coalesce wheel zooms to one commit per frame 2026-10-24 02:17:05 +08:00
Atlas Zeng 740d73a09a Merge pull request #1041 from omdsh-dev/fix/tasks-folding-performance 2026-10-23 21:44:37 +08:00
Menghuan1918 dc385130a0 fix(tasks): coalesce pointer drags to one update per frame
Background pans, the floating-window title drag and the anchored-popover drag committed on every pointermove, so a high-report-rate mouse re-rendered the tasks canvas at event cadence. Compose the latest position in a ref and commit it through the existing frame batcher; release and cancel flush synchronously. Click suppression still updates per event.

Regression: same-frame 100-move burst commits drop 98 -> 1; full suite 2720 passed.
2026-10-23 21:28:22 +08:00
NolanHo 6f14792baa fix(sidechat): address rendering review findings
Replace a failed present card with the generic failed tool row; keep one event-authoritative card whichever of the call and its delivered event lands first.

Use the host's real border token for the delivery card; include the visible description in the file button's accessible name and resolve its title path.

Handle CommonMark angle-delimited image destinations and preserve titles; add transcript, prose-rewrite, and DOM regression tests.

Update the change spec with review-driven acceptance commands, status, and evidence.
2026-10-23 02:48:13 -07:00
NolanHo 909f536eab feat(sidechat): render local images and present deliveries
Cache markdown label objects by value so MarkdownText's memo survives parent re-renders; pass streaming for unsettled assistant rows.

Rewrite local image destinations in Side Chat prose against the session cwd through the existing /sidebar/file media route.

Map present tool calls and deliverables/presented events to a compact delivery card with thumbnails and the plugin's file-open path.

Add the change spec, exploration notes, and regression tests.
2026-10-22 22:25:07 -07: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
路从今夜白 34fbad8a75 fix(sidechat): preserve child history across session restore 2026-10-22 23:06:13 +08:00
路从今夜白 9a11166c92 feat(sidechat): expose opt-in transcript surfaces for GenUI 2026-10-22 21:22:25 +08:00
学习爱我 88831b0729 fix(search): handle synchronous engine probe spawn failures 2026-10-22 18:15:43 +08:00
kelvinwww 74c169c1bb fix: 导出插件图标子路径 2026-10-20 23:14:24 +08:00
kelvinwww b9e07526c3 fix: 分支过多时继续显示提交历史 2026-10-20 21:21:27 +08:00
ymac 9bece137e1 fix(float): 宿主缩放手柄不再被 tab 内容压住
浮动 Git tab 的右下角 20×20 手柄([data-dockkit-float-resize])是浮窗的
最后一个子节点,但宿主给它 z-index: auto;Git footer 的 sticky + z-index:1
正好盖在角上,手柄既看不见也点不到,整个浮窗无法用指针缩放。实测文件 tab
的浮窗正常(底部没有 stacking 栏),只有带底栏的 tab 中招。

- 把宿主手柄抬到 z-index:2:覆盖第三方 tab 内容,不依赖插件自己的底栏;
- 收掉 .gitFooter 的 z-index:sticky + 定位已足够压在滚动行之上,这一层
  在没有该宿主属性的版本上也成立;
- tests/float-resize-grip.spec.ts 钉住两条(含 z-index 必须 > 1)。
2026-10-19 23:17:03 +08:00
NolanHo e5f96b8e36 fix(sidechat): trim the seed when a model switch rewrites the head
A model switch after the last compaction replaces the protected system
prompt with a system/message whose seq sits after the cut but whose
surface slot is the head before the checkpoint. The builder refused that
shape, so every such sidechat copied the parent log in full.

Resolve the single-node replacement chain to its pre-cut anchor using the
checkpoint's recorded shadowed set (not its declared numeric range, which
misclassifies keep-window replacements), carry the latest replacement in
the head slot with the anchor's turn/step scaffolding, and consume the
chain so the keep window and tail never re-emit it. Range replacements,
targets the checkpoint removed, non-system nodes, and broken or forward
chains still fall back to the verbatim copy.

Tests cover a single switch, a two-switch chain, a multi-hop chain whose
intermediate sits inside the declared range but not in the shadowed set,
and a valid range fallback. The trim fixtures fall back on the old code.
Real parent logs now trim (6036->187, 8329->2479, 16458->4359, ...) with
surface equivalence and Session.create acceptance; the previous
35992->3456 trim is unchanged.
2026-10-19 07:37:01 -07:00
finley08 a1f140562c fix(editor): remember the edit scroll position across tab re-seating
Saving re-seats the native tab body (the chip's dirty mark clears, the change
gutter refreshes), and a scroller that is detached from the document comes back
with `scrollTop` 0 — scroll position is carried neither by React state nor by
the DOM node, so the edit surface needed its own memory. The preview already
kept one for the same reason (its save-then-reload collapses the container);
the editor relied on the view never being re-seated, which saving breaks.

Mirror the preview's pattern for the CodeMirror scroller:

- record the position on the scroller's scroll event, keyed per session + path,
  with a guard so the restore's own write is not recorded as the user's;
- restore on the save edges (`saving → saved`, the change-gutter refresh, the
  mode gate), and after every reveal re-measure moved from #890's family;
- skip when the document fits (no meaningful position) or when the position did
  not change.

On top of the upstream `dev` line that already carries #859 and #890.
2026-10-19 10:18:14 +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
ymac 494f5e80d0 test(e2e): 覆盖「两次插入之间夹文本」与「多行选区引用」,并补一条多行单测
真机 lane 的这条用例现在跑四种形状:两次文件 @(chip)、一次目录 @(纯文本 token)、
中间夹打字文本后再插一个文件 @、以及从 markdown 预览里框选多行后用选区弹窗插入
(payload 是带围栏的多行串)。每一段之后都要求既有 chip 数量与身份不变、纯文本 token
数量不变、且引文逐字落地(围栏与换行都在)。写成这样是因为旧实现在**任何一次**插入时
都会整份重写草稿,四种形状都会红。

lane 里踩到的两个选择器坑,注释已经写在用例上,避免下次再踩:
- 宿主为每个保留会话渲染隐藏 seat,`[data-sidebar-right-panel]` 会同时匹配隐藏副本,
  沿它取 `.first()` 拿到的可能是不可见的那个(boundingBox 为 null / 文本节点没有 rect);
- markdown 预览模式会把 CodeMirror 宿主**保留但隐藏**(未保存草稿),所以定位必须
  `filter({ visible: true })`,否则会选中隐藏的那份。

单测侧补一条:多行 payload 逐字交给宿主(围栏与换行不动)、既有 chip 的 occurrence 仍在、
`setDraft` 不被调用。
2026-10-18 20:38:20 +08:00