feat(ai): WPS 前后端契约命名双轨迁移(doc_*/editor_command 与 wps_* 并行) - #192
Merged
Conversation
Phase 3 遗留项落地(docs/AI_ARCHITECTURE.md §编辑器前后端契约): 后端双发(新名在前、旧名在后,顺序即契约): - SSE 流式写入:doc_stream_data + wps_stream_data(AgentOrchestrator) - client_action 命令:tool editor_command + wps_command,同 requestId; 同步打开 action doc_open_file_sync ↔ 旧名 wps_open_file_sync 映射(EditorBridgeService) - client_action 打开/刷新:doc_open_file / doc_reload_file + wps_*(sendDualNamedAction) - 结果回调路由:/api/ai/agent/editor-result 新路由,/wps-result 保留别名(EditorResultController) 前端双听 + 去重闩锁(project-overview handleClientAction): - 一旦见到任一新名即判定新后端(SSE 单连接有序),此后丢弃所有旧名事件, 新旧后端×新旧前端四种搭配下每条指令都恰好执行一次 - sendEditorResult 改发新路由 /editor-result 前端零散 WPS 遗留清理: - VariablePanel getWps prop → getEditor(绑定点/局部变量/注释同步) - ChatInterface wps-tip-*/wps-link-text CSS 类 → doc-tip-*/doc-link-text 文档:AI_ARCHITECTURE.md 契约表改双轨状态并勾掉 Phase 3 待办(留摘旧名项); ai_agent_dev.md §2.2 事件字典改为实际契约(移除已不存在的 wps_write)。 明确不动(存量数据,另立迁移方案):ProjectFile.wpsFileId、wps-files/ 存储前缀、 write_docx 的 wps_file_id 键、FeatureNotConfiguredException "wps" 标识。 验收:backend mvn test 全绿(JDK 21);npm run check:emits 过; Electron 真机三链路实测通过——AI 打开文档(后端 Sent doc_open_file + 编辑器拉流)、 查找替换修订(双发各 1 次/去重后执行 1 次/新路由 200/success=true)、 流式写入新文档(产物标记恰出现一次,无双写); 双 e2e:test:lowa-e2e 33/33,test:app-e2e 29 步全过 0 异常。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
zeweihan
added a commit
that referenced
this pull request
Aug 27, 2026
- 未登录空态改品牌欢迎卡,替代一句红字(#192) - 语言切换改地球 SVG 图标 + 目标语言缩写(#193) - 账户菜单展示身份与 AI 额度,删「连接与高级设置」入口(#194) - 历史与模型改常驻 pill,不再收进 + 二级菜单(#195) - 项目下拉支持新建项目(POST /api/projects,BLANK 类型)(#196) - 助手气泡轻量 Markdown 渲染 + 段间空行折叠 + 前导空白裁剪 + 吸底守卫(距底 48px 内才跟随流式滚动)(#197) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
概要
Phase 3 遗留项:把 WPS 时代的前后端契约命名迁到新名,双轨并行一个发布周期后再摘旧名(本 PR 只落双轨,不摘旧名)。登记于 docs/AI_ARCHITECTURE.md §编辑器前后端契约。
迁移映射
doc_stream_datawps_stream_datatool: "editor_command"tool: "wps_command"doc_open_file/doc_reload_filewps_open_file/wps_reload_filedoc_open_file_syncwps_open_file_syncPOST /api/ai/agent/editor-result/wps-result(路由别名)双轨机制(顺序即契约)
后端对每条指令按新名在前、旧名在后各发一份(SSE 单连接有序);前端凭"先见新名"置闩锁判定新后端,此后丢弃所有旧名事件。新旧后端 × 新旧前端四种搭配下,每条指令都恰好执行一次。
一并清理的前端零散遗留
VariablePanel.getWpsprop →getEditorChatInterface.vuewps-tip-*/wps-link-textCSS 类 →doc-tip-*/doc-link-text明确不动(存量数据契约,另立迁移方案)
ProjectFile.wpsFileId(含 DB 列与 API JSON 字段)、存储前缀wps-files/、write_docx返回键wps_file_id、FeatureNotConfiguredException的"wps"标识。验收(AI_ARCHITECTURE.md 门槛全过)
mvn test全绿(JDK 21)npm run check:emits过Sent doc_open_file+ 编辑器随即拉取文件内容editor_command/wps_command双发各 1 次 → 去重后仅执行 1 次 → 新路由/editor-result200 →Completed editor action: success=truedoc_open_file_sync同步打开往返成功,流式产物中验收标记恰好出现一次(若去重失效每个 token 会写两遍)test:lowa-e2e33/33,test:app-e2e29 步全过、0 异常信号实测中发现的存量问题(与本迁移无关,已建独立任务)
<tool_code>文本工具调用的位置参数不映射 →doc_find_replace收到 null 参数 NPE🤖 Generated with Claude Code