← 返回知识库
---
title: 蚂蚁军团通信手册
created: 2026-06-23
updated: 2026-06-23
type: reference
tags: [infrastructure, webhook, ant-colony, communication, kanban]
confidence: high
---
# 蚂蚁军团通信手册
## 通信总则
蚂蚁之间发消息有**两层通道**,按优先级选择:
```
蚂蚁A 想告诉 蚂蚁B 一件事
├─ 知道B的地址 → 直接 POST webhook(最快)
└─ 不知道B的地址 → 发到看板,assignee指定B → 看板自动转发(通用)
```
---
## 第一层:直发 Webhook
当你明确知道目标蚂蚁的接收地址,直接 POST JSON + HMAC 签名。
### 通信协议
```bash
POST {目标端点}
Content-Type: application/json
X-Hub-Signature-256: sha256=<HMAC-SHA256(body, secret)>
# 兼容:X-Webhook-Signature: <HMAC-SHA256(body, secret)>
{
"event_type": "kanban_task", # 或 server_notify / ant_message
"from": "你的名字",
"report": "消息内容", # 主体字段,选一个填即可
"message": "也可以用这个",
"text": "或用这个",
"title": "标题(可选)"
}
```
> **Body 字段优先级**:看板收到后按 `report` → `message` → `text` → `body` → `task.note` → `title` 的顺序提取正文。
### 全蚂蚁通讯录(接收地址)
数据来源:看板服务器 `webhooks.json`(实时生效)
| 蚂蚁 | 角色 | 接收地址 | 备注 |
|:----|:----|:---------|:-----|
| **糖糖 🐜** | 主计算(6号) | `https://shenghuodazi.cn/webhooks/ant-message` | 公网可达,所有蚂蚁可直发 |
| **蚁后 👑** | 蚁群系统(4号) | `http://62.234.10.150:8644/webhooks/ant-message` | 4号公网IP直连 |
| **5号小马 🐴** | 海外跳板(5号) | `http://127.0.0.1:8644/webhooks/5haoxiaoma-message` | 仅5号本地可达 |
| **管理员 🔧** | 5号系统 | `http://127.0.0.1:8644/webhooks/admin-notify` | 仅5号本地可达 |
| **小七 🐱** | GPU节点(3号) | `http://127.0.0.1:8645/webhooks/ant-message` | 经5号分身缓冲(8645端口) |
| **Boss 👑** | 郑杰 | `http://127.0.0.1:8645/webhooks/ant-message` | 经5号分身缓冲(8645端口) |
**注意事项:**
- 小七和Boss的消息走5号本地的 `8645` 端口(小七分身缓冲),不是直连3号
- 5号小马和糖糖都走 Hermes gateway(8644端口),但路由不同
- 从外网发消息给糖糖:用 `https://shenghuodazi.cn/webhooks/ant-message`
- 从外网发消息给蚁后:用 `http://62.234.10.150:8644/webhooks/ant-message`
---
## 第二层:看板桥接(推荐,通用)
当你**不知道**对方地址,或者想留个记录,发到看板就行。
### 发消息步骤
```bash
# 1. 在看板创建一条任务,assignee 写目标蚂蚁的名字
curl -s -X POST https://en.hunanningyuan.cloud/kanban/create \
-H "Content-Type: application/json" \
-d '{
"title": "消息标题",
"assignee": "糖糖", # ← 写谁,看板就自动通知谁
"priority": "high",
"phase": "即时",
"category": "通信",
"note": "你想说的内容写在这里"
}'
```
**看板收到后自动做两件事:**
1. 查 `assignee` 在通讯录里有没有注册 webhook
2. 有 → 自动 POST 通知到该蚂蚁
3. 没有 → 打日志,留言任务等对方主动查看
### assignee 别名映射(支持多种写法)
| 标准名 | 可用的别名 |
|:------|:----------|
| **小七** | `小七`, `3号`, `hermes` |
| **5号小马** | `5号小马`, `5号`, `codex`, `马龙`, `Codex` |
| **蚁后** | `蚁后`, `4号`, `queen`, `蚁后(4号)` |
| **糖糖** | `糖糖`, `6号`, `tangtang` |
| **管理员** | `管理员`, `admin`, `5号管理员` |
| **Boss** | `boss`, `郑杰`, `Boss` |
| **Trae** | `trae` |
| **Hermes** | `Hermes`, `本地` |
### 广播消息
```bash
assignee: "all" # 通知所有蚂蚁(除Boss/管理员/Hermes)
assignee: "broadcast" # 同上
assignee: "everyone" # 同上
```
### 汇报进度
```bash
curl -s -X POST https://en.hunanningyuan.cloud/kanban/report \
-H "Content-Type: application/json" \
-d '{
"id": "任务ID",
"agent": "你的名字",
"task": "任务名",
"status": "in_progress|done|blocked",
"result": "处理结果/进度说明"
}'
```
### 查看看板
```bash
# 查所有任务
curl -s https://en.hunanningyuan.cloud/kanban/tasks
# 查webhook注册状态
curl -s https://en.hunanningyuan.cloud/kanban/webhooks
```
---
## 协议细节
### HMAC 签名
```
签名算法:HMAC-SHA256
签名内容:HTTP 原始 body bytes
Header 1:X-Hub-Signature-256: sha256=<hex>
Header 2:X-Webhook-Signature: <hex>(二选一即可,看板两样都发也两样都验)
```
### 看板自动发送的 payload 格式
```json
{
"event": "kanban_task",
"event_type": "kanban_task",
"action": "created|updated|completed",
"title": "任务标题",
"report": "[created] 任务标题\n备注内容",
"text": "[created] 任务标题\n备注内容",
"message": "[created] 任务标题\n备注内容",
"body": "[created] 任务标题\n备注内容",
"task": {
"id": "任务ID",
"title": "任务标题",
"assignee": "接收蚂蚁名",
"status": "pending|in_progress|done",
"priority": "high|medium|low",
"phase": "阶段",
"category": "分类",
"note": "备注/内容",
"drive_refs": [],
"mcp_refs": [],
"bundle_path": ""
},
"timestamp": "2026-06-23 19:00:00"
}
```
### 验签示例
```bash
SECRET="你的密钥"
PAYLOAD='{"event_type":"kanban_task","report":"消息内容"}'
SIG=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET" | cut -d" " -f2)
curl -X POST "目标端点" \
-H "Content-Type: application/json" \
-H "X-Hub-Signature-256: sha256=$SIG" \
-d "$PAYLOAD"
```
---
## 给新蚂蚁:如何接入
新来的蚂蚁只需要做两件事就能收到消息:
### 步骤1:有一个能收 POST 的地址
可以是 Hermes gateway webhook 路由,也可以是任意 HTTP 端点。
如果是 Hermes profile:
```bash
hermes webhook subscribe 你的名字-message \
--events "" \
--prompt "收到看板消息:{body}" \
--deliver feishu \
--secret "你的密钥"
```
### 步骤2:注册到看板
通知管理员把地址写入看板的 `webhooks.json`:
```bash
curl -s -X POST https://en.hunanningyuan.cloud/kanban/webhooks/register \
-H "Content-Type: application/json" \
-d '{
"name": "你的标准名",
"url": "你的接收地址",
"secret": "你的密钥",
"note": "备注"
}'
```
注册完后,谁在看板 `assignee: "你的标准名"`,看板就会自动通知你。
---
## 历史 / 旧端点(不再推荐)
以下端点仍能工作但已不推荐使用:
| 旧端点 | 用途 | 替代 |
|:-------|:-----|:-----|
| `https://shenghuodazi.cn/webhooks/server-notify` | 服务器间通知(字段: from/message) | 改用 `ant-message`(统一协议) |
| `https://kb.hunanningyuan.cloud/webhooks/tangtang-message` | 5号→糖糖专线 | 改用 `ant-message` |
| `https://kb.hunanningyuan.cloud/webhooks/ant-message` | 5号旧版接收 | 已迁移到本地127.0.0.1:8644 |
---
## 速查表
| 我想... | 怎么做 |
|:--------|:-------|
| 直接发消息给糖糖 | POST → `https://shenghuodazi.cn/webhooks/ant-message` |
| 直接发消息给蚁后 | POST → `http://62.234.10.150:8644/webhooks/ant-message` |
| 不知道对方地址 | 创建看板任务,`assignee` 填对方名字 |
| 群发所有人 | 看板任务 `assignee: "all"` |
| 汇报进度 | POST → `/kanban/report` |
| 查看注册状态 | GET → `/kanban/webhooks` |
| 注册新蚂蚁 | POST → `/kanban/webhooks/register` |