POST http://localhost:8787/webhook
Authorization: Bearer <token>
Content-Type: application/json
{ "prompt": "读取 data/logs/error.log 并总结最新错误", "botId": "developer", "callbackUrl": "https://ci.example.com/agent-os/callback" }
→ 200 { "taskId": "...", "status": "accepted" }
→ 完成时向 callbackUrl POST { "taskId": "...", "status": "done", "answer": "..." }
Background
Current behavior:
Problem:
Needed change:
Goal
实现一个独立的 webhook 插件,让外部系统通过 HTTP 触发 agent-os 任务。
User Stories
Requirements
webhook插件(src/plugins/webhook.ts)http模块即可,不新增框架)。POST /webhook:body 含 botId / 话题或工作目录 / prompt,鉴权(Authorization: Bearer <token>,token 配置在插件 config)。StartTaskInput交给ctx.tasks.startTask。callbackUrl则任务完成时 POST 回执。cordis.yml)- name: webhook,config:{ port, token, botId?, topicId?, workspace? }。/webhook命令显示状态(可选)。cordis.yml增加 webhook 条目;src/plugins/loader.ts登记;插件卸载时关闭 server。Examples / Output
Acceptance Criteria
callbackUrl存在时任务完成回调。Test Plan
pnpm build && pnpm test全绿。Out of Scope
Dependencies / Risks
.env或 cordis.yml config,遵循"凭证不硬编码"约定。Effort Estimate