← 返回
未分类

Hope OpenTask

OpenTask 分布式任务管理系统。查询和管理 OpenClaw 容器的任务。使用场景:(1) 查询待执行任务、获取任务列表、任务详情;(2) 创建任务、开始执行、完成任务、标记失败、重试、取消;(3) 查看今日统计、任务日志;(4) HEARTBEAT 集成任务检查。触发短语:"查询任务"、"获取任务"、"创...
OpenTask 分布式任务管理系统。查询和管理 OpenClaw 容器的任务。使用场景:(1) 查询待执行任务、获取任务列表、任务详情;(2) 创建任务、开始执行、完成任务、标记失败、重试、取消;(3) 查看今日统计、任务日志;(4) HEARTBEAT 集成任务检查。触发短语:"查询任务"、"获取任务"、"创...
linux2010 linux2010 来源
未分类 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 333
下载
💾 0
安装
1
版本
#latest

概述

OpenTask Skill

分布式任务管理系统,为 OpenClaw 容器分配和管理任务。

服务信息

信息
-----------
服务地址http://127.0.0.1:8090
API 前缀/api
认证 HeaderX-Bot-Key
API Keyhope-bot-apikey-2026-0424

快速使用

获取待执行任务

curl -H "X-Bot-Key: hope-bot-apikey-2026-0424" \
  "http://127.0.0.1:8090/api/tasks/pending?assigned_to=anna"

返回按优先级排序的任务 (P0 > P1 > P2)。

创建任务

curl -X POST -H "X-Bot-Key: hope-bot-apikey-2026-0424" \
  -H "Content-Type: application/json" \
  -d '{"task_name":"发送消息","assigned_to":"anna","priority":"P1","created_by":"hope"}' \
  "http://127.0.0.1:8090/api/tasks"

开始执行

curl -X PUT -H "X-Bot-Key: hope-bot-apikey-2026-0424" \
  "http://127.0.0.1:8090/api/tasks/{id}/start"

完成任务

curl -X PUT -H "X-Bot-Key: hope-bot-apikey-2026-0424" \
  -H "Content-Type: application/json" \
  -d '{"result":"执行成功"}' \
  "http://127.0.0.1:8090/api/tasks/{id}/complete"

HEARTBEAT 集成

在 HEARTBEAT.md 中添加任务检查:

## 检查待执行任务
- [ ] 获取待执行任务:curl -s -H "X-Bot-Key: ..." "http://127.0.0.1:8090/api/tasks/pending?assigned_to=anna"
- [ ] 有任务则执行,无任务则 HEARTBEAT_OK

assigned_to 值

说明
------------
annaAnna 容器
trumpTrump 容器
ccClaude Code 容器
session_agentSession Agent

priority 值

说明
------------
P0紧急
P1重要
P2一般

status 值

说明
------------
pending待执行
running执行中
completed已完成
failed失败
cancelled已取消

日志记录

每次状态变更都会写入 bot_task_log 表:

字段说明
------------
task_id任务 ID
action操作类型 (start/complete/fail/retry/cancel)
old_status原状态
new_status新状态
message操作消息
operator操作者 (system)
created_time操作时间

完整 API 文档

详细 API 接口说明请参考 api.md


使用示例

场景 1:HEARTBEAT 检查任务

# 获取待执行任务
TASKS=$(curl -s -H "X-Bot-Key: hope-bot-apikey-2026-0424" \
  "http://127.0.0.1:8090/api/tasks/pending?assigned_to=anna")

# 解析任务数量
COUNT=$(echo "$TASKS" | python3 -c "import sys,json; print(len(json.load(sys.stdin)))")

if [ "$COUNT" -gt 0 ]; then
  echo "有 $COUNT 条待执行任务"
  # 开始执行第一条任务
  TASK_ID=$(echo "$TASKS" | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['id'])")
  curl -X PUT -H "X-Bot-Key: ..." "http://127.0.0.1:8090/api/tasks/$TASK_ID/start"
else
  echo "HEARTBEAT_OK"
fi

场景 2:创建并执行任务

# 1. 创建任务
TASK=$(curl -s -X POST -H "X-Bot-Key: ..." \
  -H "Content-Type: application/json" \
  -d '{"task_name":"发送每日问候","assigned_to":"anna","priority":"P1"}' \
  "http://127.0.0.1:8090/api/tasks")

TASK_ID=$(echo "$TASK" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")

# 2. 开始执行
curl -X PUT -H "X-Bot-Key: ..." "http://127.0.0.1:8090/api/tasks/$TASK_ID/start"

# 3. 执行任务逻辑...

# 4. 完成任务
curl -X PUT -H "X-Bot-Key: ..." \
  -H "Content-Type: application/json" \
  -d '{"result":"问候消息已发送"}' \
  "http://127.0.0.1:8090/api/tasks/$TASK_ID/complete"

数据库信息

信息
-----------
数据库hope_engine @ 192.168.31.167:3306
任务表bot_task
日志表bot_task_log

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-07 19:13 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Free Ride - Unlimited free AI

shaivpidadi
管理OpenClaw的OpenRouter免费AI模型,自动按质量排名模型,配置速率限制备用方案,并更新opencla...
★ 473 📥 79,093
it-ops-security

1password

steipete
设置和使用 1Password CLI (op)。适用于:安装 CLI、启用桌面应用集成、登录(单/多账户)、通过 op 读取/注入/运行密钥。
★ 53 📥 32,161
dev-programming

GitHub Contribution

linux2010
自动化 GitHub 贡献工作流,通过正向标签检测实现智能问题发现。适用场景:(1) 向开源项目贡献代码,(2) ...
★ 1 📥 1,308