新增: 并行调度+Token预算池+事件协议+前端类型+编译警告清理
- Coordinator.dispatch_with_budget: JoinSet层内并行+层间串行+预算超限降级串行 - TokenBudgetPool: AtomicU64 CAS无锁并发安全,0=不限制 - 4个新事件: AiPlanCreated/AiSubTaskStatusChanged/AiMergeCompleted/AiConflictResolved - 前端类型: PlanRecord/SubTaskRecord/ConflictRecord/PlanLayerInfo/ConflictInfo - PlanProgress.vue: 接入真实状态+persona徽章+冲突徽章+i18n - 编译警告全部清零(audit子模块allow+事件allow+record allow) - Coordinator测试27个全绿(含4个Token预算+4个并行调度)
This commit is contained in:
@@ -105,9 +105,10 @@ pub enum ErrorType {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// AI 聊天事件(推送到前端)
|
||||
/// AI 聊天事件(推送到前端)
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[allow(clippy::large_enum_variant, dead_code)]
|
||||
pub enum AiChatEvent {
|
||||
/// 流式文本片段
|
||||
AiTextDelta { delta: String, conversation_id: Option<String> },
|
||||
@@ -306,6 +307,65 @@ pub enum AiChatEvent {
|
||||
/// 灵感全量列表(list_by_query 空 query,等价 list_all)
|
||||
ideas: Vec<df_storage::models::IdeaRecord>,
|
||||
},
|
||||
/// 多 Agent 并行执行:Plan 创建(Coordinator.decompose 完成后 emit)。
|
||||
/// 前端 PlanProgress 据此展示 DAG 层结构。
|
||||
AiPlanCreated {
|
||||
plan_id: String,
|
||||
/// 按 layer 分组的子任务列表(layer 0 在前)
|
||||
layers: Vec<PlanLayerInfo>,
|
||||
conversation_id: Option<String>,
|
||||
},
|
||||
/// 多 Agent 并行执行:SubTask 状态变更。
|
||||
AiSubTaskStatusChanged {
|
||||
subtask_id: String,
|
||||
plan_id: String,
|
||||
status: String,
|
||||
persona_id: Option<String>,
|
||||
conversation_id: Option<String>,
|
||||
},
|
||||
/// 多 Agent 并行执行:Plan 合并完成。
|
||||
AiMergeCompleted {
|
||||
plan_id: String,
|
||||
/// 合并后的最终产出(前端展示为单条可展开消息)
|
||||
merged_output: String,
|
||||
/// 检测到的冲突列表(空=无冲突)
|
||||
conflicts: Vec<ConflictInfo>,
|
||||
conversation_id: Option<String>,
|
||||
},
|
||||
/// 多 Agent 并行执行:冲突已解决。
|
||||
AiConflictResolved {
|
||||
conflict_id: String,
|
||||
plan_id: String,
|
||||
resolution: String,
|
||||
resolved_by: String,
|
||||
conversation_id: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Plan 层信息(AiPlanCreated 事件的载荷)
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct PlanLayerInfo {
|
||||
/// 本层的子任务列表
|
||||
pub items: Vec<SubTaskInfo>,
|
||||
}
|
||||
|
||||
/// SubTask 信息(事件载荷)
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct SubTaskInfo {
|
||||
pub id: String,
|
||||
pub persona_id: Option<String>,
|
||||
pub intent: String,
|
||||
pub status: String,
|
||||
}
|
||||
|
||||
/// 冲突信息(AiMergeCompleted 事件的载荷)
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct ConflictInfo {
|
||||
pub id: String,
|
||||
pub file_path: String,
|
||||
pub conflict_type: String,
|
||||
pub subtask_a: Option<String>,
|
||||
pub subtask_b: Option<String>,
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user