@yiyi_zhang/reactflow-ui 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,26 @@ export declare const callAICopilot: (messages: ChatMessage[], config?: Partial<A
18
18
  * 流式调用 - 通过 onToken 回调逐 token 返回内容
19
19
  */
20
20
  export declare const callAICopilotStream: (messages: ChatMessage[], config: Partial<AIServiceConfig> | undefined, onToken: (token: string) => void, onDone?: () => void, signal?: AbortSignal) => Promise<string>;
21
+ /**
22
+ * 生成任务 inputParameters 的 AI prompt(P4.1)
23
+ */
24
+ export declare const generateTaskParametersPrompt: (taskType: string, taskRef: string, workflowInputParams: string[], upstreamTasks: Array<{
25
+ ref: string;
26
+ type: string;
27
+ name: string;
28
+ }>, currentParams: Record<string, any>) => string;
29
+ /**
30
+ * System Prompt for execution analysis / fault diagnosis(P4.3)
31
+ */
32
+ export declare const EXECUTION_ANALYSIS_SYSTEM_PROMPT = "\nYou are a Netflix Conductor workflow debugging expert.\nWhen given a failed workflow execution, you analyze the task inputs, outputs, and errors to diagnose root causes.\n\nFocus on:\n1. JSONPath expressions that failed to resolve (NullPointerException, PathNotFoundException)\n2. Wrong or missing parameter fields for the task type\n3. Type mismatches between upstream output and task input\n4. Timeout and retry configuration issues\n5. HTTP error codes and what they imply about the request parameters\n\nAlways respond in Chinese. Be concise and actionable.\nIf you suggest a fix, describe specifically which task and which parameter field to change.\n";
33
+ /**
34
+ * AI 自动生成任务 inputParameters(P4.1)
35
+ */
36
+ export declare const generateTaskParameters: (taskType: string, taskRef: string, workflowInputParams: string[], upstreamTasks: Array<{
37
+ ref: string;
38
+ type: string;
39
+ name: string;
40
+ }>, currentParams: Record<string, any>, config?: Partial<AIServiceConfig>) => Promise<Record<string, any>>;
21
41
  /**
22
42
  * System Prompt for Conductor Workflow Modeling
23
43
  */
@@ -72,6 +72,27 @@ export interface TaskDef {
72
72
  timeoutSeconds?: number;
73
73
  timeoutPolicy?: 'RETRY' | 'TIME_OUT_WF' | 'ALERT_ONLY' | 'FAIL_WORKFLOW';
74
74
  }
75
+ /**
76
+ * 工作流入参定义(结构化,向后兼容 string[] 旧格式)
77
+ */
78
+ export interface WorkflowInputParam {
79
+ /** 参数名 */
80
+ name: string;
81
+ /** 参数类型 */
82
+ type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
83
+ /** 用途说明 */
84
+ description?: string;
85
+ /** 是否必填 */
86
+ required?: boolean;
87
+ /** 默认值 */
88
+ defaultValue?: any;
89
+ /** 示例值(在执行验证表单中展示) */
90
+ example?: any;
91
+ }
92
+ /**
93
+ * 解析工作流入参声明:兼容 string[] 旧格式与 WorkflowInputParam[] 新格式
94
+ */
95
+ export declare function parseWorkflowInputParams(raw: any[] | undefined): WorkflowInputParam[];
75
96
  /**
76
97
  * Conductor 工作流定义
77
98
  */
@@ -87,8 +108,8 @@ export interface WorkflowDef {
87
108
  version?: number;
88
109
  /** 任务列表 (DAG 定义) */
89
110
  tasks: TaskDef[];
90
- /** 输入参数定义 (用于文档生成) */
91
- inputParameters?: any[];
111
+ /** 输入参数定义:支持 string[](旧格式)或 WorkflowInputParam[](结构化新格式) */
112
+ inputParameters?: string[] | WorkflowInputParam[];
92
113
  /** 输出参数映射 */
93
114
  outputParameters?: Record<string, any>;
94
115
  schemaVersion?: number;
@@ -160,6 +160,15 @@ export type ThemeMode = 'dark' | 'light';
160
160
  * - `orange`: 活力橙
161
161
  */
162
162
  export type ThemeColor = 'blue' | 'orange';
163
+ /**
164
+ * 执行触发状态机
165
+ * - `idle`: 未触发
166
+ * - `triggering`: 正在调用 onTriggerExecution
167
+ * - `polling`: 已获得 workflowId,正在轮询执行结果
168
+ * - `done`: 执行到达终态(COMPLETED/FAILED/TIMED_OUT/TERMINATED)
169
+ * - `error`: 触发或轮询过程中发生错误
170
+ */
171
+ export type RunState = 'idle' | 'triggering' | 'polling' | 'done' | 'error';
163
172
  /**
164
173
  * 工作流存储状态
165
174
  */
@@ -187,6 +196,14 @@ export interface WorkflowState {
187
196
  isSimRunning: boolean;
188
197
  /** 每次 setWorkflow() 调用时递增,用于触发 WorkflowDesigner 的 fitView */
189
198
  workflowLoadKey: number;
199
+ /** P4.2 执行触发状态 */
200
+ runState: RunState;
201
+ pendingExecutionId: string | null;
202
+ executionError: string | null;
203
+ showRunPanel: boolean;
204
+ showAnalysisPanel: boolean;
205
+ /** P4.1 聚焦参数字段("去修复"跳转时使用) */
206
+ focusedParamKey: string | null;
190
207
  }
191
208
  /**
192
209
  * 工作流操作接口
@@ -228,6 +245,14 @@ export interface WorkflowActions {
228
245
  setViewMode: (viewMode: ViewMode) => void;
229
246
  startSimulation: () => void;
230
247
  stopSimulation: () => void;
248
+ /** P4.2: 显示/隐藏执行触发面板 */
249
+ setShowRunPanel: (show: boolean) => void;
250
+ /** P4.2: 显示/隐藏执行分析面板 */
251
+ setShowAnalysisPanel: (show: boolean) => void;
252
+ /** P4.2: 更新执行触发状态 */
253
+ setRunState: (state: RunState, execId?: string | null, error?: string | null) => void;
254
+ /** P4.3: 切回 edit 模式并聚焦到指定任务的指定参数字段 */
255
+ switchToEditAndFocusParam: (taskRef: string, paramKey?: string) => void;
231
256
  }
232
257
  /**
233
258
  * 重启选项
@@ -0,0 +1,32 @@
1
+ import { TaskExecutionData, ExecutionStatus } from '../types/workflow';
2
+ import { WorkflowInstance } from '../types/conductor';
3
+ export interface DiagnosticResult {
4
+ category: 'parameter' | 'timeout' | 'auth' | 'network' | 'logic';
5
+ title: string;
6
+ explanation: string;
7
+ suggestEditParam?: string;
8
+ }
9
+ export interface StepInfo {
10
+ taskRef: string;
11
+ status: ExecutionStatus;
12
+ startTime?: number;
13
+ endTime?: number;
14
+ durationMs?: number;
15
+ retryCount: number;
16
+ reasonForIncompletion?: string;
17
+ diagnostics: DiagnosticResult[];
18
+ }
19
+ export interface ExecutionSummary {
20
+ totalTasks: number;
21
+ completedTasks: number;
22
+ failedTasks: number;
23
+ skippedTasks: number;
24
+ totalDurationMs: number;
25
+ steps: StepInfo[];
26
+ hasFailed: boolean;
27
+ }
28
+ export declare function diagnoseTask(taskRef: string, executionData: Record<string, TaskExecutionData>): DiagnosticResult[];
29
+ export declare function analyzeExecution(executionData: Record<string, TaskExecutionData>, workflowInstance: WorkflowInstance | null): ExecutionSummary;
30
+ export declare function formatDuration(ms?: number): string;
31
+ export declare function getCategoryIcon(category: DiagnosticResult['category']): string;
32
+ export declare function getCategoryColor(category: DiagnosticResult['category']): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/reactflow-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Conductor Workflow IDE — a visual workflow designer built with React 19, ReactFlow and Zustand for editing, validating and monitoring Netflix Conductor workflows.",
5
5
  "keywords": [
6
6
  "conductor",