Files
ShowenV2/README.md
showen 7135f28545 feat: 实现动态插件系统 (6阶段完成)
- 阶段1: 消息类型序列化 (Serialize/Deserialize, &'static str → String)
- 阶段2: FFI 边界类型 + Plugin SDK (plugin_abi, showen-plugin-sdk crate)
- 阶段3: PluginLoader + DynamicPlugin (libloading 动态加载 .so)
- 阶段4: 版本管理 + 错误策略 (VersionManager, PluginState, 自动回退)
- 阶段5: 远程仓库客户端 (HTTP 下载 + tar.gz 安装)
- 阶段6: 示例插件 + HTTP 管理 API + 全目录 README 文档

54/54 测试通过,0 warnings。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 03:38:08 +08:00

74 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ShowenV2 — 数字生命窗口平台
基于 Rust 的跨平台插件微内核架构,支持全息/VR/AR/屏幕显示承载虚拟宠物、数字人、AI 歌姬、3D 模型等数字生命内容。
## 架构概览
```
ShowenV2/
├── src/
│ ├── core/ # 插件微内核
│ │ ├── message.rs # 类型安全消息协议 (Serialize/Deserialize)
│ │ ├── plugin.rs # Plugin trait 定义
│ │ ├── service_manager.rs # 生命周期管理 + 消息路由 + 错误策略
│ │ ├── config.rs # 配置解析/验证
│ │ ├── dispatch.rs # 文本命令解析
│ │ ├── plugin_abi.rs # C FFI 类型 (动态插件边界)
│ │ ├── dynamic_plugin.rs # DynamicPlugin (libloading)
│ │ ├── plugin_loader.rs # plugin_store/ 扫描/加载
│ │ ├── version_manager.rs # 版本切换/回退/GC
│ │ └── plugin_repo.rs # 远程仓库 HTTP 客户端
│ └── plugins/ # 功能插件
│ ├── video/ # 视频播放引擎 (OpenCV)
│ ├── http/ # Web UI + REST API (warp)
│ ├── ble/ # BLE 配网 (D-Bus BlueZ)
│ ├── wifi/ # WiFi 管理 (nmcli)
│ └── screen/ # 屏幕管理 (防息屏/光标)
├── plugin-sdk/ # 动态插件开发 SDK
├── plugins/
│ └── example-plugin/ # 示例动态插件 (cdylib)
├── configs/ # 配置文件 (状态机 JSON)
├── clients/ # 外部控制客户端应用
└── souls/ # 团队成员档案
```
## 技术栈
- **语言**: Rust (edition 2018)
- **视频**: OpenCV 0.66
- **HTTP**: warp + tokio
- **BLE**: D-Bus + BlueZ (GATT)
- **WiFi**: nmcli
- **插件加载**: libloading
- **远程仓库**: ureq + flate2 + tar
## 动态插件系统
ShowenV2 支持两种插件模式:
1. **静态插件** — 编译时链接5 个内置插件 (video, http, ble, wifi, screen)
2. **动态插件** — 运行时加载 `.so` 文件,通过 `extern "C"` FFI + JSON 序列化通信
动态插件特性:
- 多版本管理 (`plugin_store/` 目录结构)
- 远程仓库下载安装 (HTTP + tar.gz)
- 错误自动回退 (AutoRollback / DisableAndLog)
- REST API 管理 (`/api/plugins/*`)
## 快速开始
```bash
# 验证配置
cargo run -- --validate --config configs/dog_state_machine.json
# 运行
cargo run -- --config configs/dog_state_machine.json
# 测试
cargo test --workspace
```
## 目标硬件
ARM aarch64 嵌入式 Linux, 屏幕 1280×800