73 lines
2.4 KiB
Markdown
73 lines
2.4 KiB
Markdown
# 4-17 [process] tree 3000 route thin proxy boundary v1
|
|||
|
|
|
||
|
|
> 创建时间:2026-04-27
|
||
|
|
>
|
||
|
|
> 来源:`4-16` Phase N。
|
||
|
|
|
||
|
|
## 1. 结论
|
||
|
|
|
||
|
|
`3000` 继续是唯一浏览器公开入口,但 tree route 不再承载长期树域主语义。
|
||
|
|
|
||
|
|
- Rust runtime 负责 tree command legality、canonical plan、write operation、domain event plan 与稳定 stream delta 语义。
|
||
|
|
- Next route 负责 cookie/auth、Convex client、browser/substrate 能力桥、CommandEnvelope、transport、artifact writer 调用与用户可见回包。
|
||
|
|
- Convex 继续作为 substrate 执行器,不重新生成 tree truth。
|
||
|
|
|
||
|
|
## 2. Thin Proxy Route
|
||
|
|
|
||
|
|
### `/api/tree/commands`
|
||
|
|
|
||
|
|
保留职责:
|
||
|
|
|
||
|
|
- 读取 auth / cookie 并获取 Convex client。
|
||
|
|
- 构造 `CommandEnvelope`。
|
||
|
|
- 调用 `resolveRustBridgeCommandPlan`。
|
||
|
|
- 调用 `executeRustBridgeMutationTransport`。
|
||
|
|
- 调用 `recordRustBridgeCommandArtifacts` / failure artifact writer。
|
||
|
|
- 对浏览器返回 `requestId / traceId / result`。
|
||
|
|
|
||
|
|
不得新增:
|
||
|
|
|
||
|
|
- 树合法性判断。
|
||
|
|
- 排序 canonical plan。
|
||
|
|
- 第二套 tree write truth。
|
||
|
|
- 长期 streamDelta 主语义拼装。
|
||
|
|
|
||
|
|
当前仍保留的 substrate / browser 边界:
|
||
|
|
|
||
|
|
- create / copy 后创建页面 scaffold。
|
||
|
|
- copy 后复制 mindmap 文件。
|
||
|
|
- move 前采集 sidebar snapshot 作为 Rust preflight data。
|
||
|
|
- `tree.node.embed` 的目标内容读取与 `pageReference` block 组装。
|
||
|
|
|
||
|
|
`tree.node.embed` 的 pageReference 组装仍是待迁移 compat,后续应进入 Page Aggregate / Rust artifact,而不是继续扩写在 route 中。
|
||
|
|
|
||
|
|
### `/api/tree/stream`
|
||
|
|
|
||
|
|
保留职责:
|
||
|
|
|
||
|
|
- 作为浏览器 SSE / polling 入口。
|
||
|
|
- 读取 bridge overview。
|
||
|
|
- 优先转发 command log / domain event 中的 Rust `streamDelta`。
|
||
|
|
- 缺少稳定 delta 或 command/event 不一致时保守 `resync`。
|
||
|
|
|
||
|
|
不得新增:
|
||
|
|
|
||
|
|
- 在 Next 层重新解释树排序或 projection truth。
|
||
|
|
- 为复合命令伪造局部树补丁。
|
||
|
|
|
||
|
|
## 3. Debug / Compat Route
|
||
|
|
|
||
|
|
### `/api/tree/shell`
|
||
|
|
|
||
|
|
定位:
|
||
|
|
|
||
|
|
- 仅显式 debug/internal runtime 验证入口。
|
||
|
|
- 3000 主路径不应默认请求 `mnote-web:3104`。
|
||
|
|
- 主路径继续使用 same-origin inline host 与 Rust runtime artifact。
|
||
|
|
|
||
|
|
## 4. 代码锚点
|
||
|
|
|
||
|
|
- `wolai-frontend/src/lib/tree-route-boundary.ts` 固定 3000 route boundary manifest。
|
||
|
|
- `wolai-frontend/src/app/api/tree/commands/route.test.ts` 绑定 tree commands route 的 thin proxy 定位。
|
||
|
|
- `wolai-frontend/src/lib/tree-stream/tree-delta.ts` 明确 `resync_required` 为保守等待 snapshot/resync 的 delta。
|