@yiyi_zhang/reactflow-ui 1.1.0 → 1.3.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 (91) hide show
  1. package/dist/AiWorkflowIDE.d.ts +28 -0
  2. package/dist/WorkflowIDE.d.ts +30 -0
  3. package/dist/actions/fromDefinitions.d.ts +70 -0
  4. package/dist/actions/registry.d.ts +1 -0
  5. package/dist/actions/types.d.ts +26 -0
  6. package/dist/ai.d.ts +25 -0
  7. package/dist/components/AiNative/AiCommandCenter.d.ts +4 -0
  8. package/dist/components/business/ActionPickerModal.d.ts +25 -0
  9. package/dist/components/business/DataPillInput.d.ts +2 -0
  10. package/dist/components/business/DecisionBranchCard.d.ts +2 -0
  11. package/dist/components/business/ForkJoinCard.d.ts +2 -0
  12. package/dist/components/business/LibraryVersionBadge.d.ts +29 -0
  13. package/dist/components/business/LoopDoWhileCard.d.ts +2 -0
  14. package/dist/components/business/NestedControlStep.d.ts +22 -0
  15. package/dist/components/business/StepFlowEditor.d.ts +15 -0
  16. package/dist/components/business/StepListEditor.d.ts +29 -0
  17. package/dist/components/import/ApiImportDialog.d.ts +27 -0
  18. package/dist/components/onboarding/ModalShell.d.ts +15 -0
  19. package/dist/components/onboarding/OnboardingController.d.ts +67 -0
  20. package/dist/components/onboarding/OnboardingGuideCard.d.ts +10 -0
  21. package/dist/components/onboarding/OnboardingWizard.d.ts +42 -0
  22. package/dist/components/onboarding/PromotionPanel.d.ts +20 -0
  23. package/dist/components/onboarding/WorkflowNameBuilder.d.ts +19 -0
  24. package/dist/components/onboarding/index.d.ts +8 -0
  25. package/dist/components/onboarding/styles.d.ts +11 -0
  26. package/dist/components/onboarding/useOnboardingData.d.ts +17 -0
  27. package/dist/components/template/TemplateGallery.d.ts +2 -0
  28. package/dist/components/template/TemplateSetupWizard.d.ts +2 -0
  29. package/dist/import/buildAction.d.ts +23 -0
  30. package/dist/import/common.d.ts +17 -0
  31. package/dist/import/curl.d.ts +12 -0
  32. package/dist/import/detect.d.ts +9 -0
  33. package/dist/import/index.d.ts +10 -0
  34. package/dist/import/insert.d.ts +16 -0
  35. package/dist/import/openapi.d.ts +9 -0
  36. package/dist/import/postman.d.ts +9 -0
  37. package/dist/import/schema.d.ts +15 -0
  38. package/dist/import/sensitive.d.ts +18 -0
  39. package/dist/import/types.d.ts +62 -0
  40. package/dist/import/util.d.ts +23 -0
  41. package/dist/index.d.ts +23 -1
  42. package/dist/library/catalog.d.ts +93 -0
  43. package/dist/library/conductorProvider.d.ts +41 -0
  44. package/dist/library/diff.d.ts +62 -0
  45. package/dist/library/index.d.ts +16 -0
  46. package/dist/library/level.d.ts +6 -0
  47. package/dist/library/naming.d.ts +28 -0
  48. package/dist/library/projections.d.ts +53 -0
  49. package/dist/library/types.d.ts +58 -0
  50. package/dist/library/useLibraryCatalog.d.ts +9 -0
  51. package/dist/library/version.d.ts +17 -0
  52. package/dist/library/versionStatus.d.ts +44 -0
  53. package/dist/onboarding/index.d.ts +6 -0
  54. package/dist/onboarding/naming.d.ts +41 -0
  55. package/dist/onboarding/poll.d.ts +39 -0
  56. package/dist/onboarding/wizardState.d.ts +44 -0
  57. package/dist/product-launch.html +3 -3
  58. package/dist/providers/WorkflowIdeProvider.d.ts +23 -0
  59. package/dist/providers/resolve.d.ts +20 -0
  60. package/dist/providers/types.d.ts +65 -0
  61. package/dist/reactflow-ui-ai.es.js +18748 -10262
  62. package/dist/reactflow-ui.css +1 -1
  63. package/dist/reactflow-ui.es.js +12741 -8916
  64. package/dist/reactflow-ui.umd.js +38 -23
  65. package/dist/sample-imports/cmdb-openapi3.json +334 -0
  66. package/dist/sample-imports/cmdb-postman.json +100 -0
  67. package/dist/sample-imports/ticket-swagger2.json +231 -0
  68. package/dist/sample-workflows/library-capabilities-demo.json +66 -0
  69. package/dist/services/ai/agentRunner.d.ts +11 -0
  70. package/dist/services/ai/schemaRegistry.d.ts +7 -1
  71. package/dist/services/ai/systemPrompt.d.ts +11 -0
  72. package/dist/services/ai/toolExecutor.d.ts +12 -0
  73. package/dist/services/ai/workflowSynthesizer.d.ts +28 -3
  74. package/dist/stepmodel/compile.d.ts +6 -0
  75. package/dist/stepmodel/decompile.d.ts +5 -0
  76. package/dist/stepmodel/factory.d.ts +8 -0
  77. package/dist/stepmodel/types.d.ts +3 -0
  78. package/dist/store/ideStoresContext.d.ts +3 -0
  79. package/dist/store/sandboxRunObserver.d.ts +19 -0
  80. package/dist/store/workflowStore.d.ts +1 -0
  81. package/dist/telemetry/buffer.d.ts +37 -0
  82. package/dist/telemetry/once.d.ts +11 -0
  83. package/dist/telemetry/track.d.ts +17 -0
  84. package/dist/telemetry/types.d.ts +24 -0
  85. package/dist/telemetry/useTelemetry.d.ts +22 -0
  86. package/dist/types/conductor.d.ts +13 -8
  87. package/dist/types/workflow.d.ts +9 -0
  88. package/dist/types/workflowLibrary.d.ts +2 -0
  89. package/dist/utils/taskTypeMeta.d.ts +3 -3
  90. package/package.json +1 -1
  91. package/dist/components/AiNative/BusinessCanvas.d.ts +0 -15
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "custom-L2-应用管理-demo-library_showcase",
3
+ "description": "流程库能力演示:引用治理服务中的库能力并固定版本。含「有新版本」、「版本不可用」(已撤回 / 已下线)与当前版本四种状态。",
4
+ "version": 1,
5
+ "schemaVersion": 2,
6
+ "ownerEmail": "platform-governance@example.com",
7
+ "tasks": [
8
+ {
9
+ "name": "std-L1-配置管理-cmdb-query_ci",
10
+ "taskReferenceName": "query_ci",
11
+ "type": "SUB_WORKFLOW",
12
+ "description": "查询配置项(固定 v1,库已有 v2:新增必填「租户编号」、删除出参「耗时」)",
13
+ "inputParameters": {
14
+ "ciType": "服务器",
15
+ "keyword": "order",
16
+ "pageSize": 20
17
+ },
18
+ "subWorkflowParam": {
19
+ "name": "std-L1-配置管理-cmdb-query_ci",
20
+ "version": 1
21
+ }
22
+ },
23
+ {
24
+ "name": "std-L1-云资源-ecs-snapshot",
25
+ "taskReferenceName": "snapshot_vm",
26
+ "type": "SUB_WORKFLOW",
27
+ "description": "云主机快照(固定 v1,该版本已被治理服务撤回)",
28
+ "inputParameters": {
29
+ "instanceId": "i-demo0001"
30
+ },
31
+ "subWorkflowParam": {
32
+ "name": "std-L1-云资源-ecs-snapshot",
33
+ "version": 1
34
+ }
35
+ },
36
+ {
37
+ "name": "std-L1-系统工具-sftp-upload_file",
38
+ "taskReferenceName": "upload_pkg",
39
+ "type": "SUB_WORKFLOW",
40
+ "description": "SFTP 上传文件(该能力已下线)",
41
+ "inputParameters": {
42
+ "host": "10.20.30.41",
43
+ "remotePath": "/data/upload",
44
+ "fileUrl": "http://mock-gateway.internal/files/demo.tar.gz"
45
+ },
46
+ "subWorkflowParam": {
47
+ "name": "std-L1-系统工具-sftp-upload_file",
48
+ "version": 1
49
+ }
50
+ },
51
+ {
52
+ "name": "std-L1-通知协助-msg-send_sms",
53
+ "taskReferenceName": "notify_owner",
54
+ "type": "SUB_WORKFLOW",
55
+ "description": "发送短信(固定 v2,即当前最新版本)",
56
+ "inputParameters": {
57
+ "phone": "13800000001",
58
+ "content": "配置项查询完成,共 ${query_ci.output.total} 条,耗时 ${query_ci.output.costMs} 毫秒"
59
+ },
60
+ "subWorkflowParam": {
61
+ "name": "std-L1-通知协助-msg-send_sms",
62
+ "version": 2
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { AiStore } from '../../store/aiStore';
17
17
  import type { LibraryStore } from '../../store/libraryStore';
18
+ import type { LibraryCatalog } from '../../library/catalog';
18
19
  import type { ToolRegistry } from './toolRegistry';
19
20
  import type { AiEvent } from '../../types/aiEvents';
20
21
  import type { UseBoundStore, StoreApi } from 'zustand';
@@ -26,11 +27,17 @@ export interface AgentRunnerOptions {
26
27
  canRepair?: boolean;
27
28
  };
28
29
  onAiEvent?: (event: AiEvent) => void;
30
+ /** 流程库目录注入系统提示词的条数上限(缺省 50);超出部分提示 AI 改用 search_workflow_library */
31
+ promptCatalogLimit?: number;
32
+ /** 任务 Schema 注入系统提示词的条数上限(缺省不限制) */
33
+ promptSchemaLimit?: number;
29
34
  }
30
35
  export interface AgentRunnerStores {
31
36
  aiStore: UseBoundStore<StoreApi<AiStore>>;
32
37
  libraryStore: UseBoundStore<StoreApi<LibraryStore>>;
33
38
  toolRegistry: ToolRegistry;
39
+ /** 本 IDE 实例的流程库目录;提供后用于固定子工作流版本与服务端检索 */
40
+ libraryCatalog?: LibraryCatalog;
34
41
  }
35
42
  export declare class AgentRunner {
36
43
  private getOptions;
@@ -39,7 +46,11 @@ export declare class AgentRunner {
39
46
  constructor(getOptions: () => AgentRunnerOptions, stores: AgentRunnerStores);
40
47
  abort(): void;
41
48
  private toolExecutionContext;
49
+ /** 子工作流版本固定:把目录里的「当前最新版本」以查询函数的形式注入纯函数的工具执行层 */
50
+ private latestVersionResolver;
42
51
  private buildHistory;
52
+ /** 服务端检索:Provider 没有 search、或检索失败时返回 undefined(调用方退回本地匹配) */
53
+ private serverLibrarySearch;
43
54
  /**
44
55
  * Immediately promotes the current in-progress `workingDraft` (from an interrupted or paused
45
56
  * multi-phase session) into a reviewable `pendingProposal`.
@@ -45,7 +45,13 @@ declare class SchemaRegistry {
45
45
  get(taskName: string): TaskSchema | undefined;
46
46
  getAll(): TaskSchema[];
47
47
  hasSchemas(): boolean;
48
- buildPromptSection(): string | null;
48
+ /**
49
+ * @param options.limit 最多注入的 Schema 条数(缺省不限制)。目录很大时用来控制提示词体积,
50
+ * 超出部分提示改用 search_workflow_library 检索。
51
+ */
52
+ buildPromptSection(options?: {
53
+ limit?: number;
54
+ }): string | null;
49
55
  }
50
56
  export declare const schemaRegistry: SchemaRegistry;
51
57
  export {};
@@ -27,4 +27,15 @@ export declare function buildSystemPrompt(userInput: string, workflowSnapshot: W
27
27
  systemPromptExtra?: string;
28
28
  viewMode?: ViewMode;
29
29
  pendingProposalDef?: import('../../types/conductor').WorkflowDef;
30
+ /** 流程库目录注入提示词的条数上限,默认 DEFAULT_PROMPT_CATALOG_LIMIT;超出部分提示改用 search_workflow_library */
31
+ promptCatalogLimit?: number;
32
+ /** 任务 Schema 注入提示词的条数上限;缺省不限制(保持旧行为) */
33
+ promptSchemaLimit?: number;
30
34
  }): string;
35
+ /** 目录注入提示词的默认条数上限(治理平台可能有 1000+ 工作流,不能全量塞进提示词) */
36
+ export declare const DEFAULT_PROMPT_CATALOG_LIMIT = 50;
37
+ /**
38
+ * 构建流程库目录段落。
39
+ * 超过 limit 时按层级 L3 -> L2 -> L1 截断(高层场景优先),并写明剩余数量与检索指引。
40
+ */
41
+ export declare function buildLibraryCatalog(allItems: WorkflowLibraryItem[], limit?: number): string | null;
@@ -84,7 +84,19 @@ export interface ToolExecutionContext {
84
84
  workingDraft?: WorkflowDef | null;
85
85
  validationResults: ValidationResults;
86
86
  libraryItems: WorkflowLibraryItem[];
87
+ /**
88
+ * 查询流程库中某个名称的当前最新版本(由调用方注入,本模块保持纯净、不读 store)。
89
+ * 提供后,AI 新建的 SUB_WORKFLOW 缺少版本时固定为库当前版本;已有版本号一律不改。
90
+ */
91
+ resolveLatestVersion?: (name: string) => number | undefined;
92
+ /**
93
+ * 服务端检索命中(由调用方在调用前预取,通常来自 LibraryProvider.search)。
94
+ * 提供时 search_workflow_library 直接展示这些结果,不再在 libraryItems 内本地匹配。
95
+ */
96
+ librarySearchResults?: WorkflowLibraryItem[];
87
97
  }
98
+ /** 工作流库检索结果最多展示的条数(目录可能有上千项,避免一次塞满上下文) */
99
+ export declare const LIBRARY_SEARCH_RESULT_LIMIT = 50;
88
100
  export declare function applyPatch(def: WorkflowDef, ops: PatchOp[]): WorkflowDef;
89
101
  export declare function computeDiff(before: WorkflowDef | null, after: WorkflowDef): DiffSummary;
90
102
  export declare function executeToolCall(toolName: string, args: Record<string, any>, ctx: ToolExecutionContext): ToolCallResult;
@@ -66,6 +66,21 @@ export interface VerificationSummary {
66
66
  * Collects all tasks in execution order (pre-order traversal of top-level and nested tasks).
67
67
  */
68
68
  export declare function collectAllTasksInOrder(tasks?: TaskDef[]): TaskDef[];
69
+ /**
70
+ * 规范化选项(均为可选,保持本模块为纯函数:数据由调用方注入,不读取任何 store)。
71
+ */
72
+ export interface NormalizeOptions {
73
+ /**
74
+ * 查询工作流库中某个名称的当前最新版本。提供后,新建的 SUB_WORKFLOW 若没有
75
+ * `subWorkflowParam.version`,会固定为库当前版本;已有版本号一律不改。
76
+ */
77
+ resolveLatestVersion?: (name: string) => number | undefined;
78
+ /**
79
+ * 画布上已存在的任务引用名。这些任务不会被自动补版本——
80
+ * 未固定版本的旧步骤保持原语义,避免 AI 改动其它内容时顺带改变它们。
81
+ */
82
+ existingRefs?: ReadonlySet<string>;
83
+ }
69
84
  /**
70
85
  * Normalizes a single task's structure to prevent common LLM schema mismatches:
71
86
  * - Ensures `name` and `taskReferenceName` and `type` exist
@@ -73,7 +88,7 @@ export declare function collectAllTasksInOrder(tasks?: TaskDef[]): TaskDef[];
73
88
  * - Normalizes `SUB_WORKFLOW` `workflowName` into `subWorkflowParam.name`
74
89
  * - Normalizes `TERMINATE` `terminationStatus` into `inputParameters.terminationStatus`
75
90
  */
76
- export declare function normalizeTaskDef(task: TaskDef, autoFixed?: string[]): TaskDef;
91
+ export declare function normalizeTaskDef(task: TaskDef, autoFixed?: string[], options?: NormalizeOptions): TaskDef;
77
92
  /**
78
93
  * Extracts all `${...}` expressions from an arbitrary JSON value.
79
94
  */
@@ -84,7 +99,17 @@ export declare function extractExpressions(value: any): string[];
84
99
  * - Normalizes all tasks and FORK_JOIN <-> JOIN pairings
85
100
  * - Auto-collects `${workflow.input.xxx}` into `workflow.inputParameters` if missing
86
101
  */
87
- export declare function normalizeWorkflowDef(def: WorkflowDef): {
102
+ export declare function normalizeWorkflowDef(def: WorkflowDef, options?: NormalizeOptions): {
103
+ workflow: WorkflowDef;
104
+ autoFixed: string[];
105
+ };
106
+ /**
107
+ * 只做「SUB_WORKFLOW 固定版本」的轻量规范化(供 replace_workflow / patch_workflow 使用,
108
+ * 这两条路径不经过完整的 normalizeWorkflowDef):
109
+ * 为新建的、未记录版本的子工作流任务填入流程库当前版本。已有版本号、画布上已存在的任务一律不改。
110
+ * 未提供 resolveLatestVersion 时原样返回。
111
+ */
112
+ export declare function pinSubWorkflowVersions(def: WorkflowDef, options: NormalizeOptions): {
88
113
  workflow: WorkflowDef;
89
114
  autoFixed: string[];
90
115
  };
@@ -102,7 +127,7 @@ export declare function applyTopologyScaffold(currentDraft: WorkflowDef | null,
102
127
  /**
103
128
  * Phase 3: Enriches individual tasks in the working draft with detailed configurations.
104
129
  */
105
- export declare function applyTaskConfigurations(currentDraft: WorkflowDef, args: ConfigureTasksArgs): {
130
+ export declare function applyTaskConfigurations(currentDraft: WorkflowDef, args: ConfigureTasksArgs, options?: NormalizeOptions): {
106
131
  workflow: WorkflowDef;
107
132
  configuredRefs: string[];
108
133
  missingRefs: string[];
@@ -2,4 +2,10 @@ import type { WorkflowDef, TaskDef } from '../types/conductor';
2
2
  import type { BusinessWorkflowModel, BusinessStep } from './types';
3
3
  import { ActionRegistry } from '../actions/registry';
4
4
  export declare function compileStepToTaskDef(step: BusinessStep, index: number, workflowName: string, registry?: ActionRegistry): TaskDef;
5
+ /**
6
+ * 编译一组顺序步骤(顶层、分支内、泳道内、循环体内通用,可任意层级嵌套)。
7
+ * 遇到 FORK_JOIN 时,会在其后自动补全配对的 JOIN 节点,
8
+ * joinOn 取各泳道编译后的最后一个任务(若泳道末尾是嵌套并行,则为其 JOIN)。
9
+ */
10
+ export declare function compileStepList(steps: BusinessStep[], workflowName: string, registry?: ActionRegistry): TaskDef[];
5
11
  export declare function compileStepModelToWorkflowDef(model: BusinessWorkflowModel, registry?: ActionRegistry): WorkflowDef;
@@ -2,4 +2,9 @@ import type { WorkflowDef, TaskDef } from '../types/conductor';
2
2
  import type { BusinessWorkflowModel, BusinessStep } from './types';
3
3
  import { ActionRegistry } from '../actions/registry';
4
4
  export declare function decompileTaskDefToStep(task: TaskDef, index: number, registry?: ActionRegistry): BusinessStep;
5
+ /**
6
+ * 反编译一组顺序任务(顶层、分支内、泳道内、循环体内通用,可任意层级嵌套)。
7
+ * FORK_JOIN 后配对的 JOIN 节点会被折叠进并行组(记录在 pairedJoinTaskRef),不单独成步。
8
+ */
9
+ export declare function decompileTaskList(tasks: TaskDef[], registry?: ActionRegistry): BusinessStep[];
5
10
  export declare function decompileWorkflowDefToStepModel(def: WorkflowDef | null | undefined, registry?: ActionRegistry): BusinessWorkflowModel;
@@ -0,0 +1,8 @@
1
+ import type { ActionDefinition } from '../actions/types';
2
+ import type { BusinessStep } from './types';
3
+ /**
4
+ * 根据动作定义创建一个新的业务步骤。
5
+ * 控制流动作(分支 / 并行 / 循环)会生成带 controlType 的容器步骤,
6
+ * 因此可以在任意层级(顶层、分支内、泳道内、循环体内)递归嵌套。
7
+ */
8
+ export declare function createStepFromAction(action: ActionDefinition): BusinessStep;
@@ -1,4 +1,5 @@
1
1
  import type { TaskDef, WorkflowDef } from '../types/conductor';
2
+ import type { LibraryRef } from '../actions/types';
2
3
  export interface PillToken {
3
4
  /** The Conductor reference path, e.g. "ecs_create_0.output.instanceId" or "workflow.input.userId" */
4
5
  rawRef: string;
@@ -42,6 +43,8 @@ export interface BusinessStep {
42
43
  */
43
44
  isProFallback?: boolean;
44
45
  rawTaskDef?: TaskDef;
46
+ /** 引用流程库能力时记录的名称与版本(首次引用时固定,不随库升级自动变化) */
47
+ libraryRef?: LibraryRef;
45
48
  controlType?: StepControlType;
46
49
  caseParam?: string;
47
50
  caseExpression?: string;
@@ -20,10 +20,13 @@ import type { UseBoundStore, StoreApi } from 'zustand';
20
20
  import type { AiStore } from './aiStore';
21
21
  import type { LibraryStore } from './libraryStore';
22
22
  import type { ToolRegistry } from '../services/ai/toolRegistry';
23
+ import type { LibraryCatalog } from '../library/catalog';
23
24
  export interface IdeStores {
24
25
  aiStore: UseBoundStore<StoreApi<AiStore>>;
25
26
  libraryStore: UseBoundStore<StoreApi<LibraryStore>>;
26
27
  toolRegistry: ToolRegistry;
28
+ /** 本实例的流程库目录(LibraryProvider 规范化后的单一数据源);每个实例独立,不是全局单例 */
29
+ libraryCatalog?: LibraryCatalog;
27
30
  }
28
31
  export declare function IdeStoresProvider({ stores, children }: {
29
32
  stores: IdeStores;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * store 动作的观察者(专业模式埋点用)。
3
+ *
4
+ * - 试跑:专业模式的本地试跑统一经过 store 的 `runLocalSandboxDryRun`(ActionBar 一键试跑与
5
+ * SandboxConfigModal 都走它),在那里通知即可,不必在每个入口各自埋点。只传最终状态(或 'error'),
6
+ * 不传输入 / 输出数据。业务模式(StepFlowEditor)与模板试跑不经过该 action,由各自的回调上报,因此不会重复。
7
+ * - 新增步骤:画布「+」与 Cmd+K 内联 Copilot 都经过 store 的 `addNode`,来源固定为 'builtin'。
8
+ *
9
+ * 模块级集合:IDE 挂载时订阅、卸载时取消。store 本身是页面内单例,同一页面挂载多个 IDE 时各自都会收到通知。
10
+ */
11
+ export type SandboxRunObserver = (result: string) => void;
12
+ export type StepAddedObserver = (source: 'builtin') => void;
13
+ /** 订阅试跑结果;返回取消订阅函数 */
14
+ export declare function subscribeSandboxRun(observer: SandboxRunObserver): () => void;
15
+ /** 通知试跑结果;观察者抛错不影响试跑 */
16
+ export declare function notifySandboxRun(result: string): void;
17
+ /** 订阅专业模式新增步骤;返回取消订阅函数 */
18
+ export declare function subscribeStepAdded(observer: StepAddedObserver): () => void;
19
+ export declare function notifyStepAdded(source: 'builtin'): void;
@@ -17,6 +17,7 @@ declare const useWorkflowStore: import("zustand").UseBoundStore<Omit<Omit<import
17
17
  workflowDef: WorkflowDef | null;
18
18
  layoutDirection: LayoutDirection;
19
19
  nodes: import("../types/workflow").WorkflowNode[];
20
+ graphStale: boolean;
20
21
  edges: import("reactflow").Edge[];
21
22
  taskMap: Record<string, TaskDef>;
22
23
  theme: ThemeMode;
@@ -0,0 +1,37 @@
1
+ import type { IdeEvent, TelemetrySink } from './types';
2
+ /** 定时器注入点(测试用);默认使用全局 setTimeout / clearTimeout */
3
+ export interface TelemetryTimers {
4
+ set(fn: () => void, ms: number): unknown;
5
+ clear(handle: unknown): void;
6
+ }
7
+ /** 最小事件目标接口(document / window 或测试替身) */
8
+ export interface TelemetryEventTarget {
9
+ addEventListener(type: string, listener: () => void): void;
10
+ removeEventListener(type: string, listener: () => void): void;
11
+ }
12
+ export interface TelemetryBufferOptions {
13
+ /** 距第一条待发送事件多久后 flush。默认 5000 */
14
+ flushIntervalMs?: number;
15
+ /** 累计多少条立即 flush。默认 20 */
16
+ maxBatchSize?: number;
17
+ timers?: TelemetryTimers;
18
+ /** 监听 `visibilitychange`(读取 visibilityState);默认取全局 document,非浏览器环境忽略 */
19
+ document?: (TelemetryEventTarget & {
20
+ visibilityState?: string;
21
+ }) | null;
22
+ /** 监听 `pagehide`;默认取全局 window,非浏览器环境忽略 */
23
+ window?: TelemetryEventTarget | null;
24
+ }
25
+ export interface TelemetryBuffer {
26
+ /** 入队;sink 缺失时丢弃。永不抛出 */
27
+ push(event: IdeEvent): void;
28
+ /** 立即发送队列中的事件。永不抛出 */
29
+ flush(): void;
30
+ /** flush 并移除定时器与页面监听;之后 push 无效 */
31
+ dispose(): void;
32
+ }
33
+ /**
34
+ * 创建埋点缓冲:批量发送、页面隐藏时 flush、吞掉 sink 的任何错误(只 warn 一次)。
35
+ * sink 为空时 push 直接丢弃,不产生定时器与监听。
36
+ */
37
+ export declare function createTelemetryBuffer(sink: TelemetrySink | undefined | null, opts?: TelemetryBufferOptions): TelemetryBuffer;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 「每个实例只执行一次」的守卫,用于 `ide_opened` 去重。
3
+ *
4
+ * React StrictMode(开发环境)会把 effect 执行 → 清理 → 再执行一次,但 `useRef` 的值在两次之间保留,
5
+ * 所以把守卫放在 ref 里即可保证同一个 IDE 实例只上报一次;真正重新挂载(新实例)会得到新的守卫。
6
+ */
7
+ export interface OnceGuard {
8
+ /** 第一次调用返回 true,之后都返回 false */
9
+ take(): boolean;
10
+ }
11
+ export declare function createOnceGuard(): OnceGuard;
@@ -0,0 +1,17 @@
1
+ import type { IdeEvent, IdeEventName } from './types';
2
+ export type IdeEventProps = Record<string, string | number | boolean>;
3
+ /**
4
+ * 只保留 string / number(有限)/ boolean 的属性值,其余(对象、数组、函数、null、undefined、NaN)一律丢弃,
5
+ * 避免上层误把参数、表达式等载荷塞进埋点。全部被丢弃时返回 undefined。
6
+ */
7
+ export declare function sanitizeProps(props: Record<string, unknown> | undefined | null): IdeEventProps | undefined;
8
+ export interface TrackerOptions {
9
+ ide: 'workflow' | 'ai';
10
+ /** 返回当前流程名;每次 track 时调用 */
11
+ getWorkflowName: () => string | undefined;
12
+ /** 事件发往的缓冲;返回 undefined 表示没有 sink */
13
+ push: (event: IdeEvent) => void;
14
+ now?: () => number;
15
+ }
16
+ /** 构造事件并交给 push:补齐 at / ide / workflowName,清洗 props。永不抛出。 */
17
+ export declare function createTracker(opts: TrackerOptions): (name: IdeEventName, props?: Record<string, unknown>) => void;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 接入埋点:事件与 Sink 契约(设计见 docs/design/v1.3.0-自助接入设计.md 第 5 节)。
3
+ *
4
+ * 只采集「用了什么功能」,不采集参数值、表达式、提示词、对话内容、执行数据。
5
+ */
6
+ /**
7
+ * 事件名清单(首批,与设计文档 5.2 节、接入指南「接入埋点」表一致;
8
+ * 单测会校验三处同步,新增事件时请一并更新文档)。
9
+ */
10
+ export declare const IDE_EVENT_NAMES: readonly ["ide_opened", "trial_started", "workflow_created", "step_added", "api_imported", "sandbox_run", "workflow_saved", "promotion_requested", "promotion_state", "ai_event"];
11
+ export type IdeEventName = typeof IDE_EVENT_NAMES[number];
12
+ export interface IdeEvent {
13
+ name: IdeEventName;
14
+ /** epoch ms */
15
+ at: number;
16
+ ide: 'workflow' | 'ai';
17
+ /** 不含任何参数值 */
18
+ workflowName?: string;
19
+ props?: Record<string, string | number | boolean>;
20
+ }
21
+ export interface TelemetrySink {
22
+ /** SDK 侧批量调用(默认 5 秒或 20 条),页面隐藏时强制 flush */
23
+ track(events: IdeEvent[]): void | Promise<void>;
24
+ }
@@ -0,0 +1,22 @@
1
+ import type { IdeEventName, TelemetrySink } from './types';
2
+ /**
3
+ * IDE 内部使用:按解析后的 sink 维护一个缓冲,返回稳定的 `track(name, props?)`。
4
+ * - `at` / `ide` / `workflowName`(取当前画布流程名)自动补齐;
5
+ * - `props` 只保留 string / number / boolean;
6
+ * - sink 变化时先把旧缓冲 flush 给旧 sink;卸载时 flush;
7
+ * - 没有 sink 时 track 为空操作。
8
+ */
9
+ export declare function useTelemetry(ide: 'workflow' | 'ai', sink: TelemetrySink | undefined): (name: IdeEventName, props?: Record<string, unknown>) => void;
10
+ type Track = (name: IdeEventName, props?: Record<string, unknown>) => void;
11
+ /**
12
+ * 挂载时上报一次 `ide_opened`。守卫放在 ref 里:StrictMode 的「执行 → 清理 → 再执行」不会重复上报;
13
+ * 真正重新挂载(新实例)会得到新的守卫。
14
+ */
15
+ export declare function useIdeOpenedOnce(track: Track): void;
16
+ /**
17
+ * 专业模式经 store 的操作统一上报:
18
+ * - 本地试跑(`runLocalSandboxDryRun`)→ `sandbox_run`,`entry: 'pro'`
19
+ * - 画布新增步骤(`addNode`)→ `step_added`,`source: 'builtin'`
20
+ */
21
+ export declare function useProStoreTelemetry(track: Track): void;
22
+ export {};
@@ -74,6 +74,17 @@ export interface TaskDef {
74
74
  timeoutSeconds?: number;
75
75
  timeoutPolicy?: 'RETRY' | 'TIME_OUT_WF' | 'ALERT_ONLY' | 'FAIL_WORKFLOW';
76
76
  }
77
+ /**
78
+ * Conductor 标准 Schema 定义(WorkflowDef / TaskDef 的 inputSchema / outputSchema)。
79
+ * 仅 JSON 类型会被服务端真正校验;data 为 JSON Schema 文档本身。
80
+ */
81
+ export interface SchemaDef {
82
+ name?: string;
83
+ version?: number;
84
+ type?: 'JSON' | 'AVRO' | 'PROTOBUF' | string;
85
+ data?: Record<string, any>;
86
+ externalRef?: string;
87
+ }
77
88
  /**
78
89
  * 工作流入参定义(结构化,向后兼容 string[] 旧格式)
79
90
  */
@@ -133,15 +144,9 @@ export interface WorkflowDef {
133
144
  concurrentExecLimit?: number;
134
145
  };
135
146
  /** 输入 Schema 定义 */
136
- inputSchema?: {
137
- name?: string;
138
- type?: string;
139
- };
147
+ inputSchema?: SchemaDef;
140
148
  /** 输出 Schema 定义 */
141
- outputSchema?: {
142
- name?: string;
143
- type?: string;
144
- };
149
+ outputSchema?: SchemaDef;
145
150
  /** 是否强制 Schema 校验 */
146
151
  enforceSchema?: boolean;
147
152
  }
@@ -205,6 +205,11 @@ export interface WorkflowState {
205
205
  isSimRunning: boolean;
206
206
  /** 每次 setWorkflow() 调用时递增,用于触发 WorkflowDesigner 的 fitView */
207
207
  workflowLoadKey: number;
208
+ /**
209
+ * 画布数据(nodes/edges/taskMap)是否落后于 workflowDef。
210
+ * 业务卡片视图下画布未挂载,编辑只更新定义(setWorkflowDefOnly),切回画布前再 refreshGraph()。
211
+ */
212
+ graphStale: boolean;
208
213
  /** P4.2 执行触发状态 */
209
214
  runState: RunState;
210
215
  pendingExecutionId: string | null;
@@ -237,6 +242,10 @@ export interface WorkflowState {
237
242
  */
238
243
  export interface WorkflowActions {
239
244
  setWorkflow: (workflowJson: any, direction?: LayoutDirection) => void;
245
+ /** 仅更新定义与校验结果,不重建画布(业务卡片视图下的高频编辑使用);画布数据标记为过期 */
246
+ setWorkflowDefOnly: (workflowJson: any) => void;
247
+ /** 画布数据过期时,按当前定义重新解析并布局;未过期则什么都不做 */
248
+ refreshGraph: () => void;
240
249
  setMode: (mode: EditorMode) => void;
241
250
  setExecutionData: (data: Record<string, TaskExecutionData> | null) => void;
242
251
  updateTaskStatus: (taskRef: string, status: ExecutionStatus) => void;
@@ -17,6 +17,8 @@ export type WorkflowLevel = 'L1' | 'L2' | 'L3';
17
17
  export interface WorkflowLibraryItem {
18
18
  workflowName: string;
19
19
  workflowLevel: WorkflowLevel;
20
+ /** 业务域展示名(可选,如「通知协助」) */
21
+ domain?: string;
20
22
  version: string;
21
23
  description: string;
22
24
  tags: string[];
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Task Type Meta — business-friendly labels for Conductor task types
3
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).
4
+ * Used by ProposalPreviewCard so AI proposals speak business language for each
5
+ * task type (originally extracted from the former BusinessCanvas, which the AI IDE
6
+ * business view replaced with StepFlowEditor in 1.2.x).
7
7
  */
8
8
  export interface TaskTypeMeta {
9
9
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/reactflow-ui",
3
- "version": "1.1.0",
3
+ "version": "1.3.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,15 +0,0 @@
1
- /**
2
- * BusinessCanvas — renders a WorkflowDef as business-friendly step cards
3
- * for non-technical users (business view mode).
4
- */
5
- import React from 'react';
6
- import type { WorkflowDef } from '../../types/conductor';
7
- interface BusinessCanvasProps {
8
- workflowDef: WorkflowDef | null;
9
- /** Task statuses from execution (ref → status) */
10
- executionStatus?: Record<string, string>;
11
- /** Called when user clicks a step to ask AI about it */
12
- onStepClick?: (taskRef: string, taskType: string) => void;
13
- }
14
- declare const BusinessCanvas: React.FC<BusinessCanvasProps>;
15
- export default BusinessCanvas;