iluozhiqiang/hermes-aimaxia/hermes-async-worker

Claude Code and agent skill by iluozhiqiang/hermes-aimaxia

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Hermes 异步任务 Worker v2 - processing.json 统一状态管理,非阻塞交互

Install

npx vskill@latest install iluozhiqiang/hermes-aimaxia/hermes-async-worker

SKILL.md

The same SKILL.md was published earlier as iluozhiqiang/hermes-aimaxia/hermes-async-worker.

Hermes 异步 Worker v2

核心思路

Hermes 只负责「聊天+安排工作」,Worker 负责「执行任务」。

所有 terminal 执行全部交给 Worker,Hermes 永远不被阻塞。

架构图

用户发消息(飞书 message_id)→ Hermes 收到
↓
需要执行任务吗?
├── 不需要 → 直接回复(结束)
└── 需要 → 提交到 processing.json → 立刻告诉用户"在跑了"
↓
Worker 后台并行执行(Hermes 继续跟用户聊)
↓
需要交互?→ Worker 写 pending 字段 → Hermes 回复用户(飞书 quote reply)
↓
用户回答 → Hermes 写 answer 字段 → Worker 继续
↓
完成 → Poller/Cron 检测到 → Hermes 通知用户 → 删除任务

统一状态文件:processing.json

所有状态合并在一个文件,不再有 pending.json / answer.json / result_*.json

位置:/opt/data/tools/worker/processing.json

json
{
"tasks": [
{
"task_id": "xxx",
"message_id": "feishu_msg_id",
"command": {"type": "shell", "cmd": "...", "timeout": 300},
"status": "pending",
"pending": null,
"answer": null,
"result": null,
"created_at": 1744412400,
"completed_at": null
}
]
}
状态流转
pending → running → completed(任务完成,从 processing.json 删除)
→ failed
→ pending_interactive(需要用户交互)
→ running(用户回答后继续)
交互字段
  • pending: {question: "...", options: ["A", "B"]} — 需要用户决策时填
  • answer: "A" — 用户回答后填
  • result: {returncode, stdout, stderr} — 完成后填

文件结构

/opt/data/tools/worker/
├── worker.py # 常驻进程,并行执行任务
├── submit.py # 任务提交(直接写 processing.json)
├── poller.py # 通知轮询(3秒间隔,cron 调度)
└── processing.json # 运行时状态文件(统一管理)

注意:scheduler.py 和 task_queue/ 已废弃,v2 不再使用。

任务提交

bash
# Shell 命令
python3 /opt/data/tools/worker/submit.py "msg123" '{"type":"shell","cmd":"ls -la","timeout":60}'
# Python 代码
python3 /opt/data/tools/worker/submit.py "msg123" '{"type":"python","code":"print(1+1)","timeout":30}'

Worker 管理

bash
# 启动(后台常驻)
cd /opt/data/tools/worker && python3 worker.py &
# 检查状态
ps aux | grep worker.py
# 停止
kill $(pgrep -f worker.py)

Worker 挂了不自动重启,询问用户是否要重启。

通知机制

Poller (poller.py) 检查 processing.json,发现 completed 或 pending_interactive 的任务输出通知。

  • --once 模式:单次检查(cron 每分钟调用)
  • 循环模式:运行55秒后退出,cron 自动重启

已通知的 task_id 记录在 notified.json,避免重复通知。

Cron 配置

Hermes cronjob Worker 轮询通知,每分钟运行一次,检查 processing.json 并汇报。

交互流程示例(飞书 quote reply)

  1. 用户发消息 message_id: abc123
  2. Hermes 提交任务到 processing.json
  3. Worker 需要决策 → status: pending_interactive, pending: {question, options}
  4. Hermes 检测到 → reply 到飞书 abc123 消息(quote reply)
  5. 用户在 abc123 下回复 → Hermes 写 answer 字段
  6. Worker 继续执行 → status: completed
  7. Hermes 通知结果 → 从 processing.json 删除任务

待实现功能

  • 飞书卡片交互:pending 时发飞书 Card Message 带按钮,用户点击后按钮消失、显示选择
  • 调研结论(2026-04-12):feishu.py 已有完整基础设施
  • 卡片点击事件:_handle_card_action_event()(line 1915)通过 P2CardActionTrigger 回调接收
  • 卡片更新 API:_update_approval_card()(line 1480)使用飞书 message.update 接口替换卡片内容
  • 按钮值携带:"value": {"hermes_action": "...", "approval_id": "..."} 用于路由到不同处理逻辑
  • 已有路径(approval):hermes_action 分支(line 1937-1978)→ 解析 choice → _update_approval_card() → 按钮消失 ✅
  • 待改造路径(generic):非 hermes_action 分支(line 1980-2008)→ 只发 synthetic COMMAND → 不更新卡片 ❌
  • 实现方案:在 generic 路径也加 message.update,从 event.context.open_message_id 获取卡片 message_id,构建无按钮的新卡片替换
  • 注意:card action event 里没有直接暴露 message_id,需要从 event.context 或 event.open_message_id 获取(需确认字段名)
  • Worker 自动启动:Hermes 启动时自动起 Worker
  • 任务结果直接发回飞书:Poller 检测到完成后通过飞书 API 发消息

架构规则(用户确认)

  1. 并行执行:多任务同时跑,互不阻塞
  2. 3秒轮询间隔(poller.py 默认)
  3. 不自动重启 Worker:挂了问用户
  4. message_id 关联:飞书 quote reply 机制
  5. 所有文件在 /opt/data/ 下:便于 Git 管理
  6. 默认用 Python 脚本:Cloud Code 只用于复杂推理任务

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/iluozhiqiang/hermes-aimaxia/hermes-async-worker/badge)](https://verified-skill.com/skills/iluozhiqiang/hermes-aimaxia/hermes-async-worker)

Something wrong with this skill or its page? Tell us.