Commit Graph
749 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 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 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 4c2d34fce4 refactor(editor): 待插入引用改名 PendingReference,去掉泛型默认值
宿主导出的 DraftReference 是「草稿里已有的气泡」(带 offset/length),
插件这个类型是「准备插入的引用」(只有 label/text)。两者同名不同义,
按名字 grep 会拿到完全不同的形状。改名为 PendingReference 区分。

selection-popup 的 T = string 默认值生产环境已无人使用(唯一调用方
显式写了类型),只为迁就测试里不写类型的旧写法。去掉默认值后类型仍能
从实参推断,测试无需改动。
2026-10-24 21:53:24 +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 b3b316b457 refactor(editor): 气泡插入直连宿主 facade,共用一份分隔规则
宿主 SessionInput 上本来就有带返回值的 insertReference(native @ 选择器
的监听器就是转调它),之前绕道 emit 事件是多余的一层:手抄了相位白名单、
还得靠前后 draftRev 比对推断成败。改为直接调用后,这两样都交回宿主。

顺带收拢三处重复:
- 左侧分隔空格规则原本 spliceInsert 与气泡分支各写一遍,抽成 leadFor;
  气泡分支不再算完整条草稿再丢弃。
- 「先试气泡、失败退化纯文本」的策略在 TextEditor 与 explorer 按钮各写
  一遍,收进 insertReferenceOrText。
- 测试里两份几乎相同的 composer 假件合并成一个 composerCtx。

无行为变化:气泡仍只在宿主支持时插入,其余情况照旧退化纯文本。
2026-10-24 20:29:53 +08:00
unsc9 9ebb14f7ad fix(editor): 有气泡但无 revision 时拒绝写入,别退化成碾平
宿主若既不给 draftRev 又拿不到 span 通道,剩下唯一的写入路径是
setDraft,它会重建整个文档、把每个气泡碾平。宁可不插入,也不毁掉
用户已经堆好的引用。
2026-10-24 19:19:05 +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 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
kelvinwww fd5a38538e fix: 补齐提交历史提示的多语言词条 2026-10-20 21:42:13 +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
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 315ad5d5ff fix(client): 插入事件未被宿主采纳时留下 warn(不再静默无操作)
宿主换掉/改名 `slash/input-insert-*` 或 CAS 拒绝这次插入时,两条路径原先只是静默返回 false
(点击"什么都不发生")。现在补一条 `console.warn`,让这种上游变化在用户报障前就能从控制台认出来;
顺带给 `insertFileReference` 的"没人处理事件"补上单测(appendToDraft 那条同时改为断言 warn)。
2026-10-18 20:25:45 +08:00
ymac 3757f75ca7 fix(client): 草稿插入不再整份重写,chip 不再被展平(@ 提及两段式)
`appendToDraft` 走的是宿主 `setDraft(整串)`,而该 API 的契约原文就是「用纯文本替换整份
草稿、移除内联引用 chip」:草稿里已有的每个 chip 会被展平成 `@dir/file.ts` 文本,宿主再只
装饰 `@dir/` 前缀——所以侧栏 @ 引用按钮插一次目录(或文件插入失败回退一次),之前所有
@ 选择都会退化成「`@notes/` + 文件名」两段。另外文件插入的 span 用的是剪贴板长度,而宿主
`TokenSpan` 是 detect 坐标(chip = 一个 U+FFFC),草稿里只要已有一个 chip 就越界被拒,
于是那次插入必然落到上面这条破坏性回退上——这正是「第一次正常、第二次把第一次变成两段式」。

- 文件与目录都改走宿主的 scoped composer 事件(`slash/input-insert-reference` /
  `slash/input-insert-text`):只改目标区间,其它节点原样保留;
- 新增 `detectLength` / `clipboardToDetect`,用 `InputState.occurrences` 把 span 折进
  detect 坐标(落在 chip 内部的位置吸附到该 chip 之前);
- 删掉 `placeComposerCaretAfterInsert`:事件插入后由宿主落 caret,而 0.1.7+ 的 composer
  是 Lexical contenteditable,`<textarea>` 探测恒 null,那套补偿已是死代码;
- 事件没人处理时返回 false 并保持草稿不动(宁可什么都不插,也不再整份重写);
- 回归:`tests/conversation-draft.spec.ts` 的假宿主同时模拟 detect 坐标折叠与「越界拒绝」,
  `tests/sidebar-workspace-reference.spec.tsx` / `tests/reference-in-chat.spec.ts` 改为断言
  事件载荷,并断言 `setDraft` 从不被调用。
2026-10-18 19:31:38 +08:00
Matt Van Horn 74c723ecc6 fix(builtins): archive sidechat sessions when their tabs close
Closing a bound side chat tab now archives that thread through
uiWorkspace.archiveSession with stopActivity, then disposes the live
agent. A missing workspace service or a failed archive still disposes
the agent, and the close path settles on its own. A tab with no thread
id skips both steps. The header action that saves a copy as a new
session, and the explicit archive control, stay as they were.

Fixes #942
2026-10-16 23:47:14 -07: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