- 7 capabilities: agent-registry, task-router, receipt-protocol, forgejo-integration, matrix-chatops, agent-adapter, orchestrator-core - Tech stack: Rust + axum + zigbuild (single binary) - Forgejo as task source of truth - Matrix as real-time ChatOps layer - Adapter pattern for multi-agent type support
2.2 KiB
2.2 KiB
ADDED Requirements
Requirement: Webhook endpoint for Forgejo
Orchestrator SHALL 暴露 HTTP webhook endpoint 接收 Forgejo 事件:POST /api/v1/webhooks/forgejo。
Scenario: Forgejo sends issue event
- WHEN Forgejo 配置了指向 Orchestrator 的 webhook,Issue 事件触发
- THEN Orchestrator SHALL 接收、验证签名、解析事件体,并路由到 Task Router
Scenario: Invalid webhook signature
- WHEN 收到的 webhook 签名验证失败
- THEN Orchestrator SHALL 返回 401 并记录安全日志
Requirement: Issue to task conversion
Orchestrator SHALL 将 Forgejo Issue 转换为内部任务,保持双向映射:Issue URL ↔ task_id。
Scenario: Issue created with agent label
- WHEN Issue #42 在 repo
my-project中创建,带agent:code标签 - THEN 创建任务,
source = "forgejo:my-project#42",任务状态为created
Requirement: Task status sync back to Issue
任务状态变更 SHALL 同步回 Forgejo Issue:label 更新(status:todo → status:doing → status:done)、milestone 更新、assignee 更新。
Scenario: Task assigned to agent
- WHEN 任务被分配给 Agent
worker-03 - THEN 对应 Issue 的 assignee SHALL 更新为
worker-03对应的 Forgejo 用户,label SHALL 添加status:doing
Scenario: Task completed
- WHEN 任务状态变为
completed - THEN Issue label SHALL 从
status:doing变为status:done,Issue comment SHALL 写入 receipt summary
Requirement: PR creation and update
Agent 通过 Orchestrator 创建的 PR SHALL 关联到原始 Issue(通过 description 或 Closes #N 引用)。
Scenario: Agent creates PR via Orchestrator
- WHEN Agent 在 receipt 中声明需要创建 PR
- THEN Orchestrator SHALL 协助创建 PR(或验证 Agent 直接创建的 PR),确保 PR body 包含
Closes #<issue-number>
Requirement: Forgejo API authentication
Orchestrator SHALL 使用 Forgejo API token 进行所有 API 调用(读取 Issue、创建 comment、更新 label、创建 PR 等)。
Scenario: Token rotation
- WHEN Forgejo API token 过期
- THEN Orchestrator SHALL 返回明确错误并通过 Matrix 通知管理员