Initial: multi-agent XMPP communication system with dashboard

- Platform-based architecture (Windows/Linux/Mac)
- Agent instance registry (agents.yaml)
- Management dashboard with cross-platform monitoring
- xmpp_bot with HTTP bridge + health endpoints
- wechat_agent with WeChat-Hermes bridging
- Platform services: ProcessGuardian, HealthProbe, APIRouter, ChannelBridge
- Deployment: systemd (Linux) + PowerShell (Windows)
- Monitoring: SSH+ejabberdctl for cross-platform presence
This commit is contained in:
hmo
2026-06-12 21:49:05 +08:00
commit 1b2b935832
76 changed files with 15943 additions and 0 deletions
+151
View File
@@ -0,0 +1,151 @@
# AgentsMeeting — 多智能体全沟通架构
> 基于 XMPP 的统一通信系统。按平台(Windows/Linux/Mac)部署,Agent 实例化注册,管理门户统一监控。
### 当前已注册 Agent
| ID | 显示名 | JID | 平台 | 机器 | 职责 |
|----|--------|-----|------|------|------|
| agent-001 | 研发助理 | xxm@yoin.fun | Windows | 192.168.1.16 | 研发主力、微信桥接 |
| agent-002 | 自动化总管 | mohe@yoin.fun | Linux | 192.168.1.246 | 编排监控 |
| agent-003 | 本地推理 | xiaoguo@yoin.fun | Mac | 192.168.1.122 | 本地 LLM 推理 |
| agent-004 | 持仓分析 | zhiwei@yoin.fun | Linux | 192.168.1.246 | 股票监控 |
> **Agent 是实例化的** — 添加新 Agent = 在 `config/agents.yaml` 添加记录 + 在 ejabberd 注册 JID + 部署脚本。不需要改代码。
---
## 快速开始
### 平台操作
```powershell
# Windows — 一键启动所有服务
powershell -File deploy\windows\start.ps1
# Windows — 查看所有组件状态
powershell -File deploy\windows\check.ps1
# Windows — 停止所有服务
powershell -File deploy\windows\stop.ps1
# 管理门户(启动后访问)
http://127.0.0.1:5803
```
```bash
# Linux — 启动 Gateway 和 XMPP Bot
systemctl start hermes@{profile}
systemctl start xmpp-{bot}
```
### 人类客户端
- **Gajim**: Linux/Windows (推荐)
- **Conversations**: Android
- **Monal**: iOS
配置: 服务器 `xmpp.yoin.fun`,端口 `3021`,开启 STARTTLS
---
## 项目结构
```
AgentsMeeting/
├── README.md # 本文件
├── gateway/ # 实际运行的代码(脚本+工具+日志)
│ ├── README.md # gateway 自身说明
│ ├── scripts/ # 运行时脚本
│ │ ├── xmpp_bot.py # XMPP Bot (HTTP桥 :5802)
│ │ ├── wechat_agent.py # 微信桥接代理
│ │ ├── api_proxy.py # API 反向代理 (:8787)
│ │ ├── xmpp_watchdog.py # 进程看门狗
│ │ ├── health_check_xxm.py# 消息流健康检查
│ │ ├── mohe_watcher.py # 莫荷消息监控
│ │ ├── dashboard.py # 管理门户后端
│ │ └── templates/
│ │ └── dashboard.html # 管理门户前端
│ ├── logs/ # 运行时日志
│ └── tools/ # wxhelper DLL 等工具
├── docs/
│ ├── ARCHITECTURE.md # 架构设计文档
│ ├── AUDIT.md # 稳定性审计报告
│ ├── PRD_v0.2.md # 产品需求文档
│ ├── DEPLOY.md # 部署指南
│ └── OPS.md # 运维手册
├── config/
│ ├── .env.example # 环境变量模板
│ └── profiles/ # 各 Agent 配置文件
│ ├── xxm/
│ ├── mohe/
│ ├── xiaoguo/
│ └── zhiwei/
├── src/ # 重构版本(逐步迁移中)
│ ├── shared/ # 共享库
│ │ ├── config.py # 集中配置管理
│ │ └── bot_base.py # Bot 基类
│ ├── bots/ # Bot 实现
│ ├── channels/ # 通道桥接
│ │ ├── wechat/ # 微信桥接
│ │ └── qq/ # QQ 桥接(规划中)
│ └── ops/ # 运维工具
│ ├── watchdog.py
│ └── health_check.py
├── deploy/
│ ├── windows/
│ │ ├── start.ps1 # 一键启动
│ │ ├── stop.ps1 # 一键停止
│ │ └── check.ps1 # 状态检查
│ └── linux/
│ ├── install.sh # 安装脚本(待 mohe)
│ └── hermes-*.service # systemd 模板(待 mohe
└── tests/ # 测试套件
```
---
## 监控
| 组件 | 方式 | 频率 |
|------|------|------|
| 管理门户 | dashboard.py + Web UI (:5803) | 实时轮询 5s |
| xmpp_bot 进程 | watchdog (xmpp_watchdog.py) | 30s |
| xmpp_bot 消息流 | health_check_xxm.py | 5min (scheduled task) |
| wechat_agent | 内置看门狗 | 120s |
| 日志 | `logs/health_check.log` | 人工查看 |
---
## 通信方式
群聊 `coregroup@conference.yoin.fun` 是所有参与者的公共空间。@ 某个 Agent 可单独对话。
| 协议 | 说明 |
|------|------|
| `@Agent名` / 点名 | 被点名的 Agent 必须回复 |
| `__SILENT__` | Agent 标记沉默(不发消息,仅记录上下文) |
| `__REPLY__` | Agent 标记需要回复 |
| `##command:args##` | Agent 命令系统 |
---
## 已知问题
| ID | 问题 | 平台 | 状态 |
|----|------|------|------|
| R01 | MUC join 超时 (conference.yoin.fun DNS) | Linux (ejabberd) | 🔴 |
| R02 | wechat_agent 无系统级自动恢复 | Windows | 🟡 |
| R03 | Gateway 进程无 systemd auto-restart | Linux | 🔴 |
| R04 | 日志无系统级轮转 | Windows + Linux | 🟡 |
| R05 | QQ 通道未实现 | Windows | 🟢 |
---
## 开发流程
1. **架构设计**`docs/ARCHITECTURE.md`
2. **代码工程化**`src/` 按特征优先组织
3. **部署脚本**`deploy/` 一键启停
4. **测试**`tests/` 自动化测试
5. **文档**`docs/` 持续更新