docs: render UML diagrams and embed portable previews
Verify Tessera GUI / verify (push) Failing after 1m30s

This commit is contained in:
2026-10-25 22:09:47 +08:00
parent 18376793b0
commit 21439d4c4d
36 changed files with 278 additions and 252 deletions
+64 -12
View File
@@ -1,15 +1,67 @@
# 可编辑 UML 源文件
# UML 图册
| 文件 | UML 类型与内容 | 对应说明 |
| --- | --- | --- |
| [components.puml](components.puml) | 组件图:主要调用与数据流;不冒充完整 import 图 | [01](../01-modules.md) |
| [deployment.puml](deployment.puml) | 部署图:线程、共享状态、原生窗口与 curl 子进程 | [01](../01-modules.md) |
| [domain.puml](domain.puml) | 类图:托管对象、弱边、Mount、不可变快照 | [02](../02-object-model.md) |
| [publication.puml](publication.puml) | 时序图:完整 PUT 的候选执行与代际发布 | [03](../03-runtime.md) |
| [input.puml](input.puml) | 时序图:原生输入回到活跃 VM 与刷新 | [04](../04-rendering.md) |
| [tasks.puml](tasks.puml) | 状态图:Task 完成、失败与取消 | [03](../03-runtime.md) |
| [windows.puml](windows.puml) | 状态图:Page 打开、关闭、重开与回收 | [05](../05-workspace.md) |
下面直接显示已渲染的 PNG,不需要安装 Markdown 插件。打开 SVG 可以放大阅读;`.puml` 保留可编辑源码。画布为不透明白底,避免深色查看器把黑色文字和连线淹没。
这些 `.puml` 是可编辑的标准 UML 源码;Markdown 中另有 Mermaid 阅读版本。它们均为人工维护,当前没有自动同步生成步骤。概念图已标注其简化范围。
## 组件与主要数据流
本轮没有安装 PlantUML/Graphviz 或调用在线渲染服务,因此未验证具体渲染器的版面输出。已有本地 PlantUML 环境时,可从项目根目录执行 `plantuml docs/architecture/uml/*.puml` 导出 SVG/PNG;不要为查看架构而上传整个仓库或私有对象数据。
![组件与主要数据流](rendered/components.png)
[放大 SVG](rendered/components.svg) · [编辑源码](components.puml)
## 进程与线程部署
![进程与线程部署](rendered/deployment.png)
[放大 SVG](rendered/deployment.svg) · [编辑源码](deployment.puml)
## 对象模型与引用关系
![对象模型与引用关系](rendered/domain.png)
[放大 SVG](rendered/domain.svg) · [编辑源码](domain.puml)
## 完整程序执行与发布时序
![完整程序执行与发布时序](rendered/publication.png)
[放大 SVG](rendered/publication.svg) · [编辑源码](publication.puml)
## 候选与活跃运行时状态
![候选与活跃运行时状态](rendered/runtime.png)
[放大 SVG](rendered/runtime.svg) · [编辑源码](runtime.puml)
## 原生输入与事件分发时序
![原生输入与事件分发时序](rendered/input.png)
[放大 SVG](rendered/input.svg) · [编辑源码](input.puml)
## 异步任务状态
![异步任务状态](rendered/tasks.png)
[放大 SVG](rendered/tasks.svg) · [编辑源码](tasks.puml)
## 页面展示与可达性状态
![页面展示与可达性状态](rendered/windows.png)
[放大 SVG](rendered/windows.svg) · [编辑源码](windows.puml)
## 重新生成
从项目根目录运行下面的文档工具。依赖只安装到临时目录,固定版本;不写入 Cargo、应用依赖或全局环境。渲染时不上传图的源码。
```sh
export UML_RENDER_TOOLS="$(mktemp -d /private/tmp/tessera-uml.XXXXXX)"
npm install --prefix "$UML_RENDER_TOOLS" --ignore-scripts --no-audit --no-fund \
@plantuml/core@1.2026.9 @viz-js/viz@3.17.0 \
@napi-rs/canvas@0.1.80 @xmldom/xmldom@0.9.12 sharp@0.34.5
node scripts/render-uml.mjs
```
使用官方 `@plantuml/core` JavaScript 引擎、Viz 布局、XML DOM 和本机 Canvas 字体测量,不需要 Java 或原生 Graphviz。PNG 由同一份 SVG 导出。脚本对渲染错误图做检查,失败则停止;修改源码后应重新生成并查看图片。
字体取自本机,跨机器重建可能有微小的排版差异。源图中的概念状态与省略字段范围以各篇架构说明为准;渲染不会把概念图变成自动提取的完整代码模型。
+14 -19
View File
@@ -1,24 +1,19 @@
@startuml
left to right direction
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
top to bottom direction
title Tessera — implemented components (principal runtime flows)
component "shell
windows / tabs / developer tools" as Shell
component "runtime/api
HTTP + queue" as API
component "runtime/api/worker
serial VM ownership" as Worker
component "bridge/ui_bridge
types / native calls / refresh" as Bridge
component "model
objects / mounts / bindings" as Model
component "render
layout / paint / hit / raster" as Render
component "Aster
frontend / compiler / core" as Aster
component "runtime/io_tasks
plain-data completion" as IO
database "NamespaceState
owned document + frame values" as State
component "shell\nwindows / tabs / developer tools" as Shell
component "runtime/api\nHTTP + queue" as API
component "runtime/api/worker\nserial VM ownership" as Worker
component "bridge/ui_bridge\ntypes / native calls / refresh" as Bridge
component "model\nobjects / mounts / bindings" as Model
component "render\nlayout / paint / hit / raster" as Render
component "Aster\nfrontend / compiler / core" as Aster
component "runtime/io_tasks\nplain-data completion" as IO
database "NamespaceState\nowned document + frame values" as State
Shell --> API : serialized input / Console
API --> Worker : bounded BuildRequest queue
Worker --> Aster : compile / execute
+8 -11
View File
@@ -1,18 +1,18 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Tessera — local process and thread deployment
node "User computer" {
artifact "Local agent client" as Agent
node "Tessera desktop process" {
node "GUI main thread
winit + softbuffer" as GUI
node "tessera-agent-api
HTTP receiver" as API
node "tessera-endor-worker
ReplSession / Candidate / Aster heap" as Worker
node "GUI main thread\nwinit + softbuffer" as GUI
node "tessera-agent-api\nHTTP receiver" as API
node "tessera-endor-worker\nReplSession / Candidate / Aster heap" as Worker
node "Input sender thread" as Input
node "Lazy bounded I/O pool" as IO
database "Arc<RwLock<NamespaceState>>
no VM handles in published frames" as State
database "Arc<RwLock<NamespaceState>>\nno VM handles in published frames" as State
API --> Worker : bounded queue (8 pending)
Worker --> State : commit document
State --> GUI : native snapshots
@@ -26,7 +26,4 @@ no VM handles in published frames" as State
GUI --> Window
IO --> Curl : fetchText transport
}
note bottom of Worker
Aster libraries are linked into Tessera.
No Lyra/Hestia process is required.
@enduml
+7 -3
View File
@@ -1,4 +1,8 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Tessera — managed identity versus published values
hide empty methods
class ReplSession {
@@ -44,18 +48,18 @@ class Mount {
class MountTable {
active: Map<u64, WeakObjectRef>
}
class UiNode <<immutable native value>> {
class UiNode {
block_id: String
slots: u64[]
kind: UiKind
}
class Frame <<published native value>> {
class Frame {
session: u64
layout_version: u64
commands: RenderCommand[]
tabs: Tab[]
}
class RenderDocument <<published native value>> {
class RenderDocument {
source: String
ui_root: Arc<UiNode>
windows: Map
+4
View File
@@ -1,4 +1,8 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Native input — one VM and one event dispatcher
actor User
participant TesseraApp as GUI
+4
View File
@@ -1,4 +1,8 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Complete PUT — isolated execution and epoch-checked publication
actor Client
participant "api.rs" as API
Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.4 KiB

+20
View File
@@ -0,0 +1,20 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Candidate and active runtime (conceptual states)
[*] --> Candidate : accepted complete PUT
Candidate --> Refreshing : compilation / execution succeeds
Candidate --> Rejected : compilation / execution error
Refreshing --> Refreshing : yield / continue refresh
Refreshing --> Active : valid document + matching submission
Refreshing --> Superseded : newer write / delete
Active --> Active : Console / input / task completion
Active --> Faulted : callback or refresh fault
Active --> Retired : replace / reset / delete / shutdown
Faulted --> Retired : cleanup or replace
Rejected --> [*]
Superseded --> [*]
Retired --> [*]
@enduml
+4
View File
@@ -1,4 +1,8 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Managed Task — lifecycle states from tasks.rs
[*] --> Pending
Pending --> Running : due / delivery eligible
+4
View File
@@ -1,4 +1,8 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Page visibility and reachability (conceptual states)
[*] --> Open : Page registered
Open --> Selected : activate / click tab