feat: EditorRuntimeActor - 三层缓存/delta/事件架构

Phase A — EditorRuntimeActor 内存缓存层
- 新增 editor_actor.rs: EditorBlockDocument 内存态 + apply_command + load_or_init
- block.rs 四个写工具(replace/insert/delete/move)接入 actor 路径
- editor_actor feature flag(MNOTE_WEB_ENABLE_EDITOR_ACTOR=true 默认开启)
- bridge-runtime 三个核心函数公开化
- rust-toolchain: 1.89 → stable(修复 spike WASM 编译阻塞)

Phase B — 编辑器增量 delta channel
- BlockDelta/DeltaOperation 类型 + actor.build_block_delta()
- leptos-tiptap spike: mnote:editor:block-delta CustomEvent 监听 + JSON patch
- DocumentAiAgentPanel: 拦截 blockDelta → window dispatchEvent
- 工具响应含 blockDelta 字段供前端消费

Phase C — 事件 stream delta
- broadcast channel 在 AppState/actor/SSE 三层贯通
- tree_events SSE 端点发 block.delta 事件
- 旧客户端降级兼容

环境修复
- rustc recursion_limit = 1024(修复 Leptos SSR 类型深度溢出)
- run-convex-deploy.js(封装 Convex function 部署到本地后端 3210)

ref: design/07-ai/process/7-13-page-block-editor-runtime-actor-v1.md
This commit is contained in:
lix-2026
2026-05-16 22:03:30 +08:00
parent d8bfaea306
commit f292c6710a
101 changed files with 13618 additions and 2416 deletions
@@ -3,7 +3,7 @@
> 更新时间:2026-05-13
>
> 2026-05-15 口径更新:
> - 本文件完成时的 `index.md` 可见 UI 模型已被 `/mnt/Data1T/mnote/design/04-tree-domain/process/4-35-convex-filetree-title-md-source-alignment-v1.md` 覆盖。
> - 本文件完成时的 `index.md` 可见 UI 模型已被 `/mnt/Data1T/mnote/design/04-tree-domain/done/4-35-convex-filetree-title-md-source-alignment-v1.md` 覆盖。
> - 后续 Convex File Tree 默认页面正文行显示为 `{title}.md`rowId 为 `doc:<documentId>`;本文中的 `index.md` 仅表示历史正文 object identity / 兼容语义,不再作为默认可见子行继续扩展。
>
> 上游依据:
@@ -1,4 +1,4 @@
# 4-35 [process] Convex File Tree 标题即 Markdown 文件名体系切换 v1
# 4-35 [done] Convex File Tree 标题即 Markdown 文件名体系切换 v1
> 更新时间:2026-05-15
>
@@ -187,7 +187,9 @@ mindmap / attachment 等资源仍挂在页面正文对象下,但 parent row
## 9. 当前状态
当前状态:`process`
当前状态:`done`
本文已从 `process/` 迁入 `done/`。Convex File Tree 默认可见页面正文行当前以 `doc:<documentId>` + `{title}.md` 为准;旧设计稿中的可见 `index.md` 仅作为历史 object identity / 兼容语义理解,不再作为默认 UI 模型继续派生新任务。
2026-05-15 已完成 P0/P1/P2 的最小切片:
@@ -1,6 +1,6 @@
# 4-6 [done] Tree Command Protocol Cutover Stage 2 v1
> 更新时间:2026-04-18
> 更新时间:2026-05-16
>
> 目的:冻结树域 command protocol 的长期命名面,并明确 `documents.*` 到 `tree.*` 的兼容迁移口径。
@@ -100,3 +100,29 @@
- Rust / 前端都接受 `tree.*`
- 主调用路径默认走 `tree.*`
- `documents.create` 等兼容命名不再是新增主语义入口
## 8. 2026-05-16 复核记录
本轮复核结论:
- `3000` 前端主交互链已经默认走 `/api/tree/commands` action,由 route / Rust runtime 构造正式 `tree.*` command envelope。
- `documents.*` 仍作为兼容 alias 和 Convex legacy mutation 函数名存在,但不再作为页面生命周期主链新增语义入口。
- `bridge-runtime` 已给 `documents.create/title.update/move/delete/restore/purge/copy_tree` 兼容 alias 的 execution plan 增加 `commandProtocol` 元数据:
- `owner=rust-runtime-kernel`
- `preferredCommandName=tree.*`
- `compatCommandName=documents.*`
- `deprecatedAlias=true/false`
- `mnote-web` transport 在调用 Convex legacy mutation 前剥离 `commandProtocol`,该字段只作为 Rust plan / artifact 审计边界,不进入旧 validator。
已验证命令:
```bash
cargo test --manifest-path rust/Cargo.toml -p bridge-runtime tree_ -- --nocapture
cargo test --manifest-path rust/Cargo.toml -p mnote-web tree_command -- --nocapture
cargo test --manifest-path rust/Cargo.toml -p mnote-web convex_command_args_strips_tree_archive_artifacts_for_legacy_mutation -- --nocapture
```
后续仍需单独收口:
- `/api/documents/create-child` 仍是 compat-only 子页面创建入口,后续应迁到 `/api/tree/commands` 或明确退役。
- `mnote-cli` 中页面生命周期命令仍构造旧 `documents.*`,后续若 CLI 继续保留为正式入口,应迁到 `tree.*`