@yiyi_zhang/reactflow-ui 1.0.0 → 1.1.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 (38) hide show
  1. package/README.md +28 -3
  2. package/dist/WorkflowIDE.d.ts +13 -0
  3. package/dist/actions/builtin/common.d.ts +8 -0
  4. package/dist/actions/builtin/ecs.d.ts +12 -0
  5. package/dist/actions/registry.d.ts +23 -0
  6. package/dist/actions/types.d.ts +45 -0
  7. package/dist/components/business/ActionForm.d.ts +12 -0
  8. package/dist/components/business/DataPillInput.d.ts +14 -0
  9. package/dist/components/business/DecisionBranchCard.d.ts +13 -0
  10. package/dist/components/business/ForkJoinCard.d.ts +13 -0
  11. package/dist/components/business/FriendlyErrorCard.d.ts +8 -0
  12. package/dist/components/business/LoopDoWhileCard.d.ts +13 -0
  13. package/dist/components/business/PillPicker.d.ts +11 -0
  14. package/dist/components/business/RunStoryTimeline.d.ts +9 -0
  15. package/dist/components/business/StepFlowEditor.d.ts +11 -0
  16. package/dist/components/template/TemplateExtractor.d.ts +10 -0
  17. package/dist/components/template/TemplateGallery.d.ts +10 -0
  18. package/dist/components/template/TemplateSetupWizard.d.ts +9 -0
  19. package/dist/index.d.ts +29 -0
  20. package/dist/reactflow-ui-ai.es.js +2117 -2156
  21. package/dist/reactflow-ui.css +1 -1
  22. package/dist/reactflow-ui.es.js +15685 -8305
  23. package/dist/reactflow-ui.umd.js +25 -22
  24. package/dist/sample-workflows/ecs-lifecycle-automation.json +74 -0
  25. package/dist/stepmodel/compile.d.ts +5 -0
  26. package/dist/stepmodel/decompile.d.ts +5 -0
  27. package/dist/stepmodel/types.d.ts +61 -0
  28. package/dist/template/applyTemplate.d.ts +10 -0
  29. package/dist/template/builtin/templates.d.ts +37 -0
  30. package/dist/template/sanitizer/anonymize.d.ts +5 -0
  31. package/dist/template/sanitizer/prune.d.ts +10 -0
  32. package/dist/template/sanitizer/rules.d.ts +10 -0
  33. package/dist/template/sanitizer/types.d.ts +55 -0
  34. package/dist/template/templateStore.d.ts +32 -0
  35. package/dist/template/types.d.ts +99 -0
  36. package/dist/utils/friendlyErrorTranslator.d.ts +26 -0
  37. package/package.json +1 -1
  38. package/dist/components/Controls/ModeSlider.d.ts +0 -2
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "ecs_lifecycle_automation",
3
+ "description": "云主机全生命周期自动化:自动创建实例 -> 轮询查询详情 -> 远程下发初始化运维命令 -> 创建安全快照 -> 发送协同群通知",
4
+ "version": 1,
5
+ "schemaVersion": 2,
6
+ "tasks": [
7
+ {
8
+ "name": "ecs_create_instance",
9
+ "taskReferenceName": "create_app_node",
10
+ "type": "HTTP",
11
+ "description": "创建云主机: app-server-node",
12
+ "inputParameters": {
13
+ "_actionId": "ecs.create_instance",
14
+ "actionName": "创建云主机",
15
+ "regionId": "cn-hangzhou",
16
+ "instanceType": "ecs.c7.xlarge",
17
+ "imageId": "image-alilinux-3",
18
+ "instanceName": "app-server-node",
19
+ "systemDiskSize": 120
20
+ }
21
+ },
22
+ {
23
+ "name": "ecs_query_instance",
24
+ "taskReferenceName": "query_node_status",
25
+ "type": "HTTP",
26
+ "description": "查询云主机详情与IP地址",
27
+ "inputParameters": {
28
+ "_actionId": "ecs.query_instance",
29
+ "actionName": "查询云主机详情",
30
+ "instanceId": "${create_app_node.output.instanceId}"
31
+ }
32
+ },
33
+ {
34
+ "name": "ecs_run_command",
35
+ "taskReferenceName": "init_server_env",
36
+ "type": "HTTP",
37
+ "description": "主机下发命令: 初始化运行时环境",
38
+ "inputParameters": {
39
+ "_actionId": "ecs.run_command",
40
+ "actionName": "执行远程运维脚本",
41
+ "instanceId": "${create_app_node.output.instanceId}",
42
+ "commandType": "RunShellScript",
43
+ "commandContent": "yum update -y && systemctl start docker && docker ps",
44
+ "timeoutSeconds": 60
45
+ }
46
+ },
47
+ {
48
+ "name": "ecs_create_snapshot",
49
+ "taskReferenceName": "create_backup_snapshot",
50
+ "type": "HTTP",
51
+ "description": "创建安全回滚快照",
52
+ "inputParameters": {
53
+ "_actionId": "ecs.create_snapshot",
54
+ "actionName": "创建云盘快照",
55
+ "instanceId": "${create_app_node.output.instanceId}",
56
+ "snapshotName": "init-baseline-snapshot",
57
+ "retentionDays": 14
58
+ }
59
+ },
60
+ {
61
+ "name": "send_operation_notification",
62
+ "taskReferenceName": "notify_devops_team",
63
+ "type": "EVENT",
64
+ "description": "发送协同群通知",
65
+ "inputParameters": {
66
+ "_actionId": "notify.send_message",
67
+ "actionName": "发送运维通知",
68
+ "channel": "webhook_dingtalk",
69
+ "title": "【部署就绪】新云主机已初始化并完成快照",
70
+ "content": "主机 ${create_app_node.output.instanceId} 已完成环境配置并生成基线快照,内网IP: ${query_node_status.output.privateIp}。"
71
+ }
72
+ }
73
+ ]
74
+ }
@@ -0,0 +1,5 @@
1
+ import type { WorkflowDef, TaskDef } from '../types/conductor';
2
+ import type { BusinessWorkflowModel, BusinessStep } from './types';
3
+ import { ActionRegistry } from '../actions/registry';
4
+ export declare function compileStepToTaskDef(step: BusinessStep, index: number, workflowName: string, registry?: ActionRegistry): TaskDef;
5
+ export declare function compileStepModelToWorkflowDef(model: BusinessWorkflowModel, registry?: ActionRegistry): WorkflowDef;
@@ -0,0 +1,5 @@
1
+ import type { WorkflowDef, TaskDef } from '../types/conductor';
2
+ import type { BusinessWorkflowModel, BusinessStep } from './types';
3
+ import { ActionRegistry } from '../actions/registry';
4
+ export declare function decompileTaskDefToStep(task: TaskDef, index: number, registry?: ActionRegistry): BusinessStep;
5
+ export declare function decompileWorkflowDefToStepModel(def: WorkflowDef | null | undefined, registry?: ActionRegistry): BusinessWorkflowModel;
@@ -0,0 +1,61 @@
1
+ import type { TaskDef, WorkflowDef } from '../types/conductor';
2
+ export interface PillToken {
3
+ /** The Conductor reference path, e.g. "ecs_create_0.output.instanceId" or "workflow.input.userId" */
4
+ rawRef: string;
5
+ /** Human-friendly Chinese label, e.g. "实例ID" or "用户ID" */
6
+ label: string;
7
+ /** Task or step origin label, e.g. "创建云主机" */
8
+ stepLabel?: string;
9
+ /** Optional formatting filter, e.g. "lowercase", "date" */
10
+ format?: string;
11
+ }
12
+ /**
13
+ * 控制流节点类型
14
+ */
15
+ export type StepControlType = 'decision' | 'fork' | 'loop';
16
+ /**
17
+ * 分支定义 (针对 DECISION / SWITCH)
18
+ */
19
+ export interface BranchCase {
20
+ caseKey: string;
21
+ caseLabel?: string;
22
+ steps: BusinessStep[];
23
+ }
24
+ /**
25
+ * 并行泳道 (针对 FORK_JOIN)
26
+ */
27
+ export interface ForkLane {
28
+ laneId: string;
29
+ laneLabel?: string;
30
+ steps: BusinessStep[];
31
+ }
32
+ export interface BusinessStep {
33
+ id: string;
34
+ actionId: string;
35
+ taskReferenceName: string;
36
+ name: string;
37
+ description?: string;
38
+ values: Record<string, any>;
39
+ /**
40
+ * If true, this step represents an unmapped technical Conductor task (e.g. raw JQ or custom Lambda)
41
+ * which is preserved losslessly as a read-only "Professional Step" card in business mode.
42
+ */
43
+ isProFallback?: boolean;
44
+ rawTaskDef?: TaskDef;
45
+ controlType?: StepControlType;
46
+ caseParam?: string;
47
+ caseExpression?: string;
48
+ branches?: BranchCase[];
49
+ forkLanes?: ForkLane[];
50
+ pairedJoinTaskRef?: string;
51
+ loopCondition?: string;
52
+ loopSteps?: BusinessStep[];
53
+ }
54
+ export interface BusinessWorkflowModel {
55
+ name: string;
56
+ description?: string;
57
+ version?: number;
58
+ steps: BusinessStep[];
59
+ inputParameters?: any[];
60
+ rawWorkflowDef?: WorkflowDef;
61
+ }
@@ -0,0 +1,10 @@
1
+ import type { WorkflowDef } from '../types/conductor';
2
+ import type { WorkflowTemplate } from './types';
3
+ /**
4
+ * 将用户在向导中填写的变量值注入到模板的 Conductor WorkflowDef 骨架中
5
+ *
6
+ * @param template 选中的工作流模板
7
+ * @param variableValues 用户填写的变量键值对
8
+ * @returns 注入参数后的完整 WorkflowDef
9
+ */
10
+ export declare function applyTemplateVariables(template: WorkflowTemplate, variableValues: Record<string, any>): WorkflowDef;
@@ -0,0 +1,37 @@
1
+ import type { WorkflowTemplate } from '../types';
2
+ /**
3
+ * 模板 1: 云主机自动化交付与环境配置
4
+ */
5
+ export declare const templateEcsAutoProvision: WorkflowTemplate;
6
+ /**
7
+ * 模板 2: 核心云主机每日定时快照备份
8
+ */
9
+ export declare const templateEcsDailySnapshotBackup: WorkflowTemplate;
10
+ /**
11
+ * 模板 3: 主机高负载告警与在线自动升配
12
+ */
13
+ export declare const templateEcsHighLoadAutoscale: WorkflowTemplate;
14
+ /**
15
+ * 模板 4: 生产主机一键漏洞巡检与修复
16
+ */
17
+ export declare const templateEcsVulnerabilityPatch: WorkflowTemplate;
18
+ /**
19
+ * 模板 5: 非生产环境夜间定时关机降本
20
+ */
21
+ export declare const templateEcsNightIdleShutdown: WorkflowTemplate;
22
+ /**
23
+ * 模板 6: 测试环境工作日早晨定时自动开机
24
+ */
25
+ export declare const templateEcsMorningBoot: WorkflowTemplate;
26
+ /**
27
+ * 模板 7: 磁盘容量告警与在线自动扩容
28
+ */
29
+ export declare const templateEcsDiskExpansion: WorkflowTemplate;
30
+ /**
31
+ * 模板 8: 突发入侵应急响应与快照取证
32
+ */
33
+ export declare const templateEcsEmergencyIsolation: WorkflowTemplate;
34
+ /**
35
+ * 8 个官方场景化黄金模板清单
36
+ */
37
+ export declare const BUILTIN_WORKFLOW_TEMPLATES: WorkflowTemplate[];
@@ -0,0 +1,5 @@
1
+ import type { ExtractTemplateOptions, ExtractionResult } from './types';
2
+ /**
3
+ * 从真实生产执行实例中一键萃取、脱敏并生成标准化模板骨架
4
+ */
5
+ export declare function extractTemplateFromInstance(options: ExtractTemplateOptions): ExtractionResult;
@@ -0,0 +1,10 @@
1
+ import type { WorkflowDef, WorkflowInstance } from '../../types/conductor';
2
+ import type { PruneRecommendation } from './types';
3
+ /**
4
+ * 启发式分析工作流中的冗余节点,识别边缘防御与调试任务,生成建议剪枝清单
5
+ */
6
+ export declare function analyzeTasksForPruning(def: WorkflowDef, instance?: WorkflowInstance): PruneRecommendation[];
7
+ /**
8
+ * 根据管理员勾选的剪枝清单对工作流进行骨架修剪
9
+ */
10
+ export declare function applyTaskPruning(def: WorkflowDef, prunedTaskRefs: Set<string>): WorkflowDef;
@@ -0,0 +1,10 @@
1
+ import type { WorkflowDef } from '../../types/conductor';
2
+ import type { SensitiveFinding } from './types';
3
+ /**
4
+ * 递归深度扫描一个对象的所有属性值,识别其中的敏感配置
5
+ */
6
+ export declare function scanObjectForSensitiveFindings(obj: any, taskRef: string, basePath: string, findings?: SensitiveFinding[]): SensitiveFinding[];
7
+ /**
8
+ * 扫描整个工作流定义,收集所有的敏感项
9
+ */
10
+ export declare function scanWorkflowDef(def: WorkflowDef): SensitiveFinding[];
@@ -0,0 +1,55 @@
1
+ import type { WorkflowInstance } from '../../types/conductor';
2
+ import type { WorkflowTemplate } from '../types';
3
+ /**
4
+ * 敏感识别项类别
5
+ */
6
+ export type SensitiveKind = 'credential' | 'network' | 'pii' | 'resourceId' | 'threshold';
7
+ /**
8
+ * 扫描出的敏感配置条目
9
+ */
10
+ export interface SensitiveFinding {
11
+ id: string;
12
+ kind: SensitiveKind;
13
+ path: string;
14
+ taskRef: string;
15
+ keyName: string;
16
+ rawValue: any;
17
+ maskedValue: any;
18
+ suggestedVarName?: string;
19
+ action: 'mask' | 'variable' | 'keep';
20
+ }
21
+ /**
22
+ * 拓扑剪枝建议项
23
+ */
24
+ export interface PruneRecommendation {
25
+ taskReferenceName: string;
26
+ taskName: string;
27
+ taskType: string;
28
+ reason: string;
29
+ selected: boolean;
30
+ }
31
+ /**
32
+ * 模板萃取生成结果包
33
+ */
34
+ export interface ExtractionResult {
35
+ template: WorkflowTemplate;
36
+ findings: SensitiveFinding[];
37
+ prunedTasks: PruneRecommendation[];
38
+ report: {
39
+ extractedAt: string;
40
+ totalTasksScanned: number;
41
+ sensitiveItemsCount: number;
42
+ credentialsRedactedCount: number;
43
+ variablesCreatedCount: number;
44
+ };
45
+ }
46
+ /**
47
+ * 模板提炼输入选项
48
+ */
49
+ export interface ExtractTemplateOptions {
50
+ instance: WorkflowInstance;
51
+ title?: string;
52
+ category?: WorkflowTemplate['category'];
53
+ valueProposition?: string;
54
+ author?: string;
55
+ }
@@ -0,0 +1,32 @@
1
+ import type { WorkflowTemplate, TemplateCategory } from './types';
2
+ /**
3
+ * 场景化模板仓库管理器
4
+ */
5
+ export declare class TemplateStore {
6
+ private templates;
7
+ constructor(initialTemplates?: WorkflowTemplate[]);
8
+ /**
9
+ * 注册单个工作流模板
10
+ */
11
+ register(template: WorkflowTemplate): void;
12
+ /**
13
+ * 批量注册工作流模板
14
+ */
15
+ registerAll(templates: WorkflowTemplate[]): void;
16
+ /**
17
+ * 获取所有可用模板
18
+ */
19
+ getAllTemplates(): WorkflowTemplate[];
20
+ /**
21
+ * 按 ID 查找模板
22
+ */
23
+ getTemplateById(id: string): WorkflowTemplate | undefined;
24
+ /**
25
+ * 按分类或关键词检索模板
26
+ */
27
+ search(query?: string, category?: TemplateCategory | 'all'): WorkflowTemplate[];
28
+ }
29
+ /**
30
+ * 全局默认场景化模板中心仓库(预置 8 个官方黄金模板)
31
+ */
32
+ export declare const defaultTemplateStore: TemplateStore;
@@ -0,0 +1,99 @@
1
+ import type { WorkflowDef } from '../types/conductor';
2
+ /**
3
+ * 模板分类枚举:
4
+ * - compute: 资源交付与计算管理
5
+ * - security: 安全备份与应急合规
6
+ * - cost: 资源节能与成本优化
7
+ * - ops: 日常运维与自动自愈
8
+ */
9
+ export type TemplateCategory = 'compute' | 'security' | 'cost' | 'ops';
10
+ /**
11
+ * 模板变量定义(填空向导中的表单字段)
12
+ */
13
+ export interface TemplateVariable {
14
+ /** 变量唯一键名 */
15
+ key: string;
16
+ /** 中文业务标签名称,如 "通知目标群组" */
17
+ label: string;
18
+ /** 字段辅助提示说明 */
19
+ help?: string;
20
+ /** 变量输入控件类型 */
21
+ type: 'text' | 'number' | 'select' | 'boolean' | 'account' | 'cron-friendly';
22
+ /** 默认值 */
23
+ defaultValue?: any;
24
+ /** 下拉选项 */
25
+ options?: {
26
+ label: string;
27
+ value: any;
28
+ }[];
29
+ /** 是否必填 */
30
+ required?: boolean;
31
+ /** 占位提示文案 */
32
+ placeholder?: string;
33
+ /**
34
+ * 变量注入路径列表:
35
+ * 支持通过 JSONPath 或属性链将该值灌入 WorkflowDef 中对应的任务参数,
36
+ * 例如: ["tasks[0].inputParameters.instanceName", "tasks[1].inputParameters.title"]
37
+ */
38
+ bindings: string[];
39
+ }
40
+ /**
41
+ * 模板内置的高保真拟真沙盒数据场景
42
+ */
43
+ export interface MockScenario {
44
+ /** 场景名称,如 "默认成功场景"、"高负载触发升配场景" */
45
+ name: string;
46
+ /** 场景业务说明 */
47
+ description?: string;
48
+ /** 该场景下的工作流全局入参 */
49
+ workflowInput: Record<string, any>;
50
+ /** 任务级拟真输出覆盖映射 (taskReferenceName -> outputData) */
51
+ taskOutputs?: Record<string, any>;
52
+ }
53
+ /**
54
+ * 场景化工作流模板标准模型
55
+ */
56
+ export interface WorkflowTemplate {
57
+ /** 模板唯一标识 ID */
58
+ id: string;
59
+ /** 模板版本号 */
60
+ version: string;
61
+ /** 模板中文标题,如 "核心云主机每日定时快照备份" */
62
+ title: string;
63
+ /** 所属业务分类 */
64
+ category: TemplateCategory;
65
+ /** 模板视觉图标 Emoji */
66
+ icon: string;
67
+ /** 一句话核心业务价值主张(拒绝技术罗列,讲清节省的时间与业务成效) */
68
+ valueProposition: string;
69
+ /** 详细场景背景说明 */
70
+ description: string;
71
+ /** 所需连接器图标或名称标识,如 ["cloud_host", "dingtalk"] */
72
+ connectors: string[];
73
+ /** 投资回报与提效收益指标 (ROI) */
74
+ roi: {
75
+ /** 单次执行预估节省人工分钟数 */
76
+ minutesSavedPerRun: number;
77
+ /** 典型业务每周触发频次 */
78
+ typicalRunsPerWeek: number;
79
+ /** 模板热度/累计使用次数 */
80
+ popularityCount?: number;
81
+ };
82
+ /** 上手难度等级 */
83
+ difficulty: 'starter' | 'intermediate' | 'advanced';
84
+ /** 填空式启用向导的必填变量清单 (2~4 项最佳) */
85
+ variables: TemplateVariable[];
86
+ /** 经过剪枝与参数化的标准 Conductor 工作流骨架 */
87
+ definition: WorkflowDef;
88
+ /** 拟真业务沙盒数据集(用于无需授权即可一键本地试跑体验) */
89
+ mockDataset: {
90
+ scenarios: MockScenario[];
91
+ };
92
+ /** 模板溯源与发布审计信息 */
93
+ provenance?: {
94
+ source: 'official' | 'extracted';
95
+ author?: string;
96
+ publishedAt?: string;
97
+ extractedFromWorkflowId?: string;
98
+ };
99
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 生活化错误诊断结构
3
+ */
4
+ export interface FriendlyErrorDiagnosis {
5
+ /** 错误分类类型 */
6
+ type: 'auth' | 'timeout' | 'missing_data' | 'quota' | 'script_fail' | 'network' | 'unknown';
7
+ /** 大白话标题 */
8
+ title: string;
9
+ /** 通俗易懂的业务原因解释(普通人能看懂) */
10
+ explanation: string;
11
+ /** 系统给出的可行动建议方案 */
12
+ suggestion: string;
13
+ /** 一键快捷恢复动作文案(可选) */
14
+ actionLabel?: string;
15
+ /** 快捷动作标识(可选) */
16
+ actionKey?: 'reauth' | 'retry' | 'inspect_upstream' | 'change_spec' | 'contact_admin';
17
+ }
18
+ /**
19
+ * 将技术错误日志、HTTP 状态码或调用栈翻译为普通业务人员可理解的生活化诊断
20
+ *
21
+ * @param errorMessage 底层技术报错信息或异常原因 (reasonForIncompletion)
22
+ * @param statusCode HTTP 响应状态码 (可选)
23
+ * @param taskName 任务名称 (可选)
24
+ * @returns 业务化诊断卡片数据
25
+ */
26
+ export declare function translateTechnicalError(errorMessage?: string, statusCode?: number, taskName?: string): FriendlyErrorDiagnosis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/reactflow-ui",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
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",
@@ -1,2 +0,0 @@
1
- import './ModeSlider.css';
2
- export default function ModeSlider(): import("react/jsx-runtime").JSX.Element;