From 45190442ccbbdaa55d4e1ca9543ec2042cc3345b Mon Sep 17 00:00:00 2001 From: admin9webs Date: Fri, 10 Jul 2026 16:10:41 +0800 Subject: [PATCH] Add archived/a2a-inbox-handler --- skills/archived/a2a-inbox-handler/SKILL.md | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 skills/archived/a2a-inbox-handler/SKILL.md diff --git a/skills/archived/a2a-inbox-handler/SKILL.md b/skills/archived/a2a-inbox-handler/SKILL.md new file mode 100644 index 0000000..77ac7f6 --- /dev/null +++ b/skills/archived/a2a-inbox-handler/SKILL.md @@ -0,0 +1,76 @@ +--- +name: a2a-inbox-handler +description: A2A消息自动响应机制 — webhook接收 + inotify实时监听 + cron兜底轮询 +version: 1.0 +tags: [a2a, inbox, webhook, inotify, cron] +--- + +# A2A Inbox Handler + +HAgent201 自动响应其他Agent通过A2A Gateway发来的消息。 + +## 架构 + +``` +方案一:Gateway /route → 本地 Webhook :8788 → ~/.hermes/a2a/inbox/ → inotify watcher → hermes chat +方案二:cron scanner (5min) 轮询主动拉取 Gateway GET /inbox/{agent_id}/messages → hermes chat → PATCH 标记已读 +``` + +## 文件结构 + +``` +~/.hermes/a2a/ +├── webhook_receiver.py # HTTP服务,POST /a2a/inbox 接收消息 +├── inbox_watcher.py # inotify实时监听,新消息触发hermes chat +├── inbox_scanner.py # cron兜底,扫描inbox处理漏网消息 +├── a2a_handler.sh # 统一管理脚本 (start/stop/status/test/restart) +├── inbox/ # 待处理消息 +├── processed/ # 已处理消息 +└── logs/ # webhook.log, watcher.log, scanner.log +``` + +## 管理 + +```bash +# 启动/停止 +~/.hermes/a2a/a2a_handler.sh start +~/.hermes/a2a/a2a_handler.sh stop +~/.hermes/a2a/a2a_handler.sh restart +~/.hermes/a2a/a2a_handler.sh status + +# 测试 +~/.hermes/a2a/a2a_handler.sh test + +# 手动扫描 +python3 ~/.hermes/a2a/inbox_scanner.py +``` + +## 开机自启 + +systemd service: `a2a-handler.service` (enabled) + +## Cron兜底 + +cronjob ID: cf0afc951a01, 每5分钟执行 `inbox_scanner.py` + +## 端口 + +- Webhook: 8788 (POST /a2a/inbox, GET /health) + +## 消息格式 + +Webhook接收的JSON: +```json +{ + "source_agent_id": "custom_xxx", + "payload": {"message": "...", "action": "chat"} +} +``` + +处理后移至 `processed/` 目录。 + +## 注意 + +- Gateway 目前没有原生inbox端点,/route是即发即弃 +- 如果要实现Gateway → Webhook转发,需在Gateway端配置消息路由 +- inbox_watcher依赖 pyinotify(已安装到hermes-agent venv)