feat(agent): 新增可移植会话引用块【已审核 PR】 - #1311
Open
Andreaseszhang wants to merge 1 commit into
Open
Conversation
Made-with: Proma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
新增 Agent 消息选区的可移植会话引用能力。用户可复制单条 Agent 消息中的精确选区并粘贴到 Scratch Pad 或任意 Agent 输入框;界面显示可点击 chip,模型获得带来源的静态快照,并可跳回原始会话消息。
改动
apps/electron/src/renderer/lib/agent-quote-reference.ts— 新增引用数据模型、可移植 token、Clipboard HTML/纯文本格式、模型上下文构建与 XML 闭合标签防护。apps/electron/src/renderer/components/agent/AgentQuoteReference.tsx— 新增 TipTap inline atom 与可点击会话引用 chip。apps/electron/src/renderer/components/agent/AgentQuoteNavigationListener.tsx、AgentMessages.tsx— 支持从 chip 跨会话打开来源会话、定位并高亮原始消息。AgentHistorySelectionLayer.tsx、SelectionActionPopover.tsx— 新增“复制为会话引用块”操作及用途 tooltip;跨消息选区保持拒绝。rich-text-input.tsx、ScratchPadView.tsx、markdown-rich-text.ts、message.tsx— 支持粘贴、渲染、草稿恢复和历史消息中的引用 chip。agent-message-queue.ts、AgentView.tsx、agent-orchestrator.ts、共享 Agent 类型 — 将历史展示/持久化文本与 SDK 上下文分离:紧凑 token 写入历史,精确选区快照只发给模型;同时保留既有附件和临时选区元数据。agent-quote-reference.test.ts、agent-message-queue.test.ts— 覆盖 token 往返、草稿降级恢复、静态上下文隔离、附件/临时选区历史保留。docs/plans/2026-07-27-agent-selection-quote-blocks.md— 记录 MVP 范围和实现决策。测试方法
bun install --frozen-lockfile同步最新上游依赖。bun run typecheck,确认全部工作区包通过。bun test apps/electron/src/renderer/lib/agent-quote-reference.test.ts apps/electron/src/renderer/lib/agent-message-queue.test.ts apps/electron/src/renderer/lib/markdown-rich-text.test.ts,26 项测试通过。bun run --cwd apps/electron build:renderer,构建通过。备注
origin/main(3e45726a)创建。messageId精确定位,轮次仅用于显示。Made with Proma · GitHub