新增: 多Agent数据层(V36迁移+3新表+Repo CRUD+7个测试全绿)
- V36: ai_plans/ai_subtasks/ai_conflicts 3 新表 + ai_messages/ai_tool_executions 加 subtask_id - models: PlanRecord/SubTaskRecord/ConflictRecord 结构体 - PlanRepo/SubTaskRepo/ConflictRepo CRUD(insert/get/list_by_*/update_status/resolve) - 7个 Repo 单元测试全部通过(内存 SQLite + 全迁移) - 顺带修复 task_repo.rs 预存测试编译错误(trec_full 参数类型+缺失 await)
This commit is contained in:
@@ -497,3 +497,62 @@ pub struct ModuleDependencyRecord {
|
||||
pub label: Option<String>,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 多 Agent 并行执行模型 (V36)
|
||||
// ============================================================
|
||||
|
||||
/// Plan 记录(一次用户消息触发的并行执行计划)
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PlanRecord {
|
||||
pub id: String,
|
||||
pub conversation_id: String,
|
||||
/// 触发 Plan 的用户消息 id
|
||||
pub user_message_id: Option<String>,
|
||||
/// planning / executing / merging / done / error
|
||||
pub status: String,
|
||||
pub subtask_count: i64,
|
||||
pub created_at: String,
|
||||
pub completed_at: Option<String>,
|
||||
}
|
||||
|
||||
/// SubTask 记录(Plan 拆解出的子任务)
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SubTaskRecord {
|
||||
pub id: String,
|
||||
pub plan_id: String,
|
||||
/// 分配的人设 id(coder/reviewer/architect/tester/analyst)
|
||||
pub persona_id: Option<String>,
|
||||
/// 子任务意图描述
|
||||
pub intent: String,
|
||||
/// pending / running / done / error
|
||||
pub status: String,
|
||||
/// DAG 层级(0 起)
|
||||
pub layer: i64,
|
||||
/// 依赖的 SubTask id 列表(JSON 数组字符串)
|
||||
pub deps: Option<String>,
|
||||
/// Git worktree 分支名(NULL=非 Git 工程降级串行)
|
||||
pub branch: Option<String>,
|
||||
pub created_at: String,
|
||||
pub completed_at: Option<String>,
|
||||
}
|
||||
|
||||
/// 冲突记录(合并时检测到的文件/语义冲突)
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ConflictRecord {
|
||||
pub id: String,
|
||||
pub plan_id: String,
|
||||
pub file_path: String,
|
||||
/// file(同文件路径) / semantic(编译失败)
|
||||
pub conflict_type: String,
|
||||
pub subtask_a: Option<String>,
|
||||
pub subtask_b: Option<String>,
|
||||
pub diff_a: Option<String>,
|
||||
pub diff_b: Option<String>,
|
||||
/// pending / a / b / merged / manual
|
||||
pub resolution: String,
|
||||
/// reviewer / user
|
||||
pub resolved_by: Option<String>,
|
||||
pub created_at: String,
|
||||
pub resolved_at: Option<String>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user