@yiyi_zhang/reactflow-ui 1.3.0 → 1.3.2

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/README.md +8 -6
  2. package/dist/AiWorkflowIDE.d.ts +23 -3
  3. package/dist/WorkflowIDE.d.ts +14 -1
  4. package/dist/actions/builtin/coerce.d.ts +9 -0
  5. package/dist/actions/types.d.ts +1 -0
  6. package/dist/ai.d.ts +5 -2
  7. package/dist/components/AiNative/AgentTimeline.d.ts +1 -1
  8. package/dist/components/AiNative/ClarificationCard.d.ts +3 -2
  9. package/dist/components/AiNative/InlineCanvasCopilot.d.ts +2 -1
  10. package/dist/components/AiNative/RepairCard.d.ts +3 -2
  11. package/dist/components/AiNative/mermaidParser.d.ts +31 -0
  12. package/dist/components/AiNative/repairActions.d.ts +16 -0
  13. package/dist/components/AiNative/runInputs.d.ts +13 -0
  14. package/dist/components/BrandLogo.d.ts +2 -3
  15. package/dist/components/ConfirmDialog.d.ts +3 -1
  16. package/dist/components/DraftCodeField.d.ts +26 -0
  17. package/dist/components/PromptDialog.d.ts +3 -1
  18. package/dist/components/UnsavedRunNotice.d.ts +16 -0
  19. package/dist/components/business/ActionPickerModal.d.ts +2 -0
  20. package/dist/components/business/BusinessEditorContext.d.ts +38 -0
  21. package/dist/components/business/DataPillInput.d.ts +10 -0
  22. package/dist/components/business/DecisionBranchCard.d.ts +2 -1
  23. package/dist/components/business/ForkJoinCard.d.ts +2 -1
  24. package/dist/components/business/LibraryVersionBadge.d.ts +1 -1
  25. package/dist/components/business/LoopDoWhileCard.d.ts +2 -1
  26. package/dist/components/business/NestedControlStep.d.ts +7 -1
  27. package/dist/components/business/RunStoryTimeline.d.ts +7 -0
  28. package/dist/components/business/StepCardParts.d.ts +73 -0
  29. package/dist/components/business/StepFlowEditor.d.ts +12 -1
  30. package/dist/components/business/StepListEditor.d.ts +6 -2
  31. package/dist/components/business/deleteMessage.d.ts +6 -0
  32. package/dist/components/business/runStatus.d.ts +11 -0
  33. package/dist/components/icons/CmIcon.d.ts +17 -0
  34. package/dist/components/icons/iconRegistry.d.ts +80 -0
  35. package/dist/components/onboarding/OnboardingController.d.ts +7 -0
  36. package/dist/components/onboarding/PromotionPanel.d.ts +9 -1
  37. package/dist/components/template/quickRunNotice.d.ts +13 -0
  38. package/dist/hooks/useConfirm.d.ts +3 -1
  39. package/dist/hooks/useShortcuts.d.ts +1 -1
  40. package/dist/import/common.d.ts +7 -1
  41. package/dist/import/selection.d.ts +17 -0
  42. package/dist/index.d.ts +5 -2
  43. package/dist/library/versionStatus.d.ts +2 -2
  44. package/dist/logo.svg +9 -36
  45. package/dist/onboarding/naming.d.ts +5 -0
  46. package/dist/onboarding/poll.d.ts +6 -3
  47. package/dist/parser/conductorGenerator.d.ts +17 -2
  48. package/dist/product-launch.html +10 -1394
  49. package/dist/providers/types.d.ts +2 -0
  50. package/dist/reactflow-ui-ai.es.js +18497 -14329
  51. package/dist/reactflow-ui.css +1 -1
  52. package/dist/reactflow-ui.es.js +21578 -15400
  53. package/dist/reactflow-ui.umd.js +183 -41
  54. package/dist/sample-workflows/complex-workflow.json +8 -4
  55. package/dist/sample-workflows/decision-workflow.json +1 -0
  56. package/dist/sample-workflows/ecs-lifecycle-automation.json +37 -4
  57. package/dist/services/ai/agentRunner.d.ts +46 -1
  58. package/dist/services/ai/errorMessages.d.ts +9 -1
  59. package/dist/services/ai/protocolAdapter.d.ts +5 -0
  60. package/dist/services/ai/systemPrompt.d.ts +1 -1
  61. package/dist/services/ai/toolExecutor.d.ts +26 -0
  62. package/dist/services/ai/workflowSynthesizer.d.ts +4 -4
  63. package/dist/services/aiService.d.ts +5 -1
  64. package/dist/stepmodel/compile.d.ts +2 -1
  65. package/dist/stepmodel/factory.d.ts +5 -0
  66. package/dist/stepmodel/pills.d.ts +32 -0
  67. package/dist/stepmodel/types.d.ts +10 -0
  68. package/dist/stepmodel/validate.d.ts +20 -0
  69. package/dist/store/aiStore.d.ts +30 -5
  70. package/dist/store/sandboxRunObserver.d.ts +2 -1
  71. package/dist/store/workflowStore.d.ts +8 -9
  72. package/dist/template/templateStore.d.ts +6 -0
  73. package/dist/template/types.d.ts +1 -0
  74. package/dist/types/conductor.d.ts +25 -1
  75. package/dist/types/workflow.d.ts +38 -3
  76. package/dist/types/workflowLibrary.d.ts +5 -5
  77. package/dist/utils/executionAnalyzer.d.ts +5 -0
  78. package/dist/utils/executionImport.d.ts +52 -0
  79. package/dist/utils/executionPoller.d.ts +37 -0
  80. package/dist/utils/hostSave.d.ts +10 -0
  81. package/dist/utils/localSandboxEngine.d.ts +51 -6
  82. package/dist/utils/runStory.d.ts +20 -0
  83. package/dist/utils/sameWorkflow.d.ts +6 -0
  84. package/dist/utils/sandbox/jq.d.ts +13 -0
  85. package/dist/utils/sandbox/scriptRunner.d.ts +38 -0
  86. package/dist/utils/sandbox/switchHints.d.ts +17 -0
  87. package/dist/utils/statusMeta.d.ts +35 -0
  88. package/dist/utils/taskEditing.d.ts +59 -0
  89. package/dist/utils/taskTypeMeta.d.ts +1 -0
  90. package/dist/utils/validationRules.d.ts +29 -4
  91. package/package.json +6 -2
package/README.md CHANGED
@@ -132,18 +132,20 @@ export default function AiApp() {
132
132
 
133
133
  ```tsx
134
134
  import {
135
- executeLocalSandboxDryRun,
135
+ executeLocalSandboxDryRunAsync,
136
136
  buildDataFlowGraph,
137
137
  getCompletionItems,
138
138
  } from '@yiyi_zhang/reactflow-ui';
139
139
 
140
- // 1. 0ms 浏览器本地确定性沙箱试跑(支持自定义入参与故障注入)
141
- const { instance } = executeLocalSandboxDryRun(workflowDef, {
140
+ // 1. 浏览器本地沙箱试跑:INLINE / JQ / SWITCH / DO_WHILE 等真实执行(脚本在隔离的 Web Worker 中运行),
141
+ // HTTP 等调用外部系统的任务返回模拟数据,可按任务覆盖输出或注入故障
142
+ const instance = await executeLocalSandboxDryRunAsync(workflowDef, {
142
143
  workflowInput: { orderId: 'ORD-2026', vipLevel: 3 },
143
- taskOverrides: {
144
- charge_card: { status: 'FAILED', errorMessage: '模拟支付网关 502 超时' },
144
+ taskMocks: {
145
+ charge_card_ref: { status: 'FAILED', reasonForIncompletion: '模拟支付网关 502 超时' },
145
146
  },
146
147
  });
148
+ // 每个任务的 sandboxExecution 说明它是 'executed' / 'mocked' / 'not_executed'
147
149
 
148
150
  // 2. 构建工作流全局数据血缘图谱
149
151
  const lineageGraph = buildDataFlowGraph(workflowDef);
@@ -208,7 +210,7 @@ src/
208
210
 
209
211
  ## 📚 文档导航
210
212
 
211
- - **[🚀 v1.0.0 产品发布宣传首页 (Product Launch Showcase)](./docs/product-launch-v1.0.0.html)** — 100% 单文件零依赖 HTML,含首屏 Before/After 耗时对比、一行命令极速体验、可拖动双滑块团队 ROI 收益计算器与交互式沙箱演练
213
+ - **[v1.0.0 产品发布宣传页](./v1-0.html)** — 首屏 Before/After 耗时对比、一行命令极速体验、团队 ROI 收益计算器与交互式沙箱演练。最新版本见首页 `index.html`。
212
214
  - **[集成指南 (INTEGRATION.md)](./INTEGRATION.md)** — Props 详解、运行态接入、AI 代理配置、W-LSP 与沙箱 API
213
215
  - **[版本更新日志 (CHANGELOG.md)](./CHANGELOG.md)** — `v1.0.0` 及历次版本完整变更记录
214
216
  - **[发展路线图 (ROADMAP.md)](./ROADMAP.md)** — 演进里程碑与未来规划
@@ -21,9 +21,15 @@ import type { IdeDraft } from './services/ai/draftPersistence';
21
21
  import './styles/tokens.css';
22
22
  import './styles/executionStyles.css';
23
23
  import './components/AiNative/AiNative.css';
24
+ import { type HostSaveHandler } from './utils/hostSave';
24
25
  export interface AiWorkflowIDEProps {
25
- /** 初始工作流定义(编辑态) */
26
+ /** 初始工作流定义(编辑态)。默认视为服务端已保存的版本,见 `workflowDefSaved` */
26
27
  workflowDef?: WorkflowDef;
28
+ /**
29
+ * `workflowDef` 是否是服务端已保存的版本,默认 `true`。
30
+ * 传入本地文件、草稿等还没保存的定义时设为 `false`,运行卡片会提示将运行已保存的版本。
31
+ */
32
+ workflowDefSaved?: boolean;
27
33
  /** 运行态执行实例数据(完整 Conductor Workflow 实例,或裸的任务实例数组) */
28
34
  workflowExecution?: WorkflowExecutionInput;
29
35
  /**
@@ -87,6 +93,12 @@ export interface AiWorkflowIDEProps {
87
93
  * 由集成方完全掌控 AI 配置。
88
94
  */
89
95
  aiConfig?: Partial<AiConfig>;
96
+ /**
97
+ * 用户在内置 AI 设置里填写的 provider / baseUrl / model 保存在哪个 localStorage 键下
98
+ * (apiKey 与 transport 从不落盘)。缺省 `'ai-workflow-config'`(与旧版本兼容);
99
+ * 同一页面挂载多个配置不同的实例时请各传一个唯一键,传 `false` 则完全不写 localStorage。
100
+ */
101
+ aiConfigStorageKey?: string | false;
90
102
  /**
91
103
  * 完全替换内置基础提示词(高级定制)。
92
104
  * 工作流上下文仍会自动注入,无需手动处理。
@@ -166,7 +178,8 @@ export interface AiWorkflowIDEProps {
166
178
  * ```
167
179
  */
168
180
  taskSchemas?: TaskSchema[];
169
- onSave?: (def: WorkflowDef) => void;
181
+ /** 保存回调。异步保存请返回 Promise:resolve 后才记为已保存的版本 */
182
+ onSave?: HostSaveHandler;
170
183
  onWorkflowChange?: (def: WorkflowDef) => void;
171
184
  onRequestImport?: () => void;
172
185
  executionActions?: ExecutionActions;
@@ -237,8 +250,15 @@ export interface AiWorkflowIDEProps {
237
250
  export interface AiWorkflowIDERef {
238
251
  /** 获取当前工作流定义 */
239
252
  getWorkflowDef: () => WorkflowDef | null;
240
- /** 程序化设置工作流 */
253
+ /**
254
+ * 程序化设置工作流。设置后 IDE 不知道它是否已保存;加载的是服务端已保存的定义时,接着调用 `markSaved()`。
255
+ */
241
256
  setWorkflow: (def: WorkflowDef) => void;
257
+ /**
258
+ * 把定义记为服务端已保存的版本(不传时取当前编辑中的定义)。运行卡片按名称 + 版本运行已保存的版本,
259
+ * 画布与它不同时会提示。宿主在自己确认保存成功、或用 setWorkflow 加载了服务端定义后调用。
260
+ */
261
+ markSaved: (def?: WorkflowDef) => void;
242
262
  /** 新建空白工作流 */
243
263
  createBlankWorkflow: (name?: string) => void;
244
264
  /** 获取 AI 使用指标 */
@@ -7,6 +7,7 @@ import type { LibraryProvider } from './library/types';
7
7
  import type { IdeProviders } from './providers/types';
8
8
  import './styles/tokens.css';
9
9
  import './styles/executionStyles.css';
10
+ import { type HostSaveHandler } from './utils/hostSave';
10
11
  /**
11
12
  * WorkflowIDE 的命令式 API(通过 ref 调用)
12
13
  */
@@ -21,6 +22,11 @@ export interface WorkflowIDERef {
21
22
  createBlankWorkflow: (name?: string) => void;
22
23
  /** 打开「导入接口」对话框(OpenAPI / Swagger / Postman / curl),供宿主或自助接入向导调用 */
23
24
  openApiImport: () => void;
25
+ /**
26
+ * 把定义记为服务端已保存的版本(不传时取当前编辑中的定义)。「执行验证」按名称 + 版本运行已保存的版本,
27
+ * 画布与它不同时会提示。宿主在自己确认保存成功、或用其它方式加载了服务端定义后调用。
28
+ */
29
+ markSaved: (def?: WorkflowDef) => void;
24
30
  }
25
31
  /**
26
32
  * WorkflowIDE 组件的属性接口
@@ -29,8 +35,14 @@ export interface WorkflowIDEProps {
29
35
  /**
30
36
  * 初始加载的工作流定义 JSON 对象。
31
37
  * 如果在组件挂载后通过 Props 更新此值,IDE 内容也会随之更新。
38
+ * 传入的定义默认视为服务端已保存的版本(「执行验证」据此判断画布有没有未保存的修改),见 `workflowDefSaved`。
32
39
  */
33
40
  workflowDef?: WorkflowDef;
41
+ /**
42
+ * `workflowDef` 是否是服务端已保存的版本,默认 `true`。
43
+ * 传入本地文件、草稿等还没保存的定义时设为 `false`,「执行验证」会提示将运行已保存的版本。
44
+ */
45
+ workflowDefSaved?: boolean;
34
46
  /**
35
47
  * 是否开启只读模式。
36
48
  * - `true`: 节点锁定,无法拖拽、连接或编辑。
@@ -69,9 +81,10 @@ export interface WorkflowIDEProps {
69
81
  workflowExecution?: WorkflowExecutionInput;
70
82
  /**
71
83
  * 点击保存按钮时的回调函数。
84
+ * 异步保存请返回 Promise:resolve 后 IDE 才把这份定义记为已保存,reject 时执行面板继续提示"有未保存的修改"。
72
85
  * @param def 最新的工作流定义对象
73
86
  */
74
- onSave?: (def: WorkflowDef) => void;
87
+ onSave?: HostSaveHandler;
75
88
  /**
76
89
  * 工作流定义发生变更时的实时回调 (可选)。
77
90
  */
@@ -0,0 +1,9 @@
1
+ /** 值中含 `${...}` 引用(数据胶囊 / 表达式)时视为运行时取值,编译时原样保留 */
2
+ export declare const isExpressionValue: (v: unknown) => boolean;
3
+ /**
4
+ * 数字字段编译:
5
+ * - 空值(未填 / 清空)回落到默认值,而不是 0(例如保留天数 0 表示"永久保留",不能因清空而误设)
6
+ * - 含 `${...}` 的数据胶囊原样保留(Number('${...}') 会得到 NaN,序列化后变成 null)
7
+ * - 可解析的数字文本转为数字;无法解析的文本原样保留,交给运行时 / 校验提示
8
+ */
9
+ export declare function toNumberField(v: unknown, fallback: number): number | string;
@@ -44,6 +44,7 @@ export interface ActionDefinition {
44
44
  id: string;
45
45
  name: string;
46
46
  category: ActionCategory;
47
+ /** CMASTER icon name (components/icons/iconRegistry.ts, e.g. 'server'); legacy emoji still render via aliases. */
47
48
  icon: string;
48
49
  description: string;
49
50
  connector?: string;
package/dist/ai.d.ts CHANGED
@@ -39,8 +39,11 @@ export { parseWorkflowInputParams } from './types/conductor';
39
39
  export type { ExecutionActions, ThemeMode, ThemeColor, LayoutDirection, ViewMode, TaskExecutionData, WorkflowExecutionInput } from './types/workflow';
40
40
  export { getCompletionItems, buildDataFlowGraph, refactorTaskReferenceName, getUpstreamAncestors, inferTaskOutputSchema, } from './services/wlsp/workflowLsp';
41
41
  export type { WlspCompletionItem, DataFlowGraph, DataFlowEdge, InferredField, UpstreamTaskInfo, } from './services/wlsp/workflowLsp';
42
- export { executeLocalSandboxDryRun, buildDefaultWorkflowMockInput, generateDefaultTaskOutputPreview, } from './utils/localSandboxEngine';
43
- export type { SandboxDryRunOptions, TaskMockOverride, } from './utils/localSandboxEngine';
42
+ export { executeLocalSandboxDryRun, executeLocalSandboxDryRunAsync, buildDefaultWorkflowMockInput, generateDefaultTaskOutputPreview, } from './utils/localSandboxEngine';
43
+ export type { SandboxDryRunOptions, SandboxAsyncOptions, TaskMockOverride, } from './utils/localSandboxEngine';
44
+ export { runJq, JqError } from './utils/sandbox/jq';
45
+ export { createWorkerScriptEvaluator } from './utils/sandbox/scriptRunner';
46
+ export type { ScriptEvaluator, ScriptResult, WorkerScriptEvaluator } from './utils/sandbox/scriptRunner';
44
47
  export { WorkflowIdeProvider, useIdeProviders } from './providers/WorkflowIdeProvider';
45
48
  export type { WorkflowIdeProviderProps } from './providers/WorkflowIdeProvider';
46
49
  export { resolveProviders, stabilizeProviders } from './providers/resolve';
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Replaces the single toolStatus line with:
5
5
  * 1. A 4-Phase Synthesis Progress Bar ("① 蓝图定义 → ② 拓扑编排 → ③ 参数与数据流 → ④ 整体校验") when progressive synthesis is active
6
- * 2. A growing list of completed steps ("✓ 已搜索工作流库", "✓ 阶段 2/4:已编排 5 个任务拓扑骨架")
6
+ * 2. A growing list of completed steps (a check mark with "已搜索工作流库", "阶段 2/4:已编排 5 个任务拓扑骨架")
7
7
  * 3. The current in-flight step as a spinner row
8
8
  */
9
9
  import React from 'react';
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import type { PendingClarification } from '../../store/aiStore';
2
+ import type { PendingClarification, ClarificationOption } from '../../store/aiStore';
3
3
  interface ClarificationCardProps {
4
4
  clarification: PendingClarification;
5
- onSelect: (optionLabel: string) => void;
5
+ /** 用户选中的选项(含说明),由调用方连同问题一起发给模型 */
6
+ onSelect: (option: ClarificationOption) => void;
6
7
  onCustom: () => void;
7
8
  }
8
9
  declare const ClarificationCard: React.FC<ClarificationCardProps>;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { AIServiceConfig } from '../../services/aiService';
2
+ import { type AIServiceConfig } from '../../services/aiService';
3
3
  interface InlineCanvasCopilotProps {
4
+ /** Overrides the AI config read from the active aiStore (optional; normally not needed). */
4
5
  aiConfig?: Partial<AIServiceConfig>;
5
6
  }
6
7
  export declare const InlineCanvasCopilot: React.FC<InlineCanvasCopilotProps>;
@@ -6,10 +6,11 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import type { RepairProposal, RepairAction } from '../../store/aiStore';
9
+ import { type RepairCapabilities } from './repairActions';
9
10
  interface RepairCardProps {
10
11
  repair: RepairProposal;
11
- /** True when the corresponding execution actions are available */
12
- canExecute: boolean;
12
+ /** 哪些动作可执行:每个动作只看它自己的回调(见 isRepairActionExecutable) */
13
+ capabilities: RepairCapabilities;
13
14
  onExecuteAction: (action: RepairAction) => void;
14
15
  onDismiss: () => void;
15
16
  }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Mermaid flowchart parser for the chat's lightweight diagram renderer (MermaidBlock).
3
+ *
4
+ * Covers the flowchart subset that both the IDE itself (src/utils/workflowToMermaid.ts) and
5
+ * models commonly write:
6
+ * - header `flowchart TD` / `graph LR` (optional trailing `;`), statements split by newline or `;`
7
+ * - node shapes: `[x]` `("x")` `(["x"])` `(("x"))` `{"x"}` `{{x}}` `[/"x"/]` `[\x\]` `[(x)]` `[[x]]` `>x]`
8
+ * - links: `-->` `---` `-.->` `==>` `--x` `--o`, labels as `-->|x|`, `-- "x" -->`, `-- x -->`,
9
+ * `-. x .->`, `== x ==>`
10
+ * - chains `A --> B --> C` and groups `A & B --> C`
11
+ * - Unicode (e.g. Chinese) node ids
12
+ * Styling statements (subgraph / end / style / classDef / class / click / linkStyle / direction) are skipped.
13
+ */
14
+ export type MermaidNodeShape = 'rect' | 'round' | 'stadium' | 'circle' | 'diamond' | 'parallelogram';
15
+ export interface MermaidNode {
16
+ id: string;
17
+ label: string;
18
+ shape: MermaidNodeShape;
19
+ }
20
+ export interface MermaidEdge {
21
+ from: string;
22
+ to: string;
23
+ label?: string;
24
+ dashed?: boolean;
25
+ }
26
+ export interface MermaidFlowchart {
27
+ direction: 'TB' | 'LR';
28
+ nodes: MermaidNode[];
29
+ edges: MermaidEdge[];
30
+ }
31
+ export declare function parseMermaidFlowchart(rawCode: string): MermaidFlowchart | null;
@@ -0,0 +1,16 @@
1
+ import type { RepairAction } from '../../store/aiStore';
2
+ /** 修复动作可用的能力:集成方提供了哪些 executionActions 回调、AI 是否允许修改流程定义 */
3
+ export interface RepairCapabilities {
4
+ onRerunFromTask?: unknown;
5
+ onSkipTask?: unknown;
6
+ onRetry?: unknown;
7
+ /** modify_def 需要切到编辑模式并让 AI 生成变更方案 */
8
+ canEditDefinition?: boolean;
9
+ }
10
+ /**
11
+ * 每个修复动作只看它自己需要的那个回调:只提供了 onRetry 时,"跳过"必须是不可执行的,
12
+ * 不能点击后什么都不做却仍上报 repair:executed 并开始轮询。
13
+ */
14
+ export declare function isRepairActionExecutable(action: RepairAction, caps: RepairCapabilities): boolean;
15
+ /** 不可执行时告诉用户原因(按钮 title 与卡片提示) */
16
+ export declare function repairActionUnavailableReason(action: RepairAction, caps: RepairCapabilities): string;
@@ -0,0 +1,13 @@
1
+ import type { WorkflowInputParam } from '../../types/conductor';
2
+ export interface CoercedRunInputs {
3
+ input: Record<string, unknown>;
4
+ /** 参数名 → 面向用户的错误说明(发生了什么 + 怎么填) */
5
+ errors: Record<string, string>;
6
+ }
7
+ /**
8
+ * 把运行表单里的文本按声明类型转换成工作流输入(之前一律以字符串发送,数字 / 布尔 / JSON 参数全错):
9
+ * - number / boolean / object / array 按类型解析,解析不了就给出错误,不发送
10
+ * - 未声明类型时,形如 JSON 对象或数组的文本按 JSON 解析,其余保持字符串
11
+ * - 留空:有默认值用默认值;没有就不传该参数(必填参数给出错误)
12
+ */
13
+ export declare function coerceRunInputs(params: WorkflowInputParam[], values: Record<string, string>): CoercedRunInputs;
@@ -5,9 +5,8 @@ interface BrandLogoProps {
5
5
  style?: React.CSSProperties;
6
6
  }
7
7
  /**
8
- * Conductor Workflow IDE 极简几何品牌 Logo
9
- *
10
- * 设计语言:深空圆角矩形底座 + 贝塞尔双分支编排流向 + 三色确定性拓扑节点(靛紫起点 → 青蓝分支 / 翠绿沙箱通过节点)
8
+ * CMASTER mark: a C-shaped arc linking three system nodes to a central hub (design/assets/cmaster-mark-*.svg).
9
+ * The node centres take the surrounding surface colour, so one component serves the dark and light marks.
11
10
  */
12
11
  export declare const BrandLogo: React.FC<BrandLogoProps>;
13
12
  export default BrandLogo;
@@ -2,6 +2,8 @@ interface ConfirmDialogProps {
2
2
  message: string;
3
3
  onConfirm: () => void;
4
4
  onCancel: () => void;
5
+ /** 确认按钮文案,动词开头说明会发生什么(如"删除");缺省为"继续" */
6
+ confirmLabel?: string;
5
7
  }
6
- declare const ConfirmDialog: ({ message, onConfirm, onCancel }: ConfirmDialogProps) => import("react").ReactPortal;
8
+ declare const ConfirmDialog: ({ message, onConfirm, onCancel, confirmLabel }: ConfirmDialogProps) => import("react").ReactPortal;
7
9
  export default ConfirmDialog;
@@ -0,0 +1,26 @@
1
+ import type { CSSProperties } from 'react';
2
+ export interface DraftCodeFieldProps {
3
+ label: string;
4
+ /** 已提交的值(来自定义) */
5
+ value: string;
6
+ /** 失焦或全屏保存时调用;返回 null 表示已提交,返回字符串表示错误原因(草稿保留,显示错误) */
7
+ onCommit: (draft: string) => string | null;
8
+ editable: boolean;
9
+ rows?: number;
10
+ placeholder?: string;
11
+ style?: CSSProperties;
12
+ dataField?: string;
13
+ secondaryTextColor?: string;
14
+ onOpenFullscreen?: (current: string, apply: (text: string) => void) => void;
15
+ onTextareaFocus?: (el: HTMLTextAreaElement) => void;
16
+ /** 输入 `${` 等触发补全时调用;apply 用于把补全后的文本写回草稿并提交 */
17
+ onTyping?: (el: HTMLTextAreaElement, next: string, apply: (text: string) => void) => void;
18
+ /** 让外部(如快捷片段)可以把文本写入草稿 */
19
+ registerApply?: (apply: ((text: string) => void) | null) => void;
20
+ }
21
+ /**
22
+ * 带本地草稿的代码 / JSON 输入框(E18):
23
+ * 输入过程中不解析,失焦时才提交;提交失败时保留草稿并在下方说明原因,用户可以逐字输入不完整的 JSON。
24
+ */
25
+ declare const DraftCodeField: ({ label, value, onCommit, editable, rows, placeholder, style, dataField, secondaryTextColor, onOpenFullscreen, onTextareaFocus, onTyping, registerApply, }: DraftCodeFieldProps) => import("react/jsx-runtime").JSX.Element;
26
+ export default DraftCodeField;
@@ -8,10 +8,12 @@ interface PromptDialogProps {
8
8
  cancelText?: string;
9
9
  onConfirm: (value: string) => void;
10
10
  onCancel: () => void;
11
+ /** 可选校验:返回错误原因时不提交,并在输入框下方显示 */
12
+ validate?: (value: string) => string | null;
11
13
  }
12
14
  /**
13
15
  * 页面内输入弹框,替代 window.prompt。
14
16
  * 使用 createPortal 渲染到 document.body,继承 CSS 主题变量。
15
17
  */
16
- declare const PromptDialog: ({ title, label, defaultValue, placeholder, confirmText, cancelText, onConfirm, onCancel, }: PromptDialogProps) => import("react").ReactPortal;
18
+ declare const PromptDialog: ({ title, label, defaultValue, placeholder, confirmText, cancelText, onConfirm, onCancel, validate, }: PromptDialogProps) => import("react").ReactPortal;
17
19
  export default PromptDialog;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import './UnsavedRunNotice.css';
3
+ export interface UnsavedRunNoticeProps {
4
+ /** 将要运行的已保存版本的名称 */
5
+ workflowName: string;
6
+ /** 将要运行的已保存版本号 */
7
+ version?: number;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * R19:执行按「名称 + 版本」启动服务端已保存的定义,画布上未保存的修改不会参与运行。
12
+ * 执行验证面板(WorkflowIDE)和 AI 运行卡片(AiWorkflowIDE)共用这段提示。
13
+ * 是否显示由调用方根据 store.hasUnsavedChanges() 决定。
14
+ */
15
+ declare const UnsavedRunNotice: React.FC<UnsavedRunNoticeProps>;
16
+ export default UnsavedRunNotice;
@@ -7,6 +7,8 @@ export interface ActionPickerModalProps {
7
7
  registry: ActionRegistry;
8
8
  /** 展示用的步骤序号(从 1 开始) */
9
9
  stepNumber: number;
10
+ /** 插入位置说明(如"分支 VIP · 第 2 步");提供时替代"第 N 步" */
11
+ positionLabel?: string;
10
12
  onClose: () => void;
11
13
  onSelect: (action: ActionDefinition) => void;
12
14
  /**
@@ -0,0 +1,38 @@
1
+ import type { BusinessStep } from '../../stepmodel/types';
2
+ import type { StepIssueMap } from '../../stepmodel/validate';
3
+ import type { LibraryCatalog } from '../../library/catalog';
4
+ import type { ActionDefinition } from '../../actions/types';
5
+ /** 打开动作选择器时的上下文说明(如"分支 VIP · 第 2 步"),替代固定的"第 N 步" */
6
+ export interface InsertPickerInfo {
7
+ label?: string;
8
+ }
9
+ /** 打开动作选择器,选中动作后执行 callback(在分支 / 泳道 / 循环体内插入时使用) */
10
+ export type OpenInsertModal = (callback: (action: ActionDefinition) => void, info?: InsertPickerInfo) => void;
11
+ /**
12
+ * 业务卡片视图的共享上下文:由 StepFlowEditor 提供,嵌套卡片按需读取,避免层层透传。
13
+ * 卡片在 StepFlowEditor 之外单独使用时取默认值,行为与之前一致。
14
+ */
15
+ export interface BusinessEditorContextValue {
16
+ /** 工作流全局入参声明(数据胶囊选择器中的"工作流全局入参"分组) */
17
+ workflowInputParams?: any[];
18
+ /** 按 taskReferenceName 归类的校验问题 */
19
+ issues: StepIssueMap;
20
+ /** 最近一次试跑的各步骤状态 */
21
+ runStatus?: Record<string, string>;
22
+ /** 删除等操作的确认(StepFlowEditor 提供统一的确认弹窗) */
23
+ confirm?: (message: string, confirmLabel?: string) => Promise<boolean>;
24
+ libraryCatalog?: LibraryCatalog;
25
+ /** 顶层全部步骤(用于判断某步骤输出是否被下游引用) */
26
+ allSteps: BusinessStep[];
27
+ /** 定位请求:嵌套卡片据此切换到对应分支 / 展开对应步骤 */
28
+ focusRequest?: {
29
+ ref: string;
30
+ nonce: number;
31
+ } | null;
32
+ }
33
+ export declare const BusinessEditorContext: import("react").Context<BusinessEditorContextValue>;
34
+ export declare const useBusinessEditor: () => BusinessEditorContextValue;
35
+ /** 步骤卡片的 DOM id(定位步骤时滚动到此处) */
36
+ export declare const stepDomId: (ref: string) => string;
37
+ /** 递归判断 ref 是否在步骤列表(含嵌套)中 */
38
+ export declare function containsStepRef(steps: BusinessStep[], ref: string): boolean;
@@ -8,9 +8,19 @@ export interface DataPillInputProps {
8
8
  multiline?: boolean;
9
9
  upstreamSteps: BusinessStep[];
10
10
  registry?: ActionRegistry;
11
+ /** 工作流全局入参声明;不传时取 StepFlowEditor 提供的上下文 */
11
12
  workflowInputParams?: any[];
12
13
  disabled?: boolean;
13
14
  /** 初始即展开「插入数据」选择面板(例如下拉字段刚切换为动态取值时) */
14
15
  defaultShowPicker?: boolean;
16
+ /** 输入框 id(供 <label htmlFor> 关联) */
17
+ id?: string;
18
+ /** 无可见 label 时的无障碍名称 */
19
+ ariaLabel?: string;
20
+ /** 输入有误时描边标红,并通过 aria-describedby 关联错误说明 */
21
+ invalid?: boolean;
22
+ describedBy?: string;
23
+ /** 等宽字体(表达式、脚本) */
24
+ mono?: boolean;
15
25
  }
16
26
  export declare const DataPillInput: React.FC<DataPillInputProps>;
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import type { BusinessStep } from '../../stepmodel/types';
3
3
  import { ActionRegistry } from '../../actions/registry';
4
4
  import type { ActionDefinition } from '../../actions/types';
5
+ import { type InsertPickerInfo } from './BusinessEditorContext';
5
6
  export interface DecisionBranchCardProps {
6
7
  step: BusinessStep;
7
8
  upstreamSteps: BusinessStep[];
8
9
  registry?: ActionRegistry;
9
10
  disabled?: boolean;
10
11
  onChange: (updated: BusinessStep) => void;
11
- onOpenInsertModal: (callback: (action: ActionDefinition) => void) => void;
12
+ onOpenInsertModal: (callback: (action: ActionDefinition) => void, info?: InsertPickerInfo) => void;
12
13
  /** 嵌套深度:顶层卡片为 0,其内部子控制流依次 +1 */
13
14
  depth?: number;
14
15
  }
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import type { BusinessStep } from '../../stepmodel/types';
3
3
  import { ActionRegistry } from '../../actions/registry';
4
4
  import type { ActionDefinition } from '../../actions/types';
5
+ import { type InsertPickerInfo } from './BusinessEditorContext';
5
6
  export interface ForkJoinCardProps {
6
7
  step: BusinessStep;
7
8
  upstreamSteps: BusinessStep[];
8
9
  registry?: ActionRegistry;
9
10
  disabled?: boolean;
10
11
  onChange: (updated: BusinessStep) => void;
11
- onOpenInsertModal: (callback: (action: ActionDefinition) => void) => void;
12
+ onOpenInsertModal: (callback: (action: ActionDefinition) => void, info?: InsertPickerInfo) => void;
12
13
  /** 嵌套深度:顶层卡片为 0,其内部子控制流依次 +1 */
13
14
  depth?: number;
14
15
  }
@@ -10,7 +10,7 @@ export interface LibraryVersionBadgeProps {
10
10
  /**
11
11
  * 流程库目录。提供后:
12
12
  * - 升级前取旧、新两个版本的定义,展示入参 / 出参差异再确认
13
- * - 固定版本在库中不存在 / 已下线时显示「⚠ 版本不可用」
13
+ * - 固定版本在库中不存在 / 已下线时显示「版本不可用」警示
14
14
  * 未提供时沿用旧行为(只按动作上记录的最新版本提示升级)。
15
15
  */
16
16
  catalog?: LibraryCatalog;
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import type { BusinessStep } from '../../stepmodel/types';
3
3
  import { ActionRegistry } from '../../actions/registry';
4
4
  import type { ActionDefinition } from '../../actions/types';
5
+ import { type InsertPickerInfo } from './BusinessEditorContext';
5
6
  export interface LoopDoWhileCardProps {
6
7
  step: BusinessStep;
7
8
  upstreamSteps: BusinessStep[];
8
9
  registry?: ActionRegistry;
9
10
  disabled?: boolean;
10
11
  onChange: (updated: BusinessStep) => void;
11
- onOpenInsertModal: (callback: (action: ActionDefinition) => void) => void;
12
+ onOpenInsertModal: (callback: (action: ActionDefinition) => void, info?: InsertPickerInfo) => void;
12
13
  /** 嵌套深度:顶层卡片为 0,其内部子控制流依次 +1 */
13
14
  depth?: number;
14
15
  }
@@ -2,17 +2,23 @@ import React from 'react';
2
2
  import type { BusinessStep } from '../../stepmodel/types';
3
3
  import { ActionRegistry } from '../../actions/registry';
4
4
  import type { ActionDefinition } from '../../actions/types';
5
+ import { type InsertPickerInfo } from './BusinessEditorContext';
5
6
  export interface NestedControlStepProps {
6
7
  step: BusinessStep;
7
8
  index: number;
9
+ /** 同一列表中的步骤数(提供 onMove 时用于判断能否上移 / 下移) */
10
+ count?: number;
8
11
  /** 当前嵌套层级(顶层卡片内的第一层子控制流为 1),用于缩进与视觉区分 */
9
12
  depth?: number;
10
13
  upstreamSteps: BusinessStep[];
11
14
  registry?: ActionRegistry;
12
15
  disabled?: boolean;
13
16
  onChange: (updated: BusinessStep) => void;
17
+ /** 删除(调用方负责确认) */
14
18
  onDelete: () => void;
15
- onOpenInsertModal: (callback: (action: ActionDefinition) => void) => void;
19
+ /** 提供时显示上移 / 下移 */
20
+ onMove?: (toIndex: number) => void;
21
+ onOpenInsertModal: (callback: (action: ActionDefinition) => void, info?: InsertPickerInfo) => void;
16
22
  }
17
23
  /**
18
24
  * 分支 / 并行泳道 / 循环体内部的"子控制流"渲染器。
@@ -1,9 +1,16 @@
1
1
  import React from 'react';
2
2
  import type { WorkflowInstance } from '../../types/conductor';
3
3
  import { ActionRegistry } from '../../actions/registry';
4
+ import { type FriendlyErrorDiagnosis } from '../../utils/friendlyErrorTranslator';
4
5
  export interface RunStoryTimelineProps {
5
6
  instance: WorkflowInstance;
6
7
  registry?: ActionRegistry;
7
8
  onInspectStep?: (taskRef: string) => void;
9
+ /**
10
+ * Handles the fix button of a failed step's diagnosis card (reauth / retry / change_spec / contact_admin).
11
+ * `inspect_upstream` is handled here through `onInspectStep` (it jumps to the previous step). Without a handler the
12
+ * button is not shown.
13
+ */
14
+ onErrorAction?: (actionKey: FriendlyErrorDiagnosis['actionKey'], taskRef: string) => void;
8
15
  }
9
16
  export declare const RunStoryTimeline: React.FC<RunStoryTimelineProps>;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import type { StepIssue } from '../../stepmodel/validate';
3
+ /** 校验问题徽标:错误 =「N 项待修正」,仅提醒 =「N 项提醒」(颜色 + 图标 + 文字) */
4
+ export declare const IssueBadge: React.FC<{
5
+ issues: StepIssue[];
6
+ }>;
7
+ /** 试跑结果徽标:按真实状态显示(成功 / 失败 / 已超时 / 已跳过 / 运行中 / 等待中) */
8
+ export declare const RunBadge: React.FC<{
9
+ status?: string;
10
+ }>;
11
+ export declare const SensitiveTag: React.FC;
12
+ /** 步骤级问题(非字段级)列表,显示在卡片展开区或控制流卡片内 */
13
+ export declare const IssueList: React.FC<{
14
+ issues: StepIssue[];
15
+ }>;
16
+ interface IconButtonProps {
17
+ label: string;
18
+ onClick: () => void;
19
+ disabled?: boolean;
20
+ danger?: boolean;
21
+ children: React.ReactNode;
22
+ }
23
+ export declare const IconButton: React.FC<IconButtonProps>;
24
+ /** 上移 / 下移 / 删除(顶层与嵌套步骤共用) */
25
+ export declare const MoveDeleteButtons: React.FC<{
26
+ index: number;
27
+ count: number;
28
+ onMove: (to: number) => void;
29
+ onDelete: () => void;
30
+ }>;
31
+ /** 步骤之间的"插入步骤"按钮 */
32
+ export declare const InsertStepButton: React.FC<{
33
+ onClick: () => void;
34
+ label?: string;
35
+ compact?: boolean;
36
+ }>;
37
+ /**
38
+ * 可重命名的标题(控制流卡片用):用于区分同类步骤,例如两个"条件分支"。
39
+ */
40
+ export declare const RenameableTitle: React.FC<{
41
+ value: string;
42
+ fallback: string;
43
+ disabled?: boolean;
44
+ onRename: (name: string) => void;
45
+ fontSize?: number;
46
+ }>;
47
+ export interface StepCardHeaderProps {
48
+ /** 用于 aria-controls 的展开区域 id */
49
+ bodyId: string;
50
+ indexLabel: string;
51
+ icon?: string;
52
+ title: string;
53
+ /** 改名后显示动作名,未改名时显示说明 */
54
+ subtitle?: string;
55
+ /** 默认名称(清空名称时恢复为它) */
56
+ defaultTitle: string;
57
+ expanded: boolean;
58
+ onToggle: () => void;
59
+ disabled?: boolean;
60
+ compact?: boolean;
61
+ accentIndex?: boolean;
62
+ onRename?: (name: string) => void;
63
+ /** 标题后的徽标(敏感、版本、校验、试跑) */
64
+ badges?: React.ReactNode;
65
+ /** 右侧操作按钮(AI 介绍、上移、下移、删除) */
66
+ actions?: React.ReactNode;
67
+ }
68
+ /**
69
+ * 普通动作步骤的卡片头部(顶层卡片与分支 / 泳道 / 循环体内的嵌套步骤共用)。
70
+ * 展开 / 收起是一个真正的按钮(键盘可操作,aria-expanded);重命名、排序、删除是其旁边独立的按钮。
71
+ */
72
+ export declare const StepCardHeader: React.FC<StepCardHeaderProps>;
73
+ export {};