@yiyi_zhang/reactflow-ui 0.4.0 → 1.0.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.
Files changed (66) hide show
  1. package/README.md +140 -101
  2. package/dist/AiWorkflowIDE.d.ts +219 -0
  3. package/dist/WorkflowIDE.d.ts +4 -4
  4. package/dist/ai.d.ts +34 -0
  5. package/dist/components/AICopilot/ParameterSuggester.d.ts +9 -0
  6. package/dist/components/AiNative/AgentTimeline.d.ts +23 -0
  7. package/dist/components/AiNative/AiCommandCenter.d.ts +40 -0
  8. package/dist/components/AiNative/AiConfigPanel.d.ts +9 -0
  9. package/dist/components/AiNative/BusinessCanvas.d.ts +15 -0
  10. package/dist/components/AiNative/CanvasPreview.d.ts +16 -0
  11. package/dist/components/AiNative/ClarificationCard.d.ts +9 -0
  12. package/dist/components/AiNative/FailureSummaryCard.d.ts +20 -0
  13. package/dist/components/AiNative/InlineCanvasCopilot.d.ts +7 -0
  14. package/dist/components/AiNative/LibraryPanel.d.ts +9 -0
  15. package/dist/components/AiNative/MermaidBlock.d.ts +6 -0
  16. package/dist/components/AiNative/PlanCard.d.ts +15 -0
  17. package/dist/components/AiNative/ProposalPreviewCard.d.ts +21 -0
  18. package/dist/components/AiNative/RecommendationCard.d.ts +10 -0
  19. package/dist/components/AiNative/RepairCard.d.ts +17 -0
  20. package/dist/components/AiNative/ReviewBar.d.ts +21 -0
  21. package/dist/components/AiNative/WorkflowRunCard.d.ts +14 -0
  22. package/dist/components/BrandLogo.d.ts +13 -0
  23. package/dist/components/Controls/ModeSlider.d.ts +2 -0
  24. package/dist/components/ExecutionWaterfallPanel.d.ts +3 -0
  25. package/dist/components/SandboxConfigModal.d.ts +7 -0
  26. package/dist/components/StructuredJsonViewer.d.ts +11 -0
  27. package/dist/components/nodes/NodeLayout.d.ts +3 -1
  28. package/dist/components/nodes/NodeWrapper.d.ts +2 -1
  29. package/dist/hooks/useNodeExecution.d.ts +5 -2
  30. package/dist/hooks/useNodeLayout.d.ts +1 -1
  31. package/dist/index.d.ts +5 -1
  32. package/dist/logo.svg +37 -0
  33. package/dist/product-launch.html +1400 -0
  34. package/dist/reactflow-ui-ai.es.js +21433 -0
  35. package/dist/reactflow-ui.css +1 -1
  36. package/dist/reactflow-ui.es.js +12482 -8252
  37. package/dist/reactflow-ui.umd.js +38 -20
  38. package/dist/services/ai/agentRunner.d.ts +55 -0
  39. package/dist/services/ai/contextEngine.d.ts +83 -0
  40. package/dist/services/ai/draftPersistence.d.ts +23 -0
  41. package/dist/services/ai/errorMessages.d.ts +16 -0
  42. package/dist/services/ai/intentClassifier.d.ts +17 -0
  43. package/dist/services/ai/protocolAdapter.d.ts +114 -0
  44. package/dist/services/ai/ruleEngine.d.ts +57 -0
  45. package/dist/services/ai/schemaRegistry.d.ts +51 -0
  46. package/dist/services/ai/systemPrompt.d.ts +30 -0
  47. package/dist/services/ai/toolDefs.d.ts +9 -0
  48. package/dist/services/ai/toolExecutor.d.ts +96 -0
  49. package/dist/services/ai/toolRegistry.d.ts +38 -0
  50. package/dist/services/ai/transport.d.ts +58 -0
  51. package/dist/services/ai/workflowSynthesizer.d.ts +118 -0
  52. package/dist/services/aiService.d.ts +7 -5
  53. package/dist/services/wlsp/workflowLsp.d.ts +101 -0
  54. package/dist/store/aiStore.d.ts +230 -0
  55. package/dist/store/ideStoresContext.d.ts +39 -0
  56. package/dist/store/libraryStore.d.ts +25 -0
  57. package/dist/types/aiEvents.d.ts +40 -0
  58. package/dist/types/conductor.d.ts +6 -1
  59. package/dist/types/workflow.d.ts +43 -0
  60. package/dist/types/workflowLibrary.d.ts +27 -0
  61. package/dist/utils/localSandboxEngine.d.ts +49 -0
  62. package/dist/utils/nodeMeta.d.ts +6 -0
  63. package/dist/utils/proposalPreview.d.ts +19 -0
  64. package/dist/utils/taskTypeMeta.d.ts +18 -0
  65. package/dist/utils/workflowToMermaid.d.ts +7 -0
  66. package/package.json +19 -6
@@ -7,6 +7,11 @@ import { WorkflowDef, TaskDef, WorkflowInstance, TaskInstance } from './conducto
7
7
  * - `developer`:全部节点(含数据转换等)
8
8
  */
9
9
  export type ViewMode = 'business' | 'standard' | 'developer';
10
+ /**
11
+ * `workflowExecution` prop 的公共类型(WorkflowIDE 与 AiWorkflowIDE 共用)。
12
+ * 兼容两种形态:完整 Conductor Workflow 实例,或裸的任务实例数组(旧兼容模式)。
13
+ */
14
+ export type WorkflowExecutionInput = WorkflowInstance | TaskInstance[];
10
15
  export interface WorkflowDiffRow {
11
16
  kind: 'add' | 'mod' | 'del';
12
17
  desc: string;
@@ -64,6 +69,8 @@ export interface AIChatMessage {
64
69
  diff?: WorkflowDiff;
65
70
  applied?: boolean;
66
71
  inverse?: WorkflowDiff;
72
+ /** Special card types rendered inline in the chat stream */
73
+ cardType?: 'run_card';
67
74
  }
68
75
  /**
69
76
  * 布局方向
@@ -141,6 +148,8 @@ export interface WorkflowNodeData {
141
148
  isDynamicRuntime?: boolean;
142
149
  simRunning?: boolean;
143
150
  simDone?: boolean;
151
+ /** AI diff overlay: which change category this node belongs to in the pending proposal */
152
+ proposalStatus?: 'added' | 'modified' | 'removed';
144
153
  _layoutWidth?: number;
145
154
  _layoutHeight?: number;
146
155
  }
@@ -204,6 +213,24 @@ export interface WorkflowState {
204
213
  showAnalysisPanel: boolean;
205
214
  /** P4.1 聚焦参数字段("去修复"跳转时使用) */
206
215
  focusedParamKey: string | null;
216
+ /** W-LSP: 是否在画布叠加显示数据血缘飞线 (Data Lineage DFG) */
217
+ showDataLineage: boolean;
218
+ /** W-LSP: 最近一次引用名重构提示结构 */
219
+ lastRefactorNotice: {
220
+ oldRef: string;
221
+ newRef: string;
222
+ replacedCount: number;
223
+ affectedTasks: string[];
224
+ timestamp: number;
225
+ } | null;
226
+ /** 运行态:是否显示底部并发瀑布流与时空回放面板 */
227
+ showWaterfallPanel: boolean;
228
+ /** 运行态:时空旅行回放游标时间戳 (ms),为 null 表示展示最终实时态 */
229
+ timeTravelTimestamp: number | null;
230
+ /** 运行态:每个 DO_WHILE 循环容器当前选中的迭代轮次 (loopRef -> iteration) */
231
+ activeLoopIterations: Record<string, number>;
232
+ /** AI 共驾:画布原位 Cmd+K 浮窗当前锚定的任务引用名 */
233
+ inlineCopilotTaskRef: string | null;
207
234
  }
208
235
  /**
209
236
  * 工作流操作接口
@@ -245,6 +272,8 @@ export interface WorkflowActions {
245
272
  setViewMode: (viewMode: ViewMode) => void;
246
273
  startSimulation: () => void;
247
274
  stopSimulation: () => void;
275
+ /** 短暂高亮指定节点(如 AI 提案接受后标记新增/修改的节点),到时自动恢复原选中态 */
276
+ flashNodes: (refs: string[]) => void;
248
277
  /** P4.2: 显示/隐藏执行触发面板 */
249
278
  setShowRunPanel: (show: boolean) => void;
250
279
  /** P4.2: 显示/隐藏执行分析面板 */
@@ -253,6 +282,20 @@ export interface WorkflowActions {
253
282
  setRunState: (state: RunState, execId?: string | null, error?: string | null) => void;
254
283
  /** P4.3: 切回 edit 模式并聚焦到指定任务的指定参数字段 */
255
284
  switchToEditAndFocusParam: (taskRef: string, paramKey?: string) => void;
285
+ /** W-LSP: 切换数据血缘飞线叠加显示 */
286
+ setShowDataLineage: (show: boolean) => void;
287
+ /** W-LSP: 清除重构提示文案 */
288
+ clearRefactorNotice: () => void;
289
+ /** 运行态:切换底部并发瀑布流面板 */
290
+ setShowWaterfallPanel: (show: boolean) => void;
291
+ /** 运行态:设置时空旅行时间戳 */
292
+ setTimeTravelTimestamp: (ts: number | null) => void;
293
+ /** 运行态:切换指定 DO_WHILE 循环容器的展示迭代轮次 */
294
+ setLoopIteration: (loopRef: string, iteration: number) => void;
295
+ /** AI 共驾:打开/关闭画布原位 Cmd+K 浮窗 */
296
+ setInlineCopilotTaskRef: (taskRef: string | null) => void;
297
+ /** 本地沙箱:在浏览器内执行零延迟确定性试运行并进入调试视图 */
298
+ runLocalSandboxDryRun: (mockInput?: Record<string, any>, taskMocks?: Record<string, any>, maxLoopIterations?: number) => void;
256
299
  }
257
300
  /**
258
301
  * 重启选项
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Workflow Library types — L1/L2/L3 sub-workflow catalog
3
+ *
4
+ * L1: 原子操作(单一功能,不依赖其他业务流程)
5
+ * L2: 业务场景(完整的单一业务功能,可由 L1 组合而成)
6
+ * L3: 端到端编排(跨系统复杂场景,可由 L2/L1 组合而成)
7
+ *
8
+ * 调用规则:高层可调用低层及同层,禁止反向跨层调用
9
+ * L3 → L2/L1/L3(同层) ✅
10
+ * L2 → L1/L2(同层) ✅
11
+ * L1 → L1(同层) ✅
12
+ * L1 → L2/L3 ❌
13
+ * L2 → L3 ❌
14
+ */
15
+ export type WorkflowLevel = 'L1' | 'L2' | 'L3';
16
+ /** 工作流库元数据(列表/搜索返回) */
17
+ export interface WorkflowLibraryItem {
18
+ workflowName: string;
19
+ workflowLevel: WorkflowLevel;
20
+ version: string;
21
+ description: string;
22
+ tags: string[];
23
+ }
24
+ /** 工作流库详情(包含完整 WorkflowDef) */
25
+ export interface WorkflowLibraryDetail extends WorkflowLibraryItem {
26
+ workflowDef: Record<string, any>;
27
+ }
@@ -0,0 +1,49 @@
1
+ import type { WorkflowDef, TaskDef as WorkflowTask, WorkflowInstance, TaskInstance as TaskExecution } from '../types/conductor';
2
+ export interface TaskMockOverride {
3
+ __isMockOverride?: boolean;
4
+ /** Override execution status (e.g. simulate FAILED or TIMED_OUT) */
5
+ status?: 'COMPLETED' | 'FAILED' | 'TIMED_OUT' | 'COMPLETED_WITH_ERRORS';
6
+ /** Override simulated execution duration in ms */
7
+ durationMs?: number;
8
+ /** For SWITCH / DECISION tasks: force routing to a specific case key (or '__default__') */
9
+ forceCase?: string;
10
+ /** Custom outputData JSON for this task */
11
+ outputData?: Record<string, any>;
12
+ /** Custom error message when status is FAILED / TIMED_OUT */
13
+ reasonForIncompletion?: string;
14
+ }
15
+ export interface SandboxDryRunOptions {
16
+ /** Mock workflow input JSON */
17
+ workflowInput?: Record<string, any>;
18
+ /** Custom task output or behavior overrides keyed by taskReferenceName */
19
+ taskMocks?: Record<string, Record<string, any> | TaskMockOverride>;
20
+ /** Max iterations per DO_WHILE loop in dry-run (default: 2) */
21
+ maxLoopIterations?: number;
22
+ }
23
+ interface SandboxRuntimeContext {
24
+ workflowInput: Record<string, any>;
25
+ variables: Record<string, any>;
26
+ taskOutputs: Record<string, Record<string, any>>;
27
+ taskMocks: Record<string, Record<string, any> | TaskMockOverride>;
28
+ tasks: TaskExecution[];
29
+ currentTimeMs: number;
30
+ maxLoopIterations: number;
31
+ seqCounter: number;
32
+ }
33
+ /**
34
+ * Resolve Conductor `${...}` expressions against current sandbox context
35
+ */
36
+ export declare function resolveExpressionValue(val: any, ctx: SandboxRuntimeContext): any;
37
+ /**
38
+ * Generate default synthetic output for a given task (used both at runtime and as UI template preview)
39
+ */
40
+ export declare function generateDefaultTaskOutputPreview(task: WorkflowTask, resolvedInput?: Record<string, any>, iteration?: number): Record<string, any>;
41
+ /**
42
+ * Build default mock input from workflowDef.inputParameters and auto-discovered ${workflow.input.*} references
43
+ */
44
+ export declare function buildDefaultWorkflowMockInput(workflowDef: WorkflowDef): Record<string, any>;
45
+ /**
46
+ * Execute an entire WorkflowDef in-browser deterministically and return a complete WorkflowInstance
47
+ */
48
+ export declare function executeLocalSandboxDryRun(workflowDef: WorkflowDef, options?: SandboxDryRunOptions): WorkflowInstance;
49
+ export {};
@@ -7,5 +7,11 @@ declare function truncate(s: string, max: number): string;
7
7
  * - developer: key config field for the task type
8
8
  */
9
9
  export declare function getNodeMeta(taskType: string, data: WorkflowNodeData, viewMode: ViewMode, fallback: string): string;
10
+ /**
11
+ * Returns the header label for a node based on the current viewMode.
12
+ * - business: Chinese label without the English technical suffix (e.g. "条件分支")
13
+ * - standard/developer: raw task type string (e.g. "SWITCH")
14
+ */
15
+ export declare function getNodeHeader(taskType: string, viewMode: ViewMode): string;
10
16
  /** Truncate helper exported for use in node components (e.g. DecisionNode). */
11
17
  export { truncate };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Proposal Preview — builds a business-readable step list for an AI proposal (M2.2)
3
+ *
4
+ * Merges the current canvas def with the proposed def + diff into a single ordered
5
+ * list the ProposalPreviewCard renders directly, so users can see what changed
6
+ * without opening the canvas. Removed tasks are spliced back in at their original
7
+ * position (struck through) rather than silently disappearing.
8
+ */
9
+ import type { WorkflowDef, TaskDef } from '../types/conductor';
10
+ import type { DiffSummary } from '../services/ai/toolExecutor';
11
+ export type ProposalStepStatus = 'unchanged' | 'added' | 'modified' | 'removed';
12
+ export interface ProposalStep {
13
+ ref: string;
14
+ task: TaskDef;
15
+ status: ProposalStepStatus;
16
+ /** Only present for 'modified' steps — field-level change descriptions */
17
+ changes?: string[];
18
+ }
19
+ export declare function buildProposalSteps(currentDef: WorkflowDef | null, proposedDef: WorkflowDef, diff: DiffSummary): ProposalStep[];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Task Type Meta — business-friendly labels for Conductor task types
3
+ *
4
+ * Shared by BusinessCanvas and ProposalPreviewCard so both surfaces speak the
5
+ * same business language for the same task type (extracted from BusinessCanvas
6
+ * during the UX Phase A proposal-preview work).
7
+ */
8
+ export interface TaskTypeMeta {
9
+ label: string;
10
+ icon: string;
11
+ who: string;
12
+ color: string;
13
+ }
14
+ export declare const TASK_TYPE_LABELS: Record<string, TaskTypeMeta>;
15
+ /** Looks up business-friendly metadata for a task type, falling back to the type name itself as the label. */
16
+ export declare function getTaskTypeMeta(taskType: string): TaskTypeMeta;
17
+ /** Converts a taskReferenceName (e.g. "send_email") into a human-readable name ("Send Email"). */
18
+ export declare function toBusinessName(ref: string): string;
@@ -0,0 +1,7 @@
1
+ import type { WorkflowDef } from '../types/conductor';
2
+ /**
3
+ * Generate a Mermaid flowchart from a WorkflowDef.
4
+ * Technical nodes (SET_VARIABLE, INLINE, etc.) are filtered out.
5
+ * Node labels use the task `name` field; business language is preserved.
6
+ */
7
+ export declare function workflowToMermaid(def: WorkflowDef): string;
package/package.json CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/reactflow-ui",
3
- "version": "0.4.0",
4
- "description": "Conductor Workflow IDE — a visual workflow designer built with React 19, ReactFlow and Zustand for editing, validating and monitoring Netflix Conductor workflows.",
3
+ "version": "1.0.0",
4
+ "description": "Conductor Workflow IDE — Next-Gen AI-Native visual workflow designer with W-LSP data lineage, deterministic in-browser sandbox dry-run, time-travel waterfall debugger, and live split-view sync built with React 19, ReactFlow and Zustand.",
5
5
  "keywords": [
6
6
  "conductor",
7
7
  "workflow",
8
8
  "reactflow",
9
9
  "react",
10
10
  "visual-editor",
11
- "dag"
11
+ "dag",
12
+ "ai-workflow",
13
+ "wlsp",
14
+ "sandbox"
12
15
  ],
13
16
  "license": "MIT",
14
17
  "repository": {
@@ -29,6 +32,10 @@
29
32
  "import": "./dist/reactflow-ui.es.js",
30
33
  "require": "./dist/reactflow-ui.umd.js"
31
34
  },
35
+ "./ai": {
36
+ "types": "./dist/ai.d.ts",
37
+ "import": "./dist/reactflow-ui-ai.es.js"
38
+ },
32
39
  "./style.css": "./dist/reactflow-ui.css"
33
40
  },
34
41
  "files": [
@@ -36,9 +43,13 @@
36
43
  ],
37
44
  "scripts": {
38
45
  "dev": "vite",
39
- "build": "vite build && tsc -p tsconfig.build.json",
46
+ "build": "vite build && vite build --mode ai && tsc -p tsconfig.build.json",
47
+ "build:demo": "vite build --mode demo",
40
48
  "lint": "eslint .",
41
- "preview": "vite preview"
49
+ "preview": "vite preview",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage"
42
53
  },
43
54
  "dependencies": {
44
55
  "dagre": "^0.8.5",
@@ -58,6 +69,7 @@
58
69
  "@types/react": "^19.2.5",
59
70
  "@types/react-dom": "^19.2.3",
60
71
  "@vitejs/plugin-react": "^5.1.1",
72
+ "@vitest/coverage-v8": "^4.1.9",
61
73
  "eslint": "^9.39.1",
62
74
  "eslint-plugin-react-hooks": "^7.0.1",
63
75
  "eslint-plugin-react-refresh": "^0.4.24",
@@ -66,6 +78,7 @@
66
78
  "react-dom": "^19.2.0",
67
79
  "reactflow": "^11.11.4",
68
80
  "typescript": "^5.9.3",
69
- "vite": "^7.2.4"
81
+ "vite": "^7.2.4",
82
+ "vitest": "^4.1.9"
70
83
  }
71
84
  }