{
  "module": "wechat_bridge",
  "version": "2.0",
  "purpose": "微信桥接通道，由 246 Linux 独立完成。Docker wechatbot-webhook 容器扫码登录后收发微信消息，经 webhook 接收器转发到 Hermes Gateway 处理。Windows 只参与文章抓取（5810）。",
  "ui_location": "Infrastructure tab → Platform → 莫荷微信 (Linux)",

  "human_help": {
    "title": "莫荷微信（Linux :3001 / webhook :5804）",
    "description": [
      "这是整个系统的微信通道。部署在 246 Linux 上：",
      "• docker-wechatbot-webhook 容器（:3001）— Web 微信协议，扫码登录",
      "• wechat_webhook.py（:5804）— 接收容器推送的消息，转发到 Hermes API",
      "• Hermes Gateway（:8642）— AI 处理并生成回复",
      "• 回复经 webhook → Docker 容器发回微信",
      "Windows 不再运行微信客户端或 wxhelper，唯一的参与是 5810 文章抓取服务。"
    ],
    "usage": [
      "监控状态：Infrastructure → Platform 下查看状态指示灯（绿=容器运行中，红=容器未启动）",
      "检查的是 246:3001 端口（Docker 容器）",
      "如果掉线：访问 http://192.168.1.246:3001/login 重新扫码"
    ],
    "troubleshooting": [
      "如果状态 stopped：SSH 到 246 执行 docker ps 检查 wxBotWebhook 容器是否运行",
      "启动容器：docker start wxBotWebhook",
      "如果需要重新扫码：http://192.168.1.246:3001/login?token=your_token",
      "Web 协议约 2 天掉线一次，需重新扫码。容器已设置 --restart unless-stopped 自动重启",
      "wechat_webhook.py 由 systemd 管理：sudo systemctl status wechat-webhook"
    ],
    "related": "文章抓取服务（供微信通道读取链接内容）"
  },

  "ai_spec": {
    "apis": [
      {"method": "TCP", "port": 3001, "desc": "Docker wechatbot-webhook 容器（Websocket 通信）"},
      {"method": "POST", "port": 5804, "desc": "wechat_webhook.py 接收消息（本地转发）"},
      {"method": "POST", "path": "/webhook/msg/v2", "port": 3001, "desc": "发送消息到微信（Docker API）"}
    ],
    "dependencies": [
      "246 Linux 服务器运行中",
      "Docker 容器 wxBotWebhook 运行中",
      "wechat_webhook.py systemd 服务运行中",
      "Hermes Gateway (:8642) 存活才能处理消息"
    ],
    "constraints": [
      "Web 微信协议约 2 天掉线一次，需要重新扫码",
      "Windows 不再参与微信收发（旧 wechat_agent.py 已停用）",
      "网络依赖 EasyTier VPN 打通 Windows ↔ Linux"
    ],
    "related_files": [
      "gateway/linux/wechat_webhook.py — Webhook 接收器",
      "gateway/linux/README.md — 架构说明",
      "gateway/scripts/templates/dashboard.html — fI() 状态展示",
      "gateway/scripts/specs/wechat_bridge.json — 本 spec 文件"
    ]
  }
}
