refactor(xxm): consolidate 4 bot implementations into unified xmpp_agent_core.py
- Merge bot_base.py, gateway/scripts/xmpp_bot.py, bots/*, xmpp_bot_rest.py into single xmpp_agent_core.py with --agent flag (xxm|mohe|zhiwei|xiaoguo) - Add xxm_bot.py wrapper (encoding=utf-8 for Windows exec) - Fix slixmpp connect() API: use host=/port= keyword args (was tuple) - Clean up orphans: bots/, scripts/, hermes_state.py, xmpp_bot.py, xmpp_bot_rest.py - Add docs/CLEANUP_PLAN.md documenting the migration - Update README.md project structure - Also: fix WeChat agent path resolution (relative paths)
This commit is contained in:
@@ -55,17 +55,27 @@ systemctl start xmpp-{bot}
|
||||
|
||||
```
|
||||
AgentsMeeting/
|
||||
├── README.md # 本文件
|
||||
├── gateway/ # 实际运行的代码(脚本+工具+日志)
|
||||
├── xmpp_agent_core.py # 统一 Bot 核心(所有 Agent 共享)
|
||||
│ 用法: python xmpp_agent_core.py --agent xxm|mohe|zhiwei|xiaoguo
|
||||
│ 功能: PID锁/重连/MUC/dedup/batching/coordinator协议/HTTP桥
|
||||
├── xxm_bot.py # 兼容入口 → xmpp_agent_core.py --agent xxm
|
||||
├── mohe_bot.py # 兼容入口 → xmpp_agent_core.py --agent mohe
|
||||
├── zhiwei_bot.py # 兼容入口 → xmpp_agent_core.py --agent zhiwei
|
||||
├── xiaoguo_bot.py # 兼容入口 → xmpp_agent_core.py --agent xiaoguo
|
||||
├── gateway/ # 运行时组件(脚本+工具+日志)
|
||||
│ ├── README.md # gateway 自身说明
|
||||
│ ├── scripts/ # 运行时脚本
|
||||
│ │ ├── xmpp_bot.py # XMPP Bot (HTTP桥 :5802)
|
||||
│ │ ├── chat_bridge.py # xxm LLM 桥接(SessionBridge)
|
||||
│ │ ├── session_router.py # 消息路由
|
||||
│ │ ├── wechat_agent.py # 微信桥接代理
|
||||
│ │ ├── api_proxy.py # API 反向代理 (:8787)
|
||||
│ │ ├── xmpp_watchdog.py # 进程看门狗
|
||||
│ │ ├── health_check_xxm.py# 消息流健康检查
|
||||
│ │ ├── mohe_watcher.py # 莫荷消息监控
|
||||
│ │ ├── dashboard.py # 管理门户后端
|
||||
│ │ ├── proc_guard.py # PID 锁(防重复启动)
|
||||
│ │ ├── qq_bot.py # QQ bot 桥接
|
||||
│ │ ├── vc_webhook.py # VoceChat webhook
|
||||
│ │ └── templates/
|
||||
│ │ └── dashboard.html # 管理门户前端
|
||||
│ ├── logs/ # 运行时日志
|
||||
@@ -73,37 +83,37 @@ AgentsMeeting/
|
||||
├── docs/
|
||||
│ ├── ARCHITECTURE.md # 架构设计文档
|
||||
│ ├── AUDIT.md # 稳定性审计报告
|
||||
│ ├── CLEANUP_PLAN.md # 代码清理方案
|
||||
│ ├── OBSERVER-PROTOCOL.md # 群聊观察者模式协议
|
||||
│ ├── SESSION-BRIDGE-PROTOCOL.md # 跨Session消息桥接协议
|
||||
│ ├── 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
|
||||
│ ├── agents.yaml # Agent 实例注册
|
||||
│ └── .env.example # 环境变量模板
|
||||
├── configs/ # 各 Agent 配置/SOUL
|
||||
│ ├── main/
|
||||
│ ├── mohe/
|
||||
│ ├── xiaoguo/
|
||||
│ └── position-analyst/
|
||||
├── src/
|
||||
│ ├── shared/
|
||||
│ │ ├── config.py # 集中配置管理(env-var 方式)
|
||||
│ │ └── bot_base.py # Bot 基类(功能已合并进 xmpp_agent_core.py)
|
||||
│ ├── channels/
|
||||
│ │ └── qq/
|
||||
│ │ └── bridge.py # QQ 通道骨架
|
||||
│ └── ops/
|
||||
│ └── watch_group.py # 群聊监控
|
||||
├── deploy/
|
||||
│ ├── windows/
|
||||
│ │ ├── start.ps1 # 一键启动
|
||||
│ │ ├── stop.ps1 # 一键停止
|
||||
│ │ └── check.ps1 # 状态检查
|
||||
│ └── linux/
|
||||
│ ├── install.sh # 安装脚本(待 mohe)
|
||||
│ └── hermes-*.service # systemd 模板(待 mohe)
|
||||
│ ├── install.sh # 安装脚本
|
||||
│ └── hermes-*.service # systemd 模板
|
||||
└── tests/ # 测试套件
|
||||
```
|
||||
|
||||
@@ -114,8 +124,8 @@ AgentsMeeting/
|
||||
| 组件 | 方式 | 频率 |
|
||||
|------|------|------|
|
||||
| 管理门户 | dashboard.py + Web UI (:5803) | 实时轮询 5s |
|
||||
| xmpp_bot 进程 | watchdog (xmpp_watchdog.py) | 30s |
|
||||
| xmpp_bot 消息流 | health_check_xxm.py | 5min (scheduled task) |
|
||||
| xmpp Agent Bot | watchdog (xmpp_watchdog.py) | 30s |
|
||||
| xmpp Agent 消息流 | health_check_xxm.py | 5min (scheduled task) |
|
||||
| wechat_agent | 内置看门狗 | 120s |
|
||||
| 日志 | `logs/health_check.log` | 人工查看 |
|
||||
|
||||
@@ -138,7 +148,7 @@ AgentsMeeting/
|
||||
|
||||
| ID | 问题 | 平台 | 状态 |
|
||||
|----|------|------|------|
|
||||
| R01 | MUC join 超时 (conference.yoin.fun DNS) | Linux (ejabberd) | 🔴 |
|
||||
| R01 | MUC join 超时 (conference.yoin.fun DNS) | Linux (ejabberd) | 🟢 已修复(join_muc + raw presence 双保险) |
|
||||
| R02 | wechat_agent 无系统级自动恢复 | Windows | 🟡 |
|
||||
| R03 | Gateway 进程无 systemd auto-restart | Linux | 🔴 |
|
||||
| R04 | 日志无系统级轮转 | Windows + Linux | 🟡 |
|
||||
@@ -149,7 +159,7 @@ AgentsMeeting/
|
||||
## 开发流程
|
||||
|
||||
1. **架构设计** → `docs/ARCHITECTURE.md`
|
||||
2. **代码工程化** → `src/` 按特征优先组织
|
||||
2. **核心修改** → `xmpp_agent_core.py`(统一 Bot 核心,所有 Agent 共享)
|
||||
3. **部署脚本** → `deploy/` 一键启停
|
||||
4. **测试** → `tests/` 自动化测试
|
||||
5. **文档** → `docs/` 持续更新
|
||||
|
||||
Reference in New Issue
Block a user