Commit Graph
8 Commits
Author SHA1 Message Date
xiangzz 805a03f91f feat(sidebar): 划选「添加到对话」落可点击引用 chip(点击回跳源文件并闪行段)
- 移植到 dev 基线(#1052 / #1002 之上):只加「可点击 + 行段落地」,不重做 chip 本体
- 自有 input-trigger source `betterSidebarQuote`:`openReference` 校验会话后回跳,
  `codec.serialize` 在发送时还原成与升级前字节一致的 `路径:起止` + 围栏正文
- 行段末行走模块级一次性旁路 `src/client/line-target.ts`(key = path + line,cap 32),
  不写进宿主导航参数(宿主 `SidebarRightResourceParamsMap.file` 只声明了 `line`)
- 引用记录存 `localStorage`(`dsh-better-sidebar:quote-refs`,FIFO 200):模块同时进
  core bundle 与 lazy editor chunk,两个实例只能靠它互见;插入失败即回滚记录
- 行段闪光用 CodeMirror 行装饰 + 皮肤令牌 `--dsw-alias-interactive-bg-hover-accent`
- 三级降级:自有 chip → #1052 内置 chip → 纯文本,永不比升级前更差
- 新增 peer `@deepseek-ai/dsh-client-ui-input-trigger` `^0.2.1-rc.1`(DSH peer 增至 14 条)
- 文档:指南新增 §7.2,并补 `openFile` options / `FileViewerProps.lineEnd` / peer 说明;
  AGENTS §3、CHANGELOG 双语、README 双语、`docs/plans/2026-11-03-selection-quote-chip.md`
- 测试:`selection-quote` 23、`quote-flash` 13、`line-target` 7,`conversation-draft` +2
2026-11-04 01:47:15 +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 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 f71a2727f1 feat(editor): 选区引用改成气泡,正文只在发送时展开
选中文字后点「添加到对话」,草稿里插入的不再是一整段围栏正文,而是
一个紧凑气泡(显示 `相对路径:起止行`);发给模型的仍是完整围栏块。
连续引用几段不再把输入框铺满。

- 复用宿主自己的 slash/input-insert-reference 通道(原生 @ 选择器同款)
- 新增 foldClipboardOffset:把草稿偏移折算到宿主的 detect 投影,否则
  草稿里已有气泡时 span 越界、第二次插入必然失败
- 气泡的 clipboardText 取短形态(label),会话重挂载时退化也只是一行
- 宿主没有气泡通道时回退原来的纯文本路径
- appendToDraft 在已有气泡的草稿上改走 span 事件,避免 setDraft 重建
  文档把每个气泡碾平
2026-10-24 19:09:07 +08:00
wang shi zhuo 1ad9ac7506 fix(explorer): separate completed directory references 2026-09-07 18:52:18 +08:00
懿驹-伯乐 963560a361 fix(conversation): restore the composer caret after the draft insert (#425)
A programmatic setDraft commit resets the controlled textarea's caret
(observed landing at the start of the value), so every later insert probed
the reset position and the stack drifted (A|B + C + D became |DACB).
placeComposerCaretAfterInsert puts the caret right after the inserted text
once the value commit lands - the index accounts for the left-side
separating space - and is guarded by a value-sync check plus a two-frame
retry, so a newer edit or a different composer wins untouched.

spliceInsert now reports the caret index together with the spliced draft
so the placement math cannot drift from the join logic. Nothing else moves:
the pure insertAtCaret surface is unchanged.
2026-08-29 15:31:13 +08:00
懿驹-伯乐 a3379ef17d fix(conversation): insert the selection popup text at the composer caret (#425)
appendToDraft always spliced at the end of the draft. The conversation
service exposes no caret API, so probe the live composer textarea selection
from the DOM (value-sync guarded) and splice at that position with
whitespace-aware joins; an unknown or stale caret falls back to appending.
The explorer @-reference shares this path, so it inserts at the caret too.
2026-08-29 15:31:13 +08:00