Hermes
Hermes 对接

用 Hermes Agent 接入超然信机器人

官方 Hermes 不含超然信插件。安装独立插件后,配置各自的 rbt_*,即可通过 WebSocket(路径 A)双向对话。

前置条件

你需要从超然信客户端拿到以下信息,并自备 LLM 密钥:

说明
CHAORANXIN_BOT_TOKEN 官方客户端创建机器人后签发的 rbt_*(通常只显示一次)
CHAORANXIN_API_BASE IM HTTP 根地址,例如 https://api.xsign.co(用于节点发现)
LLM API Key Hermes 模型调用所需,与超然信无关,用户自备
通道说明:本插件实现的是 WebSocket 双向(路径 A),不实现 REST message/push 与 HTTP Hook。若需要纯服务端推送或离线回调,请按自有平台协议自行对接。

安装

1. 安装官方 Hermes

若尚未安装:

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

2. 放入插件目录(一键安装)

下面一整段命令会拉取仓库并只安装内层 chaoranxin/ 到 Hermes 插件目录(不要拷贝仓库根目录):

mkdir -p ~/.hermes/plugins && \
rm -rf /tmp/hermes-chaoranxin-platform ~/.hermes/plugins/chaoranxin && \
git clone --depth 1 https://github.com/chaoranxin/hermes-chaoranxin-platform.git /tmp/hermes-chaoranxin-platform && \
cp -R /tmp/hermes-chaoranxin-platform/chaoranxin ~/.hermes/plugins/chaoranxin

安装后目标路径应包含 plugin.yamladapter.pyproto.py__init__.pyREADME.md

3. 启用插件

用户插件不会自动加载,需手动启用:

hermes plugins enable chaoranxin
hermes plugins list    # 期望 chaoranxin 为 enabled

配置

4. 配置 LLM

hermes setup model

5. 配置超然信凭证

推荐使用向导:

hermes setup gateway
# 选择 Chaoranxin (超然信),填入 rbt_* 与 API base

或手动写入 ~/.hermes/.env

CHAORANXIN_BOT_TOKEN=rbt_xxxxxxxx
CHAORANXIN_API_BASE=https://api.xsign.co

并确认 ~/.hermes/config.yaml

platforms:
  chaoranxin:
    enabled: true

CHAORANXIN_HOME_CHANNEL 无需手填 — Gateway 连接后会从 RobotLogin.data.owner 自动写入。

启动与验证

hermes gateway start --foreground
hermes gateway status    # 期望: chaoranxin: connected
  1. 在超然信 App 私聊该机器人,应收到 Hermes 回复。
  2. 发送 /help 可测斜杠命令。
节点发现:插件会调用 GET {api_base}/im/api/v1/robot/servers,用 rbt_* 鉴权,自动选择节点并连接 ws://{host}:{inter}{robot}。握手成功后服务端下发 RobotLogin,其中 data.robot 为机器人 uuid。

访问控制(可选)

默认允许所有用户私聊(CHAORANXIN_ALLOW_ALL_USERS=true)。白名单示例:

CHAORANXIN_ALLOW_ALL_USERS=false
CHAORANXIN_ALLOWED_USERS=uuid1,uuid2

机器人创建者(RobotLogin.data.owner)始终可发消息。

常见问题

现象 处理
hermes plugins list 看不到 chaoranxin 确认路径为 ~/.hermes/plugins/chaoranxin/plugin.yaml,不要多嵌套一层或整仓拷贝
忘记 enable 执行 hermes plugins enable chaoranxin
收不到回复 / not in allowlist 检查 allowlist;确认 token 对应该机器人
HTTP 401 / 403 / 404 token 或 API base 错误;此类错误不会无限重连
多人共用 Gateway + 同一 token 不建议 — 每人一个 bot、各自 Gateway