chore: 保存当前架构收口与 bug 修复快照

归档本轮 P0/P1 bug 修复、设计审查迁移、AI selection scope 收口与 stream contract 调整,并保留当前 05 主线迁移起点。
This commit is contained in:
lix-2026
2026-05-18 17:01:35 +08:00
parent 61ee4a38a2
commit a2cb1338c8
953 changed files with 14383 additions and 211845 deletions
+43 -69
View File
@@ -35,16 +35,16 @@
## 2. 当前主线目录
- `/mnt/Data1T/mnote/wolai-frontend/`
当前 React island 与 legacy compat 代码来源;Next.js App Router 不再作为 3000 主入口,只在显式 legacy/debug 迁移边界继续服务重交互运行态与对照链
- `/mnt/Data1T/mnote/recycle/wolai-frontend/`
已退役移入 recycle。React island 与 legacy compat 代码的历史来源;Next.js App Router 已被 Rust mnote-web SSR 替代,不再作为 3000 主入口。
- `/mnt/Data1T/mnote/rust/crates/core-protocol/`
Kernel 类型、projection 协议、编辑器协议、树 / 图核心术语。
- `/mnt/Data1T/mnote/rust/crates/bridge-runtime/`
Kernel query / command、bridge transport、Tiptap <-> editor document 适配、命令解释层。
- `/mnt/Data1T/mnote/rust/crates/mnote-web/`
Rust Web route、kernel projection、documents/search/mindmap shell、Hermes bridge、stream transport、compat,以及显式开启时的 debug shell;它是当前主 Web gateway / shell / transport owner。
- `/mnt/Data1T/mnote/wolai-frontend/convex/`
仍在使用的 Convex functions 与数据侧逻辑
- `/mnt/Data1T/mnote/recycle/wolai-frontend/convex/`
已随 wolai-frontend 移入 recycle。当前活跃 Convex functions 位于 `infra/convex/` 与 Rust bridge 中
- `/mnt/Data1T/mnote/infra/convex/`
Convex 自托管部署与基础设施。
- `/mnt/Data1T/mnote/wolai-backend/`
@@ -52,97 +52,71 @@
## 3. 当前页面运行结构
### 3.1 根布局与 legacy island source
### 3.1 根布局与 legacy island source(已退役)
- `/mnt/Data1T/mnote/wolai-frontend/src/app/layout.tsx`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/app/layout.tsx`
职责:
- 作为 legacy Next / React island bundle source 的根布局
- 保留 Convex / Query Provider 等前端 island 运行时依赖
- 服务显式 legacy/debug/迁移边界
该文件已随 wolai-frontend 移入 `recycle/`,不再作为当前实现依据。
注意:
> **3000 当前根入口与文档页 shell 由 `mnote-web` 持有;Next App Router 不再是 3000 主入口或页面根布局事实源。**
> **3000 当前根入口与文档页 shell 由 `mnote-web` Rust SSR 持有;Next App Router 已完全退役。**
### 3.2 工作区壳与 Sidebar
### 3.2 工作区壳与 Sidebar(已迁移至 Rust SSR
- `/mnt/Data1T/mnote/wolai-frontend/src/components/app-layout-shell.tsx`
- `/mnt/Data1T/mnote/wolai-frontend/src/hooks/use-sidebar-data.ts`
- `/mnt/Data1T/mnote/wolai-frontend/src/lib/tree-stream/use-sidebar-tree-stream.ts`
- `/mnt/Data1T/mnote/wolai-frontend/src/components/sidebar/use-preferred-sidebar-snapshot.ts`
以下文件已随 wolai-frontend 移入 `recycle/`,不再作为当前实现依据:
当前 Sidebar 不是单一路径,而是三层组合:
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/app-layout-shell.tsx`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/hooks/use-sidebar-data.ts`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/lib/tree-stream/use-sidebar-tree-stream.ts`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/sidebar/use-preferred-sidebar-snapshot.ts`
1. 初始 SSR / route snapshot
2. query / refetch snapshot
3. tree stream live snapshot
`PreferredSidebarSnapshotProvider` 负责在 query 与 tree stream 之间做 freshness 选择,再把同一份 preferred snapshot 同时给:
- `Sidebar`
- `Breadcrumb`
- 文档页头标题消费链
这说明当前工作区树链已经进入正式收口阶段:`3000` 主壳已直接接入 `/api/tree/events` 的 snapshot / delta / resync consumer,并有浏览器 smoke 验证;但 preferred snapshot、page subtree、filetree 与补偿链还没有完全统一成唯一 live cache。
当前 Sidebar/工作区壳的当前实现在 Rust mnote-web SSR
- 工作区壳渲染入口:`gateway.rs``root_entry`
- 文档页壳/文档面板:`web_shell.rs``document_page_shell``build_document_panes_bootstrap_json`
- Sidebar tree stream 消费:`layout.rs` 嵌入 JS`startWithSse` / `startWithWebSocket`
- FileTree 渲染与交互:`tree.rs` 嵌入 JS
## 4. 文档页主链
### 4.1 入口
- `/mnt/Data1T/mnote/wolai-frontend/src/lib/documents/page-aggregate-loader.ts`
- `/mnt/Data1T/mnote/wolai-frontend/src/app/(app)/documents/[id]/page.tsx`
文档页入口的当前实现在 Rust mnote-web
当前文档页读取主链已经不再由页面入口手工拼若干独立字段,而是:
- 文档页壳 SSR`web_shell.rs``document_page_shell`),直接输出 HTML + bootstrap JSON
- Page Aggregate 快照 API`web_shell.rs``page_aggregate`)返回 `/api/page-aggregate/:id`
- 前端桌面/窗口面板布局:`web_shell.rs``build_document_panes_bootstrap_json`
1. 页面 SSR 入口通过 `page-aggregate-loader.ts` 直接请求 Rust `/api/page-aggregate/:id`
2. `DocumentContent` 的内容重试补拉也直接请求同一条 `/api/page-aggregate/:id` 正式读链
3. 读取主链不再回退到 TS builder;snapshot 不可用或不可信时直接显式失败
4. Next `/api/documents/page` 已退场为明确 `410` 的 compat 边界,不再参与文档页运行时主路径
历史 wolai-frontend Next 文档页入口(已移入 `recycle/`):
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/lib/documents/page-aggregate-loader.ts`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/app/(app)/documents/[id]/page.tsx`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/lib/documents/page-aggregate.ts`
对应聚合类型定义:
### 4.2 文档壳(已迁移至 Rust SSR
- `/mnt/Data1T/mnote/wolai-frontend/src/lib/documents/page-aggregate.ts`
历史 React 文档壳组件(已随 wolai-frontend 移入 `recycle/`,不再作为当前实现):
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/document-shell.tsx`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/document-content.tsx`
### 4.2 文档壳
当前文档壳由 Rust mnote-web SSR 输出:
- `web_shell.rs``document_page_shell` 直接渲染 HTML shell,不在前端保留 React 文档壳 runtime。
- `/mnt/Data1T/mnote/wolai-frontend/src/components/editor/document-shell.tsx`
- `/mnt/Data1T/mnote/wolai-frontend/src/components/editor/document-content.tsx`
### 4.3 默认编辑器 host(已迁移至 WASM island
`DocumentShell` 现在只是薄封装,文档页核心状态和交互壳集中在 `DocumentContent`
历史 React 编辑器 host(已移入 `recycle/`):
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/editor-host-config.ts`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/editor-host.tsx`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/leptos-tiptap-island-editor-host.tsx`
### 4.3 默认编辑器 host
- `/mnt/Data1T/mnote/wolai-frontend/src/components/editor/editor-host-config.ts`
- `/mnt/Data1T/mnote/wolai-frontend/src/components/editor/editor-host.tsx`
当前默认 host 为:
- `leptos_tiptap_island`
文档页主路径已不再暴露显式 debug host 选择;历史 `iframe_debug` 宿主仅剩源码参考,不再参与页面 host 选择面。
### 4.4 正式主编辑器
- `/mnt/Data1T/mnote/wolai-frontend/src/components/editor/leptos-tiptap-island-editor-host.tsx`
当前默认主编辑器已经是页面内 Leptos island,不再是 iframe bridge。
它负责:
- 加载 Leptos/WASM 编辑器本体
- 接收初始化内容与 page options
- 处理同页事件、命令、保存与状态同步
当前默认编辑器是页面内 Leptos/WASM island,由 Rust mnote-web SSR 加载:
- WASM 产物:`rust/spikes/leptos-tiptap-spike/`
- 加载路由:`web_shell.rs``leptos_tiptap_manifest` / `leptos_tiptap_asset`
### 4.5 BlockNote 的当前位置
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/components/editor/blocknote-editor.tsx`
`BlockNote` 当前仍保留回收副本,但其定位已变成:
- 历史参考实现
- 对照材料 / 调试素材
`BlockNote` 已随 wolai-frontend 移入 recycle,仅作为历史对照材料,不参与当前实现。
而不是默认主编辑器方向。
@@ -197,7 +171,7 @@
### 6.2 树命令现状
- `/mnt/Data1T/mnote/wolai-frontend/src/lib/documents/tree-command-client.ts`
- `/mnt/Data1T/mnote/recycle/wolai-frontend/src/lib/documents/tree-command-client.ts`
- `/mnt/Data1T/mnote/rust/crates/mnote-web/src/routes/tree.rs`
- `/mnt/Data1T/mnote/rust/crates/storage-convex-bridge/src/mapping.rs`