Refactor OneBot networks and event dispatch
Unify per-adapter network configuration into a single `networks` structure and add migration/normalization for legacy on-disk formats. Introduce per-adapter options (messageFormat, reportSelfMessage, enabled, name) and stronger typing in types.ts. Add event-filter utilities to prebuild two serialized payload variants and pick the right one per adapter to avoid repeated JSON.stringify calls. Update HTTP/WS transports to use adapter names/signatures for hot-reload, respect per-adapter options, and improve logging; WS transport also improves client/server lifecycle/reconnect handling. Mark self-sent messages as `message_sent` in the event converter and wire instance dispatch to use the new DispatchPayload. Misc: README edits and accompanying tests added/updated for the refactor.
This commit is contained in:
1 parent
19a564991c
commit
2a4ca46a99
14 files changed
+1732
-758
No files matched your search
@@ -5,58 +5,14 @@
|
||||
## 关于项目
|
||||
项目处于开发初期,仅支持部分功能,持续高速迭代中,仅支持有头。
|
||||
|
||||
## 仓库结构
|
||||
## 测试要求
|
||||
1. 外部库能正常加载
|
||||
|
||||
本仓库使用 **pnpm workspace** 进行多包管理。
|
||||
2. 外部库能正常卸载
|
||||
|
||||
```
|
||||
SnowLuma/
|
||||
├─ packages/
|
||||
│ ├─ core/ @snowluma/core - Node.js 运行时(NTQQ packet sniffer + Hook + OneBot)
|
||||
│ ├─ webui/ webui - React + Vite 前端
|
||||
│ └─ runtime/ @snowluma/runtime - 发行包资源
|
||||
│ ├─ launcher.bat
|
||||
│ ├─ package.json (随 dist 一起发布的运行时依赖清单)
|
||||
│ └─ native/ 平台预编译产物 (snowluma-win32-x64.{dll,node})
|
||||
├─ tools/ 辅助脚本(如 Python OneBot WS 测试)
|
||||
├─ tsconfig.base.json
|
||||
├─ tsconfig.json monorepo 根 TS 项目(仅含 references)
|
||||
├─ pnpm-workspace.yaml
|
||||
└─ package.json monorepo 根(脚本委托给 pnpm filter)
|
||||
```
|
||||
3. 卸载时Pipe以及副作用被清除
|
||||
|
||||
构建产物统一输出到仓库根 `dist/`,与发行流水线保持兼容。
|
||||
|
||||
## 常用命令
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
pnpm install
|
||||
|
||||
# 开发 — 核心运行时(tsx)
|
||||
pnpm dev
|
||||
|
||||
# 开发 — WebUI 前端(vite dev server)
|
||||
pnpm dev:web
|
||||
|
||||
# 仅构建核心
|
||||
pnpm build
|
||||
|
||||
# 仅构建 WebUI
|
||||
pnpm build:webui
|
||||
|
||||
# 一次构建核心 + WebUI 完整发行版(顺序固定 core → webui)
|
||||
pnpm build:all
|
||||
|
||||
# 单元测试 / 类型检查 / Lint
|
||||
pnpm test
|
||||
pnpm typecheck
|
||||
pnpm lint
|
||||
|
||||
# 直接对单个包操作
|
||||
pnpm --filter @snowluma/core dev
|
||||
pnpm --filter webui build
|
||||
```
|
||||
4. 当Snowluma重启时可恢复所有Pipe管道
|
||||
|
||||
## 鸣谢
|
||||
[LagrangeV2](https://github.com/LagrangeDev/LagrangeV2) - Proto
|
||||
@@ -72,4 +28,4 @@ pnpm --filter webui build
|
||||
## 加入我们
|
||||
[SnowLuma-QQ](https://qm.qq.com/q/g3UMLpWALe)
|
||||
|
||||
[SnowLuma-Tg](https://t.me/napcatqq)
|
||||
[SnowLuma-TG](https://t.me/napcatqq)
|
||||
Reference in new issue
Block a user