推进资源工具与本地优先兼容链收口

This commit is contained in:
lix-2026
2026-05-19 12:03:43 +08:00
parent 94be1c927b
commit 6fcdf78603
13 changed files with 1192 additions and 30 deletions
@@ -297,7 +297,9 @@
- 证据:`/mindmap/{documentId}/{mindmapId}` 对象壳输出 `resource:mindmap:{documentId}:{mindmapId}``mindmap_shell_returns_rust_object_shell_contract`;保存仍通过 `mindmaps.put` / `mindmap.command.apply` 兼容链。
- [x] 盘点 office 当前 object identity、保存路径、打开路径。
- 证据:新增 `/office/{documentId}/{assetId}` 对象壳输出 `resource:onlyoffice:{documentId}:{assetId}`,内部复用 `/onlyoffice` bootstrap`cargo test -p mnote-web onlyoffice_object_shell_exposes_resource_identity -- --nocapture``cargo test -p mnote-web sidebar_tree_runtime_opens_office_assets_through_resource_shell -- --nocapture`
- [ ] 统一资源创建、重命名、移动、删除、恢复命令到 `tree.resource.*`
- [x] 统一资源创建、重命名、移动、删除、恢复命令到 `tree.resource.*`
- 实现:上传/创建走 `tree.resource.upload` 或资源对象专用创建事件;附件 rename / move / archive / restore / purge 已输出 `tree.resource.rename/move/archive/restore/purge`mindmap/table 生命周期输出 `tree.resource.*`
- 验证:`cargo test -p mnote-web resource_ -- --nocapture`;新增 `resource_move_uses_resource_command_not_document_command`
- [x] filetree 显示资源行,pagetree 只显示页面导航投影。
- 验证:`cargo test -p mnote-web file_tree_projection_ -- --nocapture``cargo test -p bridge-runtime file_tree_projection -- --nocapture`
- [x] Markdown 中插入资源引用时,只写相对链接或嵌入引用。
@@ -309,8 +311,9 @@
- 设计:`design/07-ai/process/7-28-resource-ai-tool-contract-v1.md`
- [x] 设计 `mnote.office.*` 工具:读取文本摘要、写入建议、导出变更摘要;真实编辑优先复用 officecli / OnlyOffice 保存链。
- 设计:`design/07-ai/process/7-28-resource-ai-tool-contract-v1.md`
- [ ] AI 资源工具必须走授权 root 和 resource capability。
- 设计已冻结:`design/07-ai/process/7-28-resource-ai-tool-contract-v1.md`;代码执行仍待接入 `mnote.mindmap.*` / `mnote.office.*` 工具面
- [x] AI 资源工具必须走授权 root 和 resource capability。
- 实现:Hermes manifest 已暴露 `mnote.mindmap.fetch` / `mnote.mindmap.apply_ops` / `mnote.office.fetch_summary` / `mnote.office.propose_changes`;执行侧统一校验 `rootUri` 本地授权与 `allowedResourceIds` / object identity
- 验证:`cargo test -p mnote-web hermes_tools_resource -- --nocapture``cargo test -p mnote-web hermes_tools_mindmap -- --nocapture``cargo test -p mnote-web hermes_tools_office -- --nocapture``cargo test -p mnote-web hermes_tools_manifest_returns_first_batch_tools -- --nocapture`
- [x] agent changed files 审计包含 mindmap / office 资源文件。
- 验证:`cargo test -p mnote-web local_agent_audit_snapshot_detects -- --nocapture`;覆盖 `.mindmap.json` 和同大小二进制 `.docx` 内容变更。
@@ -321,6 +324,7 @@
- [x] 单测:mindmap resource 删除 / 恢复不破坏 markdown 页面。
- 验证:`cargo test -p mnote-web mindmap_delete_restore_keeps_markdown_reference_out_of_lifecycle_command -- --nocapture`;生命周期命令只返回 `tree.resource.archive/restore``resourceKind=mindmap`,不携带正文 `documentId` 写入语义。
- [ ] browser smoke:从 markdown 打开 mindmap / office,修改保存后 filetree 和引用状态同步。
- 脚本:`scripts/task456-resource-object-shell-sync-smoke.js` 已补,待 `3000` 主入口运行后执行。
---
@@ -371,9 +375,12 @@
### 8.1 Page Aggregate 单一真源
- [ ] 盘点 `documents.content` 仍作为正文兼容源的入口。
- [x] 盘点 `documents.content` 仍作为正文兼容源的入口。
- 证据:`routes/web_shell.rs` 非 local 分支仍以 `load_document_meta_result + load_document_content_result``meta + content``page.aggregate.get``routes/documents.rs` 仍保留 `documents.content.get` compat`bridge-runtime` 仍将 `CompatMetaContentJoin` / legacy `documents.content` 投影为 `blockDocument`
- [ ] 让本地 `.md` 与 EditorBlockDocument projection 的读写边界写入 5-5 / 5-6。
- [ ] 标题、正文、页面设置写入后只通过 page aggregate 刷新 UI。
- 阶段进展:文档壳初始化、外部刷新和冲突比较已优先消费 `body.blockDocument` / `editorDocument`,再 fallback 到 legacy `body.content`
- 验证:`cargo test -p mnote-web document_shell_returns_page_aggregate_snapshot -- --nocapture``cargo test -p mnote-web page_aggregate -- --nocapture`
- [ ] 删除或降级前端手工拼 `meta + content` 的 runtime fallback。
- [ ] AI 页面设置写入走统一 page aggregate / page command 入口。
@@ -384,7 +391,8 @@
### 8.2 Tree command cutover
- [ ] 盘点仍在 runtime route / adapter / bridge / CLI 中使用的 `documents.*` 命令。
- [x] 盘点仍在 runtime route / adapter / bridge / CLI 中使用的 `documents.*` 命令。
- 证据:`routes/mod.rs` 仍注册 `/api/documents/*` compat`transport/convex.rs` 仍做 `documents.*` 到 legacy Convex validator 的适配;`bridge-runtime` 仍有 `documents.stats.update``documents.duplicate``documents.template``documents.emptyTrashByWorkspace` 等历史命名。
- [ ] 新增命令统一命名为 `tree.*``tree.resource.*`
- [ ] 对历史 `documents.*` 命令只保留 compat adapter,不再扩展新语义。
- [ ] 资源 rename、移动、删除、恢复补齐 `tree.resource.*`
@@ -396,9 +404,13 @@
### 8.3 Tree realtime live cache
- [ ] 盘点 Sidebar、page subtree、filetree、preferred snapshot 的数据来源。
- [x] 盘点 Sidebar、page subtree、filetree、preferred snapshot 的数据来源。
- 证据:Sidebar/filetree 已消费 Rust projection 与 live tree eventslocal folder 仍有 `/api/tree/local-folder-watch` + HTML refetch 补偿链;WS 主链已启用 `/api/realtime/ws`SSE 为 close 后 fallback。
- [ ] 统一 snapshot / delta / resync consumer 到同一 live cache。
- [ ] SSE fallback 只作为 WS 不可用时的降级,不作为并行主链
- 阶段进展:WS `delta` 不再无条件 `resync`,仅 `resync_required` / `requiresResync` 时请求服务端 resync,普通 delta 先交给本地 live consumer
- 验证:`cargo test -p mnote-web tree_live_controller_marks_transport_and_closes_source_on_pagehide -- --nocapture`
- [x] SSE fallback 只作为 WS 不可用时的降级,不作为并行主链。
- 证据:`TREE_LIVE_CONTROLLER_JS``transport=convex-command-log-ws` 时优先 `startWithWebSocket``onclose` 后才 `startWithSseFallback``cargo test -p mnote-web tree_live_controller_marks_transport_and_closes_source_on_pagehide -- --nocapture`
- [ ] 双浏览器文件树操作无刷新同步。
- [ ] 删除不必要的 polling / refetch 补偿链。
@@ -438,6 +450,7 @@
- [x] P4 分享与同步闭环完成 read / write / ai capability 最小闭环。
- 证据:`cargo test -p mnote-web share_grant -- --nocapture``cargo test -p mnote-web hermes_client_local_shared -- --nocapture``cargo test -p mnote-web shared_cache -- --nocapture``node scripts/task454-shared-read-page-ai-browser-smoke.js`
- [ ] P5 simplemindmap / office 资源模型完成 Resource Tree 产品化。
- 阶段进展:资源命令面、资源对象壳、AI resource tools 与 changed-files 审计已闭环;剩余真实 browser smoke 待跑。
- [x] P6 Convex 导出到本地 workspace 有 dry run、备份、冲突报告和回滚。
- 证据:`node scripts/task444-convex-workspace-export-local-fixture-smoke.js``node scripts/task455-convex-export-plan-rollback-smoke.js`Web 入口设计见 `design/03-rust-web/process/3-17-convex-export-web-entry-v1.md`
- [ ] P7 Page Aggregate / tree command / realtime 兼容链完成阶段性瘦身,并把被替代 process 稿移入 `old/``done/`