Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2.5 KiB
2.5 KiB
Phase TS-5:Commander 派发闭环
日期:2026-04-08 状态:待实施
1. 阶段目标
把“交给指挥官执行”从 UI 字段变成真实执行链路,并把执行状态回写到业务任务、Today Status 与 Schedule Center。
2. 详细任务
2.1 新增 dispatch API
文件:
backend/app/routers/task.pybackend/app/schemas/task.pyfrontend/src/api/task.ts
建议接口:
POST /api/tasks/{id}/dispatchPOST /api/tasks/{id}/subtasks/{subtask_id}/dispatch
2.2 业务 task -> commander payload 映射
需要定义 payload,建议至少包含:
business_task_idtitledescriptionsubtasksprioritydue_dateconversation_iduser_id
2.3 commander 执行态回写
需要回写业务字段:
dispatch_statusdispatch_run_idresult_summary- 必要时同步 task / subtask 状态
2.4 前端状态展示
文件:
frontend/src/components/chat/KanbanDetail.vuefrontend/src/pages/chat/composables/useSidebarPlan.tsfrontend/src/pages/schedule-center/composables/useScheduleCenterPage.ts
需要完成:
- 详情页显示
queued / running / completed / failed - Today Status 聚合显示
commander_summary - Schedule Center detail 可见调度状态
3. 设计原则
- assignee 与 dispatch 分离
assignee_type=commander不等于已经派发执行。
- 业务层与 runtime 层分离
- runtime 负责执行,业务 task 负责长期状态。
- Today Status 与 Schedule Center 状态一致
- 不允许首页和调度页看到不同状态。
4. 核心文件清单
| 文件 | 操作 | 说明 |
|---|---|---|
backend/app/routers/task.py |
修改 | 新增 dispatch API |
| commander / orchestration service | 修改 | 业务 task 派发到执行层 |
frontend/src/api/task.ts |
修改 | dispatch API 封装 |
frontend/src/components/chat/KanbanDetail.vue |
修改 | 派发入口与状态展示 |
frontend/src/pages/chat/composables/useSidebarPlan.ts |
修改 | commander summary 展示 |
frontend/src/pages/schedule-center/composables/useScheduleCenterPage.ts |
修改 | 调度状态联动 |
5. 验收标准
- 任务可派发给 commander
- 子任务可派发给 commander
- Today Status 能看到 commander 状态变化
- Schedule Center 与 Chat 首页状态一致
- 业务模型与 runtime 模型保持分层
6. 依赖关系
依赖:Phase TS-1 / TS-2 / TS-4