Files
JARVIS/development-doc/plan/today-status-update/phase-ts-5-commander-dispatch.md

100 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Phase TS-5Commander 派发闭环
日期2026-04-08
状态:待实施
---
## 1. 阶段目标
把“交给指挥官执行”从 UI 字段变成真实执行链路并把执行状态回写到业务任务、Today Status 与 Schedule Center。
---
## 2. 详细任务
### 2.1 新增 dispatch API
**文件**
- `backend/app/routers/task.py`
- `backend/app/schemas/task.py`
- `frontend/src/api/task.ts`
建议接口:
- `POST /api/tasks/{id}/dispatch`
- `POST /api/tasks/{id}/subtasks/{subtask_id}/dispatch`
### 2.2 业务 task -> commander payload 映射
需要定义 payload建议至少包含
- `business_task_id`
- `title`
- `description`
- `subtasks`
- `priority`
- `due_date`
- `conversation_id`
- `user_id`
### 2.3 commander 执行态回写
需要回写业务字段:
- `dispatch_status`
- `dispatch_run_id`
- `result_summary`
- 必要时同步 task / subtask 状态
### 2.4 前端状态展示
**文件**
- `frontend/src/components/chat/KanbanDetail.vue`
- `frontend/src/pages/chat/composables/useSidebarPlan.ts`
- `frontend/src/pages/schedule-center/composables/useScheduleCenterPage.ts`
需要完成:
- 详情页显示 `queued / running / completed / failed`
- Today Status 聚合显示 `commander_summary`
- Schedule Center detail 可见调度状态
---
## 3. 设计原则
1. **assignee 与 dispatch 分离**
- `assignee_type=commander` 不等于已经派发执行。
2. **业务层与 runtime 层分离**
- runtime 负责执行,业务 task 负责长期状态。
3. **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. 依赖关系
```text
依赖Phase TS-1 / TS-2 / TS-4
```