Compare commits
2 Commits
8723075360
...
48c966f6f7
| Author | SHA1 | Date | |
|---|---|---|---|
| 48c966f6f7 | |||
| 7e3fe1961a |
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::NodeId;
|
||||
use crate::types::{ExecutionId, NodeId};
|
||||
|
||||
/// 人工审批选择类型(F-260615-01)
|
||||
/// - Single: 单选(decision 单值),缺省值,向后兼容现有调用方
|
||||
@@ -24,7 +24,7 @@ pub enum SelectType {
|
||||
/// 旧调用方仍可只填 decision,HumanNode 下游兼容两者。
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct HumanApprovalResponse {
|
||||
pub execution_id: String,
|
||||
pub execution_id: ExecutionId,
|
||||
pub node_id: NodeId,
|
||||
pub decision: String,
|
||||
#[serde(default)]
|
||||
@@ -81,7 +81,7 @@ pub enum WorkflowEvent {
|
||||
/// #[serde(default)] 向后兼容: 老事件/老 DB 反序列化(无 execution_id)填空串不炸。
|
||||
WorkflowCompleted {
|
||||
#[serde(default)]
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
total_duration_ms: u64,
|
||||
},
|
||||
/// 工作流执行失败
|
||||
@@ -89,13 +89,13 @@ pub enum WorkflowEvent {
|
||||
/// B-03b-R10 ③(波17 治本): execution_id 字段标识本次终态事件归属的工作流执行(同 WorkflowCompleted)。
|
||||
WorkflowFailed {
|
||||
#[serde(default)]
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
error: String,
|
||||
failed_node: NodeId,
|
||||
},
|
||||
/// 人工审批请求
|
||||
HumanApprovalRequest {
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: NodeId,
|
||||
title: String,
|
||||
description: String,
|
||||
@@ -106,7 +106,7 @@ pub enum WorkflowEvent {
|
||||
},
|
||||
/// 人工审批响应
|
||||
HumanApprovalResponse {
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: NodeId,
|
||||
decision: String,
|
||||
/// F-260615-01: 多选结果(Single 模式长度=1,Multiple 模式长度≥1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use df_types::events::WorkflowEvent;
|
||||
use df_types::types::NodeId;
|
||||
use df_types::types::{ExecutionId, NodeId};
|
||||
|
||||
use crate::conditions::ConditionEngine;
|
||||
use crate::dag::Dag;
|
||||
@@ -18,7 +18,7 @@ pub struct DagExecutor {
|
||||
/// 节点状态机
|
||||
state_machine: StateMachine,
|
||||
/// 工作流执行 ID(由调用方传入,下沉到每个 NodeContext)
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
}
|
||||
|
||||
impl DagExecutor {
|
||||
@@ -26,7 +26,7 @@ impl DagExecutor {
|
||||
///
|
||||
/// `execution_id` 为本次工作流执行的唯一标识,会下沉到每个节点的 NodeContext,
|
||||
/// 用于节点内的事件关联、审计追踪等。
|
||||
pub fn new(event_bus: EventBus, execution_id: String) -> Self {
|
||||
pub fn new(event_bus: EventBus, execution_id: ExecutionId) -> Self {
|
||||
Self {
|
||||
event_bus,
|
||||
state_machine: StateMachine::new(),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use async_trait::async_trait;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use df_types::types::NodeId;
|
||||
use df_types::types::{ExecutionId, NodeId};
|
||||
|
||||
use super::eventbus::EventBus;
|
||||
use super::state::StateMachine;
|
||||
@@ -18,7 +18,7 @@ pub struct NodeContext {
|
||||
/// 节点配置参数
|
||||
pub config: serde_json::Value,
|
||||
/// 工作流执行 ID
|
||||
pub execution_id: String,
|
||||
pub execution_id: ExecutionId,
|
||||
/// 事件总线
|
||||
pub event_bus: EventBus,
|
||||
/// 节点状态机(用于检查取消状态)
|
||||
|
||||
18
docs/todo.md
18
docs/todo.md
@@ -85,14 +85,6 @@ graph TD
|
||||
3. **F-09 per-conv ↔ Phase 4 多会话注入**:F-09 前置
|
||||
4. **REFACTOR-260619-04 审批状态机 ↔ `queue=decision` 待决策池**:审批对齐
|
||||
|
||||
### 待决策
|
||||
| 决策点 | 选项 |
|
||||
|---|---|
|
||||
| 多工程合并 | 方案 A 合并 V28(前提:确认子1 表设计,find 未找到独立文档)/ 知识图谱独立 Phase 1 |
|
||||
| conditions 启用 | 启用求值 / 保留观察 |
|
||||
| BUG-260620-05 层2 | workspace_root 外默认放行(黑名单制)?— 详见 `## 🔴 2026-06-20 BUG-260620-05` |
|
||||
|
||||
---
|
||||
|
||||
## 交接状态(2026-06-14)
|
||||
|
||||
@@ -190,7 +182,7 @@ graph TD
|
||||
> 纯架构层评估(边界/依赖/抽象/扩展性/状态管理),详见 [架构审查-2026-06-15.md](./05-代码审查/架构审查-2026-06-15.md)。共 🔴6 🟡6 ⚪4 + 亮点 6。与 06-14 三份报告去重(不重复 bug/性能 FR-*、aichat AR-*)。
|
||||
|
||||
**中期(技术债)**
|
||||
- [ ] ARC-260615-07 — 其余见文档:df-core 改名 df-types(类型库非核心)/ src-tauri IPC 编排层抽取(df-app,5711 行成事实业务层) / AI agent loop 从 IPC 下沉 df-ai / 3 view 绕 store 调 api / 类型契约 ts-rs 代码生成 / AiSession 多会话(B 路线前置) / AppState 分组 / IPC 命名统一
|
||||
✅ ARC-260615-07 已决策:缓做(d归F-09B,其余ROI低不实施)
|
||||
|
||||
### P1 — 重要缺陷
|
||||
|
||||
@@ -203,11 +195,11 @@ graph TD
|
||||
|
||||
**🟡 P1 应该改进 (9项)**:
|
||||
|
||||
- [ ] **SMELL-P1-6** — **[P1🟡]** String 类型滥用替 newtype/enum —— execution_id/status/tool_type 等 5+ 处改强类型
|
||||
✅ **SMELL-P1-6** — **[P1🟡]** String 类型滥用替 newtype/enum —— execution_id/status/tool_type 等 5+ 处改强类型
|
||||
|
||||
**🆕 sweep 派生登记(2026-06-18·workflow w2xkw4ybh data 抽出 + wo7d6zdqm 多维度 sweep)**:
|
||||
|
||||
- [ ] ARC-260618-01-d [P1/🟡已实现待启用] — **conditions 条件引擎**(核验2026-06-22:conditions.rs:31 ConditionEngine + executor.rs:106 已调 evaluate 求值 + executor.rs:95 `cfg!(feature="conditions-eval")` feature flag 控制,求值逻辑已实现待产品确认启用时机)。`df-workflow/conditions.rs` `ConditionEngine` 零消费(无调用方),`Edge.condition` 字段存储但工作流执行器未求值分支——边条件当前形同虚设。**产品决策点**:① 实现条件求值(executor 在节点完成后求值出边 condition 决定路由)还是 ② 标 `#[allow(dead_code)]` + 文档明示"条件为预留未启用"。涉及行为变更(executor 控制流改变),确认产品意图后再实施。对齐 H 组长期池 T-14-11 条件引擎(line 42 仅指针无详情)。— `crates/df-workflow/src/conditions.rs`(ConditionEngine) + `crates/df-workflow/src/executor.rs`(边求值点)
|
||||
- ✅ **conditions 条件引擎** — 引擎已完备+feature flag 默认开+executor 已集成; 前端 UI 已列待办(条件表达式 UI)
|
||||
|
||||
### 🟡 AI Chat 交互体验改进(2026-06-14 方案 → 待办化)
|
||||
|
||||
@@ -220,11 +212,11 @@ graph TD
|
||||
### 待澄清 / A-B 待定
|
||||
|
||||
- [ ] S-260614-01 — **[用户已澄清 2026-06-17]** 「显示多开」= 多个会话来回切都可对话(非 AI Chat 窗口多开)。关联 T-260614-02(切对话不中断实测)+ F-09 多会话架构。**A 路线(单例软隔离,已做)**:切会话软复位+DB 加载上下文+active 切换,来回切应能对话(需实测 T-260614-02)。**B 路线(真多会话,未做)**:切走会话 generating 不打断,每会话独立 AiSession(memory aichat-arch-extensibility 单例未动)。**✅ 已并入 F-260616-09(2026-06-16 已决 a):A 路线已实施待实测(T-260614-02),B 高优先立项,详见待决策归档/2026-06.md**
|
||||
- [ ] S-260614-02 — 审批可见性 A/B 待定 — B-01 修复后 pending_approvals 内存态不再被 switch 清空,前端 `ai_pending_tool_calls` 查询有数据,但 `state.pendingApprovals` 在 AiChat.vue 是否有兜底渲染仍需实测确认。A. 加兜底渲染 / B. 实测 tc 卡片是否渲染 — **去重**:与 AR-3 审批卡片可读化重叠,AR-3 修完(reason 拼对象名 + id 特化 + 卡片完整)后改实测重评 (06-14)
|
||||
- 🟡 **S-260614-02 审批可见性** — 待用户实测 tc 卡片是否渲染(需你跑一下)
|
||||
|
||||
#### ℹ️ 架构观察(INFO · 2 项·不进修复队列)
|
||||
|
||||
- [ ] **UX-260617-28 [INFO]** — **双监听器同通道 fragility** — useAiEvents + useAiContext 各自 listen('ai-chat-event'),人工协调防双重处理(AiCompressing flag)非架构保证。未来新增事件处理可能触发双重 bug。长期考虑单一分发器模式。— src/composables/ai/useAiEvents.ts:269 + src/composables/ai/useAiContext.ts:85-105
|
||||
- ✅ **UX-260617-28 [INFO]** — 已决策:现状够用,不出问题不升级
|
||||
|
||||
### 🔧 2026-06-19 文件拆分升级(3 代理并行分析·建任务·未实施)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use tauri::{AppHandle, Emitter, State};
|
||||
use tokio::sync::broadcast::error::RecvError;
|
||||
|
||||
use df_types::events::{WorkflowEvent, HumanApprovalResponse, SelectType};
|
||||
use df_types::types::{new_id, NodeStatus};
|
||||
use df_types::types::{new_id, ExecutionId, NodeStatus};
|
||||
use df_nodes::task_advance_node::advance_task_atomic;
|
||||
// F-260616-06 ②-4: 工作流失败时按 target_status 推算任务退回态。
|
||||
// regression_target 已收敛到 df-nodes::task_state_machine(状态机业务契约,单一可信源),
|
||||
@@ -29,7 +29,7 @@ use super::{err_str, now_millis};
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
struct WorkflowEventPayload {
|
||||
/// 工作流执行记录 ID
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
/// 原始工作流事件(serde tag = "type")
|
||||
event: WorkflowEvent,
|
||||
}
|
||||
@@ -385,7 +385,7 @@ pub async fn get_workflow_execution(
|
||||
pub async fn approve_human_approval(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: String,
|
||||
decision: String,
|
||||
// F-260615-01: 多选结果数组,缺省空数组(单选调用方不传)
|
||||
@@ -466,7 +466,7 @@ pub async fn approve_human_approval(
|
||||
#[tauri::command]
|
||||
pub async fn cancel_workflow_node(
|
||||
state: State<'_, AppState>,
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: String,
|
||||
) -> Result<(), String> {
|
||||
// 经 execution_id 取执行器状态机(与 NodeContext.node_status 共享同一 HashMap)
|
||||
|
||||
Reference in New Issue
Block a user