API 文档
Events 接口
查询仓库事件、事件详情、终止、重派、对话线程和知识沉淀。
事件是流水线的执行记录。一个 Issue 可能对应多条事件,每条事件有 seq。
接口一览
查询
| 方法 | 路径 | 用途 | 认证 |
|---|---|---|---|
GET |
/api/events/{owner}/{repo} |
仓库事件列表 | dual |
GET |
/api/events/detail/{seq} |
事件详情 | dual |
POST |
/api/events/{seq}/a2a-redo |
A2A 手动重做(人工交接) | 用户级 |
GET |
/api/events/{seq}/thread |
事件对话线程 | 用户级 |
GET |
/api/events/{seq}/a2a-redo/scene |
A2A 重做场景信息 | 用户级 |
操作
| 方法 | 路径 | 用途 | 认证 |
|---|---|---|---|
POST |
/api/events/{seq}/terminate |
终止事件 | 用户级 |
POST |
/api/events/{seq}/redispatch |
重派事件 | 用户级 |
POST |
/api/events/{seq}/flow/reset |
重置流程 | 用户级 |
知识与对话
| 方法 | 路径 | 用途 | 认证 |
|---|---|---|---|
DELETE |
/api/events/{seq}/knowledge/{scope} |
删除 Issue 知识 | 用户级 |
POST |
/api/events/{seq}/knowledge |
Agent 沉淀共享知识 | tk_ |
POST |
/api/events/{seq}/chat |
事件对话发送 | 用户级 |
POST |
/api/events/{seq}/chat/stream |
对话 SSE | 用户级 |
POST |
/api/events/{seq}/chat/submit |
异步提交 | 用户级 |
GET |
/api/events/chat/task/{task_id}/status |
异步状态 | 用户级 |
GET |
/api/events/chat/task/{task_id}/stream |
异步流 | 用户级 |
DELETE |
/api/events/{seq}/chat |
删除对话线程 | 用户级 |
“用户级”指 grape_ API Key 或 Web JWT;tk_ 返回 403。
查事件
curl -fsS -H @~/.grape.auth \
"$GRAPE_BASE_URL/api/events/<owner>/<repo>?page=1&page_size=20"
事件详情:
curl -fsS -H @~/.grape.auth \
"$GRAPE_BASE_URL/api/events/detail/123"
事件列表和详情都受仓库权限限制;detail 是 dual,tk_ 在仓库作用域内可用。
终止事件
POST /api/events/{seq}/terminate
用于停止正在运行或排队的事件。终止是人工介入动作,执行前确认目标 seq 和 Issue,避免停错。
重派事件
POST /api/events/{seq}/redispatch
重新派发一条事件。适合节点失败、引擎临时不可用后恢复;不要对已完成事件重复重派。
事件对话
发送:
POST /api/events/{seq}/chat
流式:
POST /api/events/{seq}/chat/stream
Accept: text/event-stream
异步提交后,用 GET /api/events/chat/task/{task_id}/status 或 /stream 取结果。删除线程用 DELETE /api/events/{seq}/chat。
常见错误
| 状态 | 原因 |
|---|---|
| 400 | 参数缺失、seq 非法 |
| 403 | 仓库不匹配、tk_ 调用户级接口 |
| 404 | 事件不存在 |
| 409 | 事件状态不允许当前操作 |