| EVENT | DIRECTION | PAYLOAD (주요 필드) | 설명 |
|---|---|---|---|
| task.assign | orch → agent | to, task_id, role, instructions | 태스크 할당. 대상 agent가 AI 백엔드 실행. |
| task.progress | agent → all | task_id, message, output_tail | 10초마다 진행 상황 브로드캐스트. |
| task.result | agent → all | task_id, exit_code, artifacts[] | 태스크 완료 보고. ARTIFACT: 라인 자동 파싱. |
| task.cancel | orch → agent | task_id | 실행 중 태스크 취소. AbortController 신호. |
| task.blocked | any → all | task_id, reason | 진행 불가. orchestrator가 재배정 판단. |
| state.update | any → server | key: value | Work Key 상태 업데이트 (DETS 영속). |
| mailbox.post | any → target | to, body | 오프라인이면 큐잉, 온라인이면 즉시 전달. |
| agent.hello | server → all | agent, role, machine | 에이전트 JOIN 알림. |
| agent.bye | server → all | agent, role | 에이전트 퇴장 알림. |
| METHOD | ENDPOINT | 설명 |
|---|---|---|
| GET | /api/health | 서버 상태 · work_key 개수 |
| GET | /api/presence | 온라인 에이전트 목록 (name, role, machine) |
| GET | /api/work-keys | Work Key 목록 |
| GET | /api/work-keys/latest | 최신 Work Key (없으면 404) |
| POST | /api/work-keys | 새 Work Key 발급 |
| POST | /api/task | 태스크 디스패치 { role, to, instructions } |
| GET | /api/task/:id | 태스크 결과 폴링 |
| POST | /api/task/:id/result | 태스크 결과 저장 · 채널 브로드캐스트 |
| GET | /api/state/:wk | Work Key 상태 조회 |
| PATCH | /api/state/:wk | Work Key 상태 업데이트 |
| GET | /api/mailbox/:agent | 에이전트 mailbox 읽기 |
| POST | /api/mailbox/:agent | 에이전트 mailbox 메시지 전송 |