@yiyi_zhang/reactflow-ui 1.2.0 → 1.3.1

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 (116) hide show
  1. package/README.md +8 -6
  2. package/dist/AiWorkflowIDE.d.ts +13 -0
  3. package/dist/WorkflowIDE.d.ts +9 -0
  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 +21 -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/business/ActionPickerModal.d.ts +2 -0
  19. package/dist/components/business/BusinessEditorContext.d.ts +38 -0
  20. package/dist/components/business/DataPillInput.d.ts +10 -0
  21. package/dist/components/business/DecisionBranchCard.d.ts +2 -1
  22. package/dist/components/business/ForkJoinCard.d.ts +2 -1
  23. package/dist/components/business/LibraryVersionBadge.d.ts +1 -1
  24. package/dist/components/business/LoopDoWhileCard.d.ts +2 -1
  25. package/dist/components/business/NestedControlStep.d.ts +7 -1
  26. package/dist/components/business/RunStoryTimeline.d.ts +7 -0
  27. package/dist/components/business/StepCardParts.d.ts +73 -0
  28. package/dist/components/business/StepFlowEditor.d.ts +18 -1
  29. package/dist/components/business/StepListEditor.d.ts +6 -2
  30. package/dist/components/business/deleteMessage.d.ts +6 -0
  31. package/dist/components/business/runStatus.d.ts +11 -0
  32. package/dist/components/icons/CmIcon.d.ts +17 -0
  33. package/dist/components/icons/iconRegistry.d.ts +80 -0
  34. package/dist/components/import/ApiImportDialog.d.ts +27 -0
  35. package/dist/components/onboarding/ModalShell.d.ts +15 -0
  36. package/dist/components/onboarding/OnboardingController.d.ts +74 -0
  37. package/dist/components/onboarding/OnboardingGuideCard.d.ts +10 -0
  38. package/dist/components/onboarding/OnboardingWizard.d.ts +42 -0
  39. package/dist/components/onboarding/PromotionPanel.d.ts +28 -0
  40. package/dist/components/onboarding/WorkflowNameBuilder.d.ts +19 -0
  41. package/dist/components/onboarding/index.d.ts +8 -0
  42. package/dist/components/onboarding/styles.d.ts +11 -0
  43. package/dist/components/onboarding/useOnboardingData.d.ts +17 -0
  44. package/dist/components/template/TemplateGallery.d.ts +2 -0
  45. package/dist/components/template/TemplateSetupWizard.d.ts +2 -0
  46. package/dist/hooks/useConfirm.d.ts +3 -1
  47. package/dist/import/buildAction.d.ts +23 -0
  48. package/dist/import/common.d.ts +23 -0
  49. package/dist/import/curl.d.ts +12 -0
  50. package/dist/import/detect.d.ts +9 -0
  51. package/dist/import/index.d.ts +10 -0
  52. package/dist/import/insert.d.ts +16 -0
  53. package/dist/import/openapi.d.ts +9 -0
  54. package/dist/import/postman.d.ts +9 -0
  55. package/dist/import/schema.d.ts +15 -0
  56. package/dist/import/selection.d.ts +17 -0
  57. package/dist/import/sensitive.d.ts +18 -0
  58. package/dist/import/types.d.ts +62 -0
  59. package/dist/import/util.d.ts +23 -0
  60. package/dist/index.d.ts +21 -2
  61. package/dist/library/versionStatus.d.ts +2 -2
  62. package/dist/logo.svg +9 -36
  63. package/dist/onboarding/index.d.ts +6 -0
  64. package/dist/onboarding/naming.d.ts +46 -0
  65. package/dist/onboarding/poll.d.ts +42 -0
  66. package/dist/onboarding/wizardState.d.ts +44 -0
  67. package/dist/parser/conductorGenerator.d.ts +17 -2
  68. package/dist/product-launch.html +10 -1394
  69. package/dist/providers/WorkflowIdeProvider.d.ts +23 -0
  70. package/dist/providers/resolve.d.ts +20 -0
  71. package/dist/providers/types.d.ts +67 -0
  72. package/dist/reactflow-ui-ai.es.js +20355 -13884
  73. package/dist/reactflow-ui.css +1 -1
  74. package/dist/reactflow-ui.es.js +23257 -14745
  75. package/dist/reactflow-ui.umd.js +192 -38
  76. package/dist/sample-imports/cmdb-openapi3.json +334 -0
  77. package/dist/sample-imports/cmdb-postman.json +100 -0
  78. package/dist/sample-imports/ticket-swagger2.json +231 -0
  79. package/dist/sample-workflows/ecs-lifecycle-automation.json +36 -4
  80. package/dist/services/ai/agentRunner.d.ts +42 -1
  81. package/dist/services/ai/errorMessages.d.ts +9 -1
  82. package/dist/services/ai/protocolAdapter.d.ts +5 -0
  83. package/dist/services/ai/systemPrompt.d.ts +1 -1
  84. package/dist/services/ai/toolExecutor.d.ts +26 -0
  85. package/dist/services/ai/workflowSynthesizer.d.ts +4 -4
  86. package/dist/services/aiService.d.ts +5 -1
  87. package/dist/stepmodel/compile.d.ts +2 -1
  88. package/dist/stepmodel/factory.d.ts +5 -0
  89. package/dist/stepmodel/pills.d.ts +32 -0
  90. package/dist/stepmodel/types.d.ts +10 -0
  91. package/dist/stepmodel/validate.d.ts +20 -0
  92. package/dist/store/aiStore.d.ts +10 -3
  93. package/dist/store/sandboxRunObserver.d.ts +20 -0
  94. package/dist/store/workflowStore.d.ts +2 -9
  95. package/dist/telemetry/buffer.d.ts +37 -0
  96. package/dist/telemetry/once.d.ts +11 -0
  97. package/dist/telemetry/track.d.ts +17 -0
  98. package/dist/telemetry/types.d.ts +24 -0
  99. package/dist/telemetry/useTelemetry.d.ts +22 -0
  100. package/dist/template/templateStore.d.ts +6 -0
  101. package/dist/template/types.d.ts +1 -0
  102. package/dist/types/conductor.d.ts +25 -1
  103. package/dist/types/workflow.d.ts +20 -3
  104. package/dist/types/workflowLibrary.d.ts +5 -5
  105. package/dist/utils/executionAnalyzer.d.ts +5 -0
  106. package/dist/utils/executionImport.d.ts +52 -0
  107. package/dist/utils/executionPoller.d.ts +37 -0
  108. package/dist/utils/localSandboxEngine.d.ts +43 -6
  109. package/dist/utils/runStory.d.ts +20 -0
  110. package/dist/utils/sandbox/jq.d.ts +13 -0
  111. package/dist/utils/sandbox/scriptRunner.d.ts +34 -0
  112. package/dist/utils/statusMeta.d.ts +35 -0
  113. package/dist/utils/taskEditing.d.ts +59 -0
  114. package/dist/utils/taskTypeMeta.d.ts +1 -0
  115. package/dist/utils/validationRules.d.ts +19 -5
  116. package/package.json +6 -2
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Import dialog selection rules (R16): the dialog renders at most `limit` rows, so nothing outside what the user can
3
+ * see is ever selected implicitly.
4
+ */
5
+ /** Default selection: every operation when all of them are shown, otherwise none. */
6
+ export declare function initialSelection<T extends {
7
+ id: string;
8
+ }>(operations: T[], limit: number): Set<string>;
9
+ /** The rows shown and how many matching rows are hidden by the limit. */
10
+ export declare function visibleSlice<T>(filtered: T[], limit: number): {
11
+ visible: T[];
12
+ hiddenCount: number;
13
+ };
14
+ /** Select-all / select-none applied to the visible rows only. */
15
+ export declare function applyToVisible<T extends {
16
+ id: string;
17
+ }>(selected: Set<string>, visible: T[], on: boolean): Set<string>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 敏感信息处理:请求头 / 查询参数 / 请求体字段里的凭据不落入流程定义,
3
+ * 一律替换为 `${workflow.input.xxx}` 占位,并给出提示。
4
+ */
5
+ export declare function isSensitiveHeader(name: string): boolean;
6
+ /** 查询参数 / 请求体字段名是否敏感 */
7
+ export declare function isSensitiveName(name: string): boolean;
8
+ /** 占位表达式:`${workflow.input.<camelName>}` */
9
+ export declare function inputPlaceholder(name: string): string;
10
+ export declare function sensitiveHeaderWarning(name: string): string;
11
+ /**
12
+ * 替换请求头中的敏感值。已是 `${...}` 表达式的值视为已处理,原样保留。
13
+ * 返回新对象,不修改入参。
14
+ */
15
+ export declare function sanitizeHeaders(headers: Record<string, string>): {
16
+ headers: Record<string, string>;
17
+ warnings: string[];
18
+ };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * 接口导入:解析结果的公共类型(纯数据,无 React 依赖)。
3
+ * 设计见 docs/design/v1.3.0-自助接入设计.md 第 4 节。
4
+ */
5
+ /** 可导入的来源格式 */
6
+ export type ImportFormat = 'openapi3' | 'swagger2' | 'postman21' | 'curl';
7
+ /** detectFormat 的结果:除可导入格式外,还可能是 YAML(不支持)或无法识别 */
8
+ export type DetectedFormat = ImportFormat | 'yaml' | 'unknown';
9
+ /** JSON Schema 片段(已解析本地 $ref,保持宽松类型) */
10
+ export type JsonSchema = Record<string, any>;
11
+ export type ParamLocation = 'path' | 'query' | 'header';
12
+ export interface ImportedParam {
13
+ name: string;
14
+ in: ParamLocation;
15
+ required: boolean;
16
+ schema: JsonSchema;
17
+ description?: string;
18
+ /** 导入时带入的默认值(curl / Postman 中的字面量;敏感名称已替换为占位) */
19
+ defaultValue?: string;
20
+ }
21
+ export interface ImportedBody {
22
+ /** 例如 application/json */
23
+ contentType: string;
24
+ /** object 且含 properties 时拆成多个字段;否则整体作为单个 `body` 字段 */
25
+ schema: JsonSchema;
26
+ }
27
+ export interface ImportedOperation {
28
+ /** 同一次解析内唯一,形如 `get_tickets_id`,用于动作 id(`import.<id>`) */
29
+ id: string;
30
+ /** 大写 HTTP 方法 */
31
+ method: string;
32
+ /** 服务地址(不含路径),可能为空或含 `${workflow.input.xxx}` */
33
+ baseUrl: string;
34
+ /** 路径模板,路径参数写作 `{id}` */
35
+ path: string;
36
+ summary?: string;
37
+ description?: string;
38
+ operationId?: string;
39
+ tags: string[];
40
+ params: ImportedParam[];
41
+ /** 固定请求头(敏感头的值已替换为 `${workflow.input.xxx}` 占位) */
42
+ headers: Record<string, string>;
43
+ body?: ImportedBody;
44
+ /** 2xx 响应的 JSON Schema */
45
+ responseSchema?: JsonSchema;
46
+ /** 与该接口相关的提示(敏感头替换、不支持的部分等) */
47
+ warnings: string[];
48
+ }
49
+ export type ParseResult = {
50
+ ok: true;
51
+ format: ImportFormat;
52
+ operations: ImportedOperation[];
53
+ /** 汇总提示(含各接口的提示,已带接口前缀) */
54
+ warnings: string[];
55
+ } | {
56
+ ok: false;
57
+ format?: DetectedFormat;
58
+ /** 面向用户的中文错误信息 */
59
+ error: string;
60
+ };
61
+ /** 提示用户把 YAML 转成 JSON 的固定文案 */
62
+ export declare const YAML_HINT = "YAML \u8BF7\u5148\u8F6C\u4E3A JSON \u540E\u518D\u5BFC\u5165";
@@ -0,0 +1,23 @@
1
+ /** 接口导入内部的小工具(纯函数)。 */
2
+ import type { JsonSchema } from './types';
3
+ export declare const HTTP_METHODS: readonly ["get", "post", "put", "delete", "patch", "head", "options"];
4
+ export declare function isPlainObject(v: unknown): v is Record<string, any>;
5
+ /** 去 BOM、首尾空白 */
6
+ export declare function normalizeText(text: string): string;
7
+ /** 把任意名称转为 snake_case 片段(只保留字母数字) */
8
+ export declare function slugify(raw: string, maxLen?: number): string;
9
+ /** 把名称转为 camelCase(用于 `${workflow.input.xxx}`) */
10
+ export declare function camelName(raw: string): string;
11
+ /** 在已有 id 集合内取唯一 id(冲突时追加 _2、_3…),并登记到集合 */
12
+ export declare function uniqueId(base: string, used: Set<string>): string;
13
+ /** 由一个 JSON 示例值推断简单 schema(不含 default) */
14
+ export declare function inferSchema(value: unknown, depth?: number): JsonSchema;
15
+ /** 取 schema 的主类型(忽略 null) */
16
+ export declare function schemaType(schema: JsonSchema | undefined): string;
17
+ /** 简单的 URL 拆分:baseUrl(协议+主机 或 `${...}` 变量)、路径、查询串 */
18
+ export declare function splitUrl(raw: string): {
19
+ baseUrl: string;
20
+ path: string;
21
+ query: string;
22
+ };
23
+ export declare function safeDecode(s: string): string;
package/dist/index.d.ts CHANGED
@@ -6,8 +6,11 @@ export type { AIServiceConfig } from './services/aiService';
6
6
  export type { ExecutionActions, RestartOptions, ViewMode, RunState, WorkflowExecutionInput } from './types/workflow';
7
7
  export { getCompletionItems, buildDataFlowGraph, refactorTaskReferenceName, getUpstreamAncestors, inferTaskOutputSchema, } from './services/wlsp/workflowLsp';
8
8
  export type { WlspCompletionItem, DataFlowGraph, DataFlowEdge, InferredField, UpstreamTaskInfo, } from './services/wlsp/workflowLsp';
9
- export { executeLocalSandboxDryRun, buildDefaultWorkflowMockInput, generateDefaultTaskOutputPreview, } from './utils/localSandboxEngine';
10
- export type { SandboxDryRunOptions, TaskMockOverride, } from './utils/localSandboxEngine';
9
+ export { executeLocalSandboxDryRun, executeLocalSandboxDryRunAsync, buildDefaultWorkflowMockInput, generateDefaultTaskOutputPreview, } from './utils/localSandboxEngine';
10
+ export type { SandboxDryRunOptions, SandboxAsyncOptions, TaskMockOverride, } from './utils/localSandboxEngine';
11
+ export { runJq, JqError } from './utils/sandbox/jq';
12
+ export { createWorkerScriptEvaluator } from './utils/sandbox/scriptRunner';
13
+ export type { ScriptEvaluator, ScriptResult, WorkerScriptEvaluator } from './utils/sandbox/scriptRunner';
11
14
  export * from './actions/types';
12
15
  export { ActionRegistry, defaultActionRegistry } from './actions/registry';
13
16
  export { BUILTIN_ECS_ACTIONS } from './actions/builtin/ecs';
@@ -43,3 +46,19 @@ export type { RunStoryTimelineProps } from './components/business/RunStoryTimeli
43
46
  export * from './library';
44
47
  export type { WorkflowLevel, WorkflowLibraryItem } from './types/workflowLibrary';
45
48
  export type { TaskSchema } from './services/ai/schemaRegistry';
49
+ export { WorkflowIdeProvider, useIdeProviders } from './providers/WorkflowIdeProvider';
50
+ export type { WorkflowIdeProviderProps } from './providers/WorkflowIdeProvider';
51
+ export { resolveProviders, stabilizeProviders } from './providers/resolve';
52
+ export type { ProviderSources } from './providers/resolve';
53
+ export type { IdeProviders, OnboardingProvider, OnboardingContext, ProductInfo, StartTrialResult, PromotionStatus, } from './providers/types';
54
+ export { WorkflowNameBuilder, OnboardingWizard, PromotionPanel, OnboardingGuideCard } from './components/onboarding';
55
+ export type { WorkflowNameBuilderProps, OnboardingWizardProps, OnboardingCreateResult, PromotionPanelProps, OnboardingGuideCardProps, } from './components/onboarding';
56
+ export { buildWorkflowName, validateNameParts, suggestFuncSlug, promotionTargetName, isPromotableName, buildSkeletonWorkflow, nextPollDelay, isTerminalPromotionState, buildPromotionTimeline, promotionStateLabel, pollPromotion, } from './onboarding';
57
+ export type { WorkflowNameParts, PromotionTargetType, SkeletonInput, TimelineItem, PromotionState, StartSource } from './onboarding';
58
+ export { createTelemetryBuffer } from './telemetry/buffer';
59
+ export type { TelemetryBuffer, TelemetryBufferOptions } from './telemetry/buffer';
60
+ export type { TelemetrySink, IdeEvent, IdeEventName } from './telemetry/types';
61
+ export { detectFormat, parseApiText, parseOpenApi3, parseSwagger2, parsePostman21, parseCurl, buildHttpAction, appendImportedActions, sanitizeHeaders, } from './import';
62
+ export type { ImportFormat, DetectedFormat, ImportedOperation, ImportedParam, ImportedBody, ParseResult, BuildHttpActionOptions, } from './import';
63
+ export { ApiImportDialog } from './components/import/ApiImportDialog';
64
+ export type { ApiImportDialogProps, ApiImportInsertInfo } from './components/import/ApiImportDialog';
@@ -5,8 +5,8 @@ import type { LibraryLoadStatus } from './types';
5
5
  * | 场景 | 状态 |
6
6
  * |---|---|
7
7
  * | 步骤未记录版本 | unpinned:沿用原定义,不显示任何提示 |
8
- * | 库中有更高版本 | upgradable:「⬆ 有新版本 vN」,由用户确认差异后手动升级 |
9
- * | 固定版本在库中不存在 / 已下线 | unavailable:「⚠ 版本不可用」,保持原样编译,不自动改版本 |
8
+ * | 库中有更高版本 | upgradable:「有新版本 vN」,由用户确认差异后手动升级 |
9
+ * | 固定版本在库中不存在 / 已下线 | unavailable:「版本不可用」,保持原样编译,不自动改版本 |
10
10
  * | 目录加载中 / 加载失败 | pinned:不显示新版本提示,不影响编辑与编译 |
11
11
  */
12
12
  export type LibraryBadgeState = {
package/dist/logo.svg CHANGED
@@ -1,37 +1,10 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
2
- <defs>
3
- <linearGradient id="bg-grad" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
4
- <stop offset="0%" stop-color="#11172B" />
5
- <stop offset="100%" stop-color="#090D18" />
6
- </linearGradient>
7
- <linearGradient id="border-grad" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
8
- <stop offset="0%" stop-color="#6366F1" stop-opacity="0.75" />
9
- <stop offset="100%" stop-color="#06B6D4" stop-opacity="0.45" />
10
- </linearGradient>
11
- <linearGradient id="branch-top" x1="9" y1="16" x2="23" y2="10" gradientUnits="userSpaceOnUse">
12
- <stop offset="0%" stop-color="#818CF8" />
13
- <stop offset="100%" stop-color="#22D3EE" />
14
- </linearGradient>
15
- <linearGradient id="branch-bottom" x1="9" y1="16" x2="23" y2="22" gradientUnits="userSpaceOnUse">
16
- <stop offset="0%" stop-color="#6366F1" />
17
- <stop offset="100%" stop-color="#34D399" />
18
- </linearGradient>
19
- </defs>
20
-
21
- <!-- Minimalist Squircle Base -->
22
- <rect x="1.25" y="1.25" width="29.5" height="29.5" rx="8" fill="url(#bg-grad)" stroke="url(#border-grad)" stroke-width="1.5" />
23
-
24
- <!-- Bifurcated DAG Flow Curves -->
25
- <path d="M 9.5 16 C 15 16, 15.5 10, 22.5 10" stroke="url(#branch-top)" stroke-width="2.4" stroke-linecap="round" />
26
- <path d="M 9.5 16 C 15 16, 15.5 22, 22.5 22" stroke="url(#branch-bottom)" stroke-width="2.4" stroke-linecap="round" />
27
-
28
- <!-- Origin Root Node -->
29
- <circle cx="9.5" cy="16" r="3.4" fill="#6366F1" />
30
- <circle cx="9.5" cy="16" r="1.4" fill="#F8FAFC" />
31
-
32
- <!-- Upper Branch Target Node -->
33
- <circle cx="22.5" cy="10" r="2.7" fill="#22D3EE" />
34
-
35
- <!-- Lower Branch Deterministic Pass Node -->
36
- <circle cx="22.5" cy="22" r="2.7" fill="#34D399" />
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128">
2
+ <rect width="128" height="128" rx="28" fill="#161311"/>
3
+ <rect x="1" y="1" width="126" height="126" rx="27" fill="none" stroke="#ff6a13" stroke-opacity="0.35" stroke-width="2"/>
4
+ <g transform="translate(18 18) scale(0.92)">
5
+ <g stroke="#ff6a13" stroke-width="3" opacity="0.7"><line x1="50" y1="50" x2="75.5" y2="24.5"/><line x1="50" y1="50" x2="14" y2="50"/><line x1="50" y1="50" x2="75.5" y2="75.5"/></g>
6
+ <path d="M75.46 24.54A36 36 0 1 0 75.46 75.46" fill="none" stroke="#ff6a13" stroke-width="9" stroke-linecap="round"/>
7
+ <g fill="#161311" stroke="#ff6a13" stroke-width="5"><circle cx="75.46" cy="24.54" r="7"/><circle cx="14" cy="50" r="7"/><circle cx="75.46" cy="75.46" r="7"/></g>
8
+ <circle cx="50" cy="50" r="10" fill="#ff6a13"/>
9
+ </g>
37
10
  </svg>
@@ -0,0 +1,6 @@
1
+ export { buildWorkflowName, validateNameParts, suggestFuncSlug, promotionTargetName, isPromotableName, buildSkeletonWorkflow, } from './naming';
2
+ export type { WorkflowNameParts, PromotionTargetType, SkeletonInput } from './naming';
3
+ export { nextPollDelay, isTerminalPromotionState, buildPromotionTimeline, promotionStateLabel, pollPromotion, } from './poll';
4
+ export type { TimelineItem, PollOptions, PromotionState } from './poll';
5
+ export { WIZARD_STEPS, WIZARD_STEP_LABEL, createInitialDraft, validateProductName, productStepError, namingStepErrors, draftToNameParts, canAdvance, nextStep, prevStep, availableSources, } from './wizardState';
6
+ export type { WizardStep, WizardDraft, StartSource } from './wizardState';
@@ -0,0 +1,46 @@
1
+ import type { WorkflowDef } from '../types/conductor';
2
+ import type { WorkflowLevel } from '../types/workflowLibrary';
3
+ import type { WorkflowNameType } from '../library/naming';
4
+ /**
5
+ * 自助接入的命名辅助:纯函数,不依赖 React,可直接单测。
6
+ * 命名规范:`类型-层级-业务域-产品-功能`(见 src/library/naming.ts)。
7
+ */
8
+ /** 申请上线时可选的目标类型 */
9
+ export type PromotionTargetType = 'custom' | 'std';
10
+ /** 五段式名称的各段 */
11
+ export interface WorkflowNameParts {
12
+ type: WorkflowNameType;
13
+ level: WorkflowLevel;
14
+ domain: string;
15
+ product: string;
16
+ func: string;
17
+ }
18
+ /** 拼出完整流程名称。业务域 / 产品段会被去掉 `-`;功能段保持原样(仅去首尾空白,允许含 `-`) */
19
+ export declare function buildWorkflowName(parts: WorkflowNameParts): string;
20
+ /** 校验各段拼出的名称(空段会得到「xx不能为空」类错误),业务域白名单可选 */
21
+ export declare function validateNameParts(parts: WorkflowNameParts, allowedDomains?: string[]): string[];
22
+ /**
23
+ * 由用户输入的功能说明建议「功能」段:
24
+ * - 含中文:保持原样,仅去掉 `-`(避免破坏分段),空白折叠为 `_`;
25
+ * - 纯 ASCII:转小写 snake_case(驼峰拆词,连字符 / 空格 / 其他符号折叠为 `_`)。
26
+ */
27
+ export declare function suggestFuncSlug(text: string): string;
28
+ /**
29
+ * 申请上线后的正式名称:把类型段(第一段)替换为目标类型。
30
+ * 名称不符合五段规范时返回 null。
31
+ */
32
+ export declare function promotionTargetName(tmpName: string, targetType: PromotionTargetType): string | null;
33
+ /** 当前流程名称是否是可申请上线的临时流程(类型段为 tmp) */
34
+ export declare function isPromotableName(name: string | undefined | null): boolean;
35
+ export interface SkeletonInput {
36
+ name: string;
37
+ description?: string;
38
+ ownerEmail?: string;
39
+ }
40
+ /** 向导生成的骨架定义:version 1 / schemaVersion 2,空任务 */
41
+ export declare function buildSkeletonWorkflow(input: SkeletonInput): WorkflowDef;
42
+ /**
43
+ * 保存前的命名提示(设计 3.3,R15):名称不符合五段规范时返回一句提示,符合时返回 null。
44
+ * 只提示、不阻断保存;服务端做权威校验。
45
+ */
46
+ export declare function saveNameHint(name: string | undefined | null, allowedDomains?: string[]): string | null;
@@ -0,0 +1,42 @@
1
+ import type { OnboardingProvider, PromotionStatus } from '../providers/types';
2
+ /** 上线申请轮询:初始间隔、封顶间隔(毫秒) */
3
+ export declare const POLL_BASE_MS = 2000;
4
+ export declare const POLL_MAX_MS = 30000;
5
+ /** 第 attempt 次(从 0 开始)等待的时长:指数退避 2s → 4s → 8s … 封顶 30s */
6
+ export declare function nextPollDelay(attempt: number): number;
7
+ export type PromotionState = PromotionStatus['state'];
8
+ /**
9
+ * 终态:不会再变化,轮询据此停止。只有 SYNCED(已同步到生产)与 REJECTED(已驳回)是终态;
10
+ * APPROVED 之后还要同步,轮询继续(R12)。
11
+ */
12
+ export declare function isTerminalPromotionState(state: PromotionState): boolean;
13
+ export interface TimelineItem {
14
+ state: PromotionState;
15
+ label: string;
16
+ /** done 已完成 / current 进行中 / pending 未到 / failed 被驳回 */
17
+ status: 'done' | 'current' | 'pending' | 'failed';
18
+ }
19
+ export declare function promotionStateLabel(state: PromotionState): string;
20
+ /**
21
+ * 进度时间线。正常路径:已提交 → 审批中 → 审批通过 → 已同步到生产;
22
+ * 被驳回时第三项替换为「已驳回」(failed),之后不再展示「已同步」。
23
+ */
24
+ export declare function buildPromotionTimeline(state: PromotionState | null): TimelineItem[];
25
+ export declare function isAbortError(e: unknown): boolean;
26
+ /** 可被 AbortSignal 打断的等待 */
27
+ export declare function abortableSleep(ms: number, signal?: AbortSignal): Promise<void>;
28
+ export interface PollOptions {
29
+ provider: Pick<OnboardingProvider, 'getPromotion'>;
30
+ requestId: string;
31
+ signal?: AbortSignal;
32
+ /** 每次拿到状态时回调(含终态) */
33
+ onUpdate?: (status: PromotionStatus) => void;
34
+ /** 注入等待函数(测试用),默认 abortableSleep */
35
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
36
+ }
37
+ /**
38
+ * 轮询上线申请直到终态(SYNCED / REJECTED):先立即查一次,之后按 nextPollDelay 退避。
39
+ * APPROVED 不是终态:审批通过后继续轮询,直到同步到生产(SYNCED)。
40
+ * 请求失败直接抛出(由界面显示「重试」);signal 中止时抛 AbortError。
41
+ */
42
+ export declare function pollPromotion(opts: PollOptions): Promise<PromotionStatus>;
@@ -0,0 +1,44 @@
1
+ import type { WorkflowLevel } from '../types/workflowLibrary';
2
+ import type { ProductInfo } from '../providers/types';
3
+ import type { WorkflowNameType } from '../library/naming';
4
+ import type { WorkflowNameParts } from './naming';
5
+ /** 向导步骤:产品 → 命名 → 起点 */
6
+ export type WizardStep = 'product' | 'naming' | 'start';
7
+ export declare const WIZARD_STEPS: readonly WizardStep[];
8
+ export declare const WIZARD_STEP_LABEL: Record<WizardStep, string>;
9
+ export type StartSource = 'blank' | 'template' | 'import';
10
+ export interface WizardDraft {
11
+ /** existing:选择已有产品;new:登记新产品(仅试用环境) */
12
+ productMode: 'existing' | 'new';
13
+ productName: string;
14
+ domain: string;
15
+ systemCode: string;
16
+ type: WorkflowNameType;
17
+ level: WorkflowLevel;
18
+ func: string;
19
+ description: string;
20
+ source: StartSource;
21
+ }
22
+ export interface WizardContextLite {
23
+ trial: boolean;
24
+ products: ProductInfo[];
25
+ }
26
+ /** 初始草稿:有产品时默认选第一个;没有产品时(试用环境)进入登记模式 */
27
+ export declare function createInitialDraft(ctx: WizardContextLite, level?: WorkflowLevel): WizardDraft;
28
+ /** 产品名规则:非空、不含 `-` 与空白(会破坏五段切分) */
29
+ export declare function validateProductName(name: string): string | null;
30
+ /** 第 1 步的校验错误(null = 可继续) */
31
+ export declare function productStepError(draft: WizardDraft, ctx: WizardContextLite, domains: string[]): string | null;
32
+ /** 草稿 → 五段名称 */
33
+ export declare function draftToNameParts(draft: WizardDraft, trial: boolean): WorkflowNameParts;
34
+ /** 第 2 步的校验错误列表 */
35
+ export declare function namingStepErrors(draft: WizardDraft, trial: boolean, domains: string[]): string[];
36
+ /** 当前步骤是否允许进入下一步 */
37
+ export declare function canAdvance(step: WizardStep, draft: WizardDraft, ctx: WizardContextLite, domains: string[]): boolean;
38
+ export declare function nextStep(step: WizardStep): WizardStep;
39
+ export declare function prevStep(step: WizardStep): WizardStep;
40
+ /** 可选的起点:未提供对应回调时隐藏该选项(空白始终可用) */
41
+ export declare function availableSources(opts: {
42
+ hasTemplate: boolean;
43
+ hasImport: boolean;
44
+ }): StartSource[];
@@ -30,7 +30,22 @@ export declare function insertFirstTaskIntoBranch(tasks: TaskDef[] | undefined,
30
30
  branchCase?: string;
31
31
  forkIndex?: number;
32
32
  }, newTask: TaskDef): boolean;
33
+ /** 收集任务树中所有 taskReferenceName */
34
+ export declare function collectTaskRefs(tasks: TaskDef[] | undefined, acc?: Set<string>): Set<string>;
33
35
  /**
34
- * 同步 FORK_JOIN 与配套 JOIN 任务的 joinOn 字段
36
+ * 同步 FORK_JOIN 与配套 JOIN 任务的 joinOn 字段(E5)
37
+ *
38
+ * - 不传 `previousTasks`(加载 / 导入):只给缺失或为空的 joinOn 补齐"各分支最后一个任务",已有 joinOn 原样保留。
39
+ * - 传入 `previousTasks`(编辑操作前的任务树):只更新被结构性编辑影响的那几项——
40
+ * 分支最后一个任务变了就替换对应项、新增 / 原本为空的分支追加其末尾任务、分支变空或任务被删除则移除该项;
41
+ * 用户原本没有 join 的分支保持不 join,其余条目(例如 join 分支中间的任务)不动。
42
+ * 分支结构没有变化时 joinOn 完全不改写。
35
43
  */
36
- export declare function syncForkJoinOn(tasks: TaskDef[] | undefined): void;
44
+ export declare function syncForkJoinOn(tasks: TaskDef[] | undefined, previousTasks?: TaskDef[] | null): void;
45
+ /**
46
+ * 迁移旧版本编辑器写在 WorkflowTask 顶层、Conductor 实际从 inputParameters 读取的字段(E2 / E20)。
47
+ * 只在 inputParameters 中没有同名键时迁移,原地修改。
48
+ */
49
+ export declare function normalizeLegacyTaskFields(tasks: TaskDef[] | undefined): void;
50
+ /** 找到 FORK_JOIN / FORK_JOIN_DYNAMIC 在同层紧随其后的配对 JOIN 引用名(E8) */
51
+ export declare function findPairedJoinRef(tasks: TaskDef[] | undefined, forkRef: string): string | null;