@blueking/bkflow-canvas-editor 1.1.0-beta.9 → 1.2.0-beta.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { ComputedRef, Ref } from 'vue';
2
+ import { Component, ComputedRef, Ref } from 'vue';
3
3
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
4
4
  import * as _blueking_flow_canvas from '@blueking/flow-canvas';
5
5
  import { ZoomToFitOptions, CanvasUiEvent, QuickAddConfig, CanvasSchema, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CanvasToolbarItem, CommandEnvelope } from '@blueking/flow-canvas';
@@ -17,12 +17,7 @@ interface FlowApiConfig {
17
17
  /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
18
18
  xsrfCookieName?: string;
19
19
  /** 作用域数据(必需,由外部传入) */
20
- scopeData: {
21
- scope_type: string;
22
- scope_value: number;
23
- /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
24
- space_id: number;
25
- };
20
+ scopeData: ScopeData;
26
21
  /**
27
22
  * 用户查询 API 地址(可选)
28
23
  * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
@@ -32,6 +27,12 @@ interface FlowApiConfig {
32
27
  /** 是否启用第三方插件(可选,默认为 true) */
33
28
  enableThirdPlugin?: boolean;
34
29
  }
30
+ interface ScopeData {
31
+ scope_type: string;
32
+ scope_value: number;
33
+ /** 业务方传入的空间 ID,语义独立于 scope_value。 */
34
+ space_id: number;
35
+ }
35
36
 
36
37
  type __VLS_Slots$7 = {
37
38
  header?: () => any;
@@ -111,6 +112,11 @@ interface NodeExecutionState {
111
112
  actions?: ExecutionNodeAction[];
112
113
  /** 兼容旧版后端直接透出的动作数组字段 */
113
114
  action_list?: ExecutionNodeAction[];
115
+ /**
116
+ * 条件网关命中的出边 flow_id。
117
+ * 有值时执行态连线优先按它着色,不要求目标节点已经执行(网关单步不会跑下游)。
118
+ */
119
+ selectedFlowIds?: string[];
114
120
  }
115
121
  type TaskExecutionStates = Record<string, NodeExecutionState>;
116
122
 
@@ -118,7 +124,7 @@ type PortOrientation = 'Top' | 'Right' | 'Bottom' | 'Left';
118
124
 
119
125
  type GatewayType = 'ExclusiveGateway' | 'ParallelGateway' | 'ConditionalParallelGateway' | 'ConvergeGateway';
120
126
 
121
- type NodeType = StartEvent | EndEvent | Activity | Gateway;
127
+ type NodeType = StartEvent | EndEvent | Activity | SubProcessActivity | Gateway;
122
128
 
123
129
  interface PluginInputDataItem {
124
130
  value:
@@ -164,29 +170,122 @@ interface Activity {
164
170
  type: 'ServiceActivity';
165
171
  retryable: boolean;
166
172
  skippable: boolean;
173
+ /** 是否可选节点(执行时可选跳过)默认 true */
174
+ optional: boolean;
175
+ auto_retry: {
176
+ enable: boolean;
177
+ interval: number;
178
+ times: number;
179
+ };
180
+ timeout_config: {
181
+ enable: boolean;
182
+ seconds: number;
183
+ action: string;
184
+ };
185
+ status?: NodeExecutionStatus;
186
+ /** 执行态:实际重试次数 */
187
+ retry?: number;
188
+ /** 执行态:是否被跳过 */
189
+ skip?: boolean;
190
+ /** 执行态:是否自动忽略错误 */
191
+ error_ignored?: boolean;
192
+ /** 执行态:循环执行次数(未执行时为 null,与 SubProcessActivity 同源于执行态接口) */
193
+ loop?: number | null;
194
+ /** 执行态:生命周期阶段 */
195
+ phase?: number;
196
+ }
197
+
198
+ /**
199
+ * 循环执行配置(子流程 / 循环容器节点的 loop_config)
200
+ */
201
+ interface LoopConfig {
202
+ /** 是否启用循环执行 */
203
+ enable: boolean;
204
+ /** array_loop 按数组变量循环 / time_loop 固定循环次数 */
205
+ type: 'array_loop' | 'time_loop';
206
+ /** 固定循环次数(time_loop,默认 3,最大 100);array_loop 且数据来源含变量时为 null */
207
+ loop_times?: number | null;
208
+ /**
209
+ * 数组循环变量(array_loop):循环变量名 → 数据来源。
210
+ * 编辑态为 UI 数组 [{name, value}];保存输出为 key-value 对象(如 { '${loop_test1}': '1,2' })。
211
+ */
212
+ loop_params?: { name: string; value: string }[] | Record<string, string>;
213
+ /** 循环失败自动跳过(AS) */
214
+ fail_skip?: boolean;
215
+ /** 循环失败手动重试(MR) */
216
+ retryable?: boolean;
217
+ /** 循环失败手动跳过(MS) */
218
+ skippable?: boolean;
219
+ /** 循环输出变量outputs */
220
+ outputs_key?: string;
221
+ [key: string]: any;
222
+ }
223
+
224
+ /**
225
+ * 子流程(SubProcess)活动节点。
226
+ */
227
+ interface SubProcessActivity {
228
+ id: string;
229
+ name: string;
230
+ stage_name?: string;
231
+ incoming: string[];
232
+ outgoing: string;
233
+ type: 'SubProcess';
234
+ /** 被引用的模板 ID */
235
+ template_id: string | number;
236
+ /** 模板版本 */
237
+ version?: string;
238
+ /** 变量映射常量 */
239
+ constants?: Record<string, any>;
240
+ /** 是否始终使用最新版本 */
241
+ always_use_latest?: boolean;
242
+ /** 生效版本方案列表 */
243
+ scheme_id_list?: string[];
244
+ /** 模板来源 */
245
+ template_source?: string;
246
+ /** 是否自动忽略错误(AS) */
247
+ error_ignorable: boolean;
248
+ /** 是否可手动重试(MR) */
249
+ retryable: boolean;
250
+ /** 是否可手动跳过(MS) */
251
+ skippable: boolean;
252
+ /** 是否可选节点(执行时可选跳过)BKFlow 必填 */
253
+ optional: boolean;
254
+ /** 已勾选(关联全局变量)的 key 列表 */
255
+ hooked_constants?: string[];
256
+ /** 自动重试配置(AR) */
167
257
  auto_retry: {
168
258
  enable: boolean;
169
259
  interval: number;
170
260
  times: number;
171
261
  };
262
+ /** 超时控制配置 */
172
263
  timeout_config: {
173
264
  enable: boolean;
174
265
  seconds: number;
175
266
  action: string;
176
267
  };
268
+ /** 循环执行配置 */
269
+ loop_config?: LoopConfig;
270
+ /** 父级分组 ID(SubCanvas 循环容器嵌套场景),顶层节点为 null */
271
+ parent?: string | null;
272
+ /** 节点标签 */
273
+ labels?: string[];
177
274
  status?: NodeExecutionStatus;
275
+ /** 执行态:循环执行次数(未执行时为 null) */
276
+ loop?: number | null;
178
277
  /** 执行态:实际重试次数 */
179
278
  retry?: number;
180
279
  /** 执行态:是否被跳过 */
181
280
  skip?: boolean;
182
281
  /** 执行态:是否自动忽略错误 */
183
282
  error_ignored?: boolean;
184
- /** 执行态:循环执行次数 */
185
- loop?: number;
186
283
  /** 执行态:生命周期阶段 */
187
284
  phase?: number;
188
285
  }
189
286
 
287
+ type ActivityUnion = Activity | SubProcessActivity;
288
+
190
289
  interface StartEvent {
191
290
  id: string;
192
291
  name: string;
@@ -243,6 +342,7 @@ interface Location {
243
342
  | 'startpoint'
244
343
  | 'endpoint'
245
344
  | 'tasknode'
345
+ | 'subflow'
246
346
  | 'branchgateway'
247
347
  | 'convergegateway'
248
348
  | 'parallelgateway'
@@ -297,7 +397,7 @@ interface Variable {
297
397
  }
298
398
 
299
399
  interface PipelineTree {
300
- activities: Record<string, Activity>;
400
+ activities: Record<string, ActivityUnion>;
301
401
  end_event: EndEvent;
302
402
  flows: Record<string, Flow>;
303
403
  gateways: Record<string, Gateway>;
@@ -415,6 +515,42 @@ interface UniformApiPluginInputsItem$1 {
415
515
  _slots?: Record<string, SlotFieldConfig | SlotArgConfig>;
416
516
  }
417
517
 
518
+ interface SubflowTemplateItem {
519
+ id: number | string;
520
+ name: string;
521
+ /** 模板版本(不传则默认使用最新版本) */
522
+ version?: string;
523
+ /** 展示用副文本(如更新时间 / 描述等,可选) */
524
+ description?: string;
525
+ /** 兼容接入方列表接口的扩展字段 */
526
+ [key: string]: any;
527
+ }
528
+ interface SubflowUpdateItem {
529
+ /** 子流程节点 ID(对应 pipeline_tree.activities 的 key) */
530
+ nodeId: string;
531
+ /** 该节点引用的子流程模板是否有新版本(true 时节点显示红点并计入提示条) */
532
+ expired: boolean;
533
+ /** 子流程模板名称(可选,仅作提示展示) */
534
+ templateName?: string;
535
+ /** 兼容接入方的扩展字段 */
536
+ [key: string]: any;
537
+ }
538
+ interface SubprocessInfoItem {
539
+ /** 子流程模板 ID */
540
+ subprocess_template_id: string | number;
541
+ /** 子流程节点 ID(对应 pipeline_tree.activities 的 key) */
542
+ subprocess_node_id: string;
543
+ /** 节点当前引用的子流程模板版本 */
544
+ version: string;
545
+ /** 是否总是使用最新版本 */
546
+ always_use_latest: boolean;
547
+ /** 引用的子流程模板是否有新版本 */
548
+ expired: boolean;
549
+ /** 子流程模板名称 */
550
+ subprocess_template_name?: string;
551
+ /** 兼容接入方的扩展字段 */
552
+ [key: string]: any;
553
+ }
418
554
  interface FlowTemplate {
419
555
  id: number;
420
556
  name: string;
@@ -424,6 +560,8 @@ interface FlowTemplate {
424
560
  extra_info: Record<string, any>;
425
561
  triggers: TriggerItem[];
426
562
  version: string;
563
+ /** 子流程更新信息(后端计算好 expired 状态,SDK 据此渲染红点/提示条) */
564
+ subprocess_info?: SubprocessInfoItem[];
427
565
  }
428
566
  interface FlowDetailByVersion {
429
567
  constants_not_referred: Record<string, Variable>;
@@ -697,13 +835,181 @@ interface CustomVariableType {
697
835
  code: string;
698
836
  }
699
837
 
838
+ /**
839
+ * filter 变量的宿主配置契约与注入。
840
+ *
841
+ * `RetrievalFilterField` 与 `getValues` 的返回结构和宿主
842
+ * `src/components/bk-monitor-retieval-filter/types.d.ts` 里的 `IFilterField`
843
+ * 逐字段一致——依赖包不带 `.d.ts`,宿主已经自己维护了一份,这里刻意同源,
844
+ * 避免出现两套形状相近但不兼容的类型。
845
+ */
846
+
847
+ /**
848
+ * 关联节点的插件配置摘要。getFields 在节点表单未挂载时要用它自行取维度,
849
+ * 不能依赖「打开过节点配置」留下的内存缓存。
850
+ */
851
+ interface FilterVariableSourceNodeComponent {
852
+ code?: string;
853
+ api_meta?: {
854
+ id?: string;
855
+ };
856
+ data?: Record<string, {
857
+ value?: unknown;
858
+ }>;
859
+ }
860
+ /** 关联来源。创建时由宿主锁定,用户不能在编辑器里改 */
861
+ interface FilterVariableSourceContext {
862
+ sourceNodeId: string;
863
+ sourceNodeName: string;
864
+ /** 关联表单项稳定 KEY,例如 query_condition */
865
+ sourceFieldKey: string;
866
+ sourceFieldName: string;
867
+ /** 关联节点当前 component,供宿主 getFields 在节点配置未打开时解析 */
868
+ sourceNodeComponent?: FilterVariableSourceNodeComponent;
869
+ }
870
+ interface RetrievalFilterField {
871
+ alias: string;
872
+ name: string;
873
+ type: string;
874
+ isEnableOptions?: boolean;
875
+ methods: Array<{
876
+ alias: string;
877
+ value: string;
878
+ placeholder?: string;
879
+ wildcardValue?: string;
880
+ options?: unknown[];
881
+ }>;
882
+ }
883
+ /**
884
+ * 候选值查询参数。
885
+ *
886
+ * 这是适配器归一化之后的稳定形状:依赖组件内部有四条 `getValueFn` 调用路径,
887
+ * 参数形状互不一致(`search`/`field`/`isInit__` vs `where` + `operator` vs
888
+ * `where` + `method`),禁止把 raw params 直接透给宿主。升级依赖时需重新核对。
889
+ */
890
+ interface FilterCandidateQuery {
891
+ field?: string;
892
+ keyword?: string;
893
+ limit?: number;
894
+ method?: string;
895
+ /** 通配搜索路径会带 `options.is_wildcard`,宿主据此选择精确或模糊匹配 */
896
+ isWildcard?: boolean;
897
+ }
898
+ interface FilterVariableConfig {
899
+ /**
900
+ * 宿主注入的 **原始** `RetrievalFilter` 组件,即
901
+ * `import { RetrievalFilter } from '@blueking/monitor-vue3-components'`。
902
+ *
903
+ * 必须是原始组件而不是宿主自己的封装(例如 bk-incident 的
904
+ * `BkMonitorRetievalFilter`):封装层 props 是 `filters/fieldList/query`、事件是
905
+ * `change`,与适配器传入的 `fields/where` + `whereChange` 不兼容;且它的
906
+ * `getValueFn` 只透传 `fields`,会丢掉搜索关键词,候选值搜索无法工作。
907
+ *
908
+ * 编辑器不把该依赖列入自身 dependencies,所以拿不到注入就是不可用。
909
+ */
910
+ retrievalFilterComponent: Component;
911
+ getFields(source: FilterVariableSourceContext): Promise<RetrievalFilterField[]>;
912
+ getValues(source: FilterVariableSourceContext, params: FilterCandidateQuery): Promise<{
913
+ count: number;
914
+ list: Array<{
915
+ id: string;
916
+ name: string;
917
+ }>;
918
+ }>;
919
+ /** 传给依赖组件的 `zIndex`,用于让候选值弹层盖在侧滑之上 */
920
+ popupZIndex?: number;
921
+ loadDelay?: number;
922
+ limit?: number;
923
+ }
924
+ /**
925
+ * 在顶层组件中提供 FilterVariableConfig。
926
+ *
927
+ * 与 `provideMemberSelectorConfig` 一致:`config` 为 undefined 时不调用 provide,
928
+ * 避免遮蔽父级已提供的配置。
929
+ */
930
+ declare function provideFilterVariableConfig(config?: FilterVariableConfig): void;
931
+
932
+ /**
933
+ * filter(复合条件选择)变量的领域逻辑。
934
+ *
935
+ * `Variable.value` 直接就是提交给后端的条件数组 `{ key, operator, value, options }[]`,
936
+ * 不引入编辑态中间形状:编辑器与依赖组件之间只有一处命名差异(`operator` ⇄ `method`),
937
+ * 那一次转换收在适配器边界上(见 retrieval-filter-adapter/index.vue)。
938
+ *
939
+ * 关联标识复用 `Variable.source_info`(C-09),不另立字段。既有的节点删除清理逻辑
940
+ * 原先只放行 component_inputs / component_outputs,已显式把 filter 一并纳入
941
+ * (canvas-adapter/plugin/index.ts 的节点删除,以及 node-config-sideslider 保存时
942
+ * 对照节点数据里是否还引用 `${var}`)。节点删掉或表单里取消引用后不清理,
943
+ * 就会留下用户无法修复的孤儿变量——关联信息是只读的。
944
+ */
945
+
946
+ /**
947
+ * 条件值标量。
948
+ *
949
+ * 必须允许 number:依赖协议里 `value` 是 `number[] | string[]`,整型字段的候选值
950
+ * 就是数字,统一转成字符串会改变提交给后端的类型。
951
+ */
952
+ type FilterConditionValue = string | number;
953
+ /**
954
+ * 单条条件的附加选项。
955
+ *
956
+ * `is_wildcard`(通配匹配)与 `group_relation`(多值关系)由依赖组件在运算符的
957
+ * `methods[].options` 里声明、由用户勾选,并原样带在条件上。丢掉它等于静默改写
958
+ * 用户的选择,所以读写两侧都必须透传,也不做已知字段白名单。
959
+ */
960
+ interface FilterConditionOptions {
961
+ is_wildcard?: boolean;
962
+ group_relation?: boolean;
963
+ [key: string]: unknown;
964
+ }
965
+ /** 单条条件,即 Variable.value 的元素。形状对齐宿主既有协议 */
966
+ interface FilterWhereItem {
967
+ key: string;
968
+ operator: string;
969
+ value: FilterConditionValue[];
970
+ options?: FilterConditionOptions;
971
+ }
972
+ type FilterWhereValue = FilterWhereItem[];
973
+
974
+ /**
975
+ * 全局变量受控创建的对外契约与守卫。
976
+ *
977
+ * filter 变量不能从普通「新建变量」入口创建——它必须携带关联节点与关联字段,
978
+ * 所以对外只暴露这一个方法,由宿主在节点表单里发起。
979
+ */
980
+
981
+ interface OpenFilterVariableCreateRequest {
982
+ defaultCustomType: 'filter';
983
+ /** 关联来源,filter 场景必填 */
984
+ filterContext: FilterVariableSourceContext;
985
+ keyword?: string;
986
+ /**
987
+ * 可选:把宿主表单里已配好的真实维度条件带进来作为默认值。
988
+ * 已 hook 的 `${var}` 占位会被丢掉,不能当默认条件。
989
+ */
990
+ initialValue?: FilterWhereValue;
991
+ onCreated?: (variable: Variable) => void;
992
+ }
993
+ interface OpenStandardVariableCreateRequest {
994
+ defaultCustomType?: string;
995
+ filterContext?: never;
996
+ keyword?: string;
997
+ cursorIndex?: number;
998
+ onCreated?: (variable: Variable) => void;
999
+ }
1000
+ type OpenGlobalVariableCreateRequest = OpenFilterVariableCreateRequest | OpenStandardVariableCreateRequest;
1001
+
700
1002
  /** 画布视口相关方法,供 FlowView / FlowEdit 对外透传 */
701
1003
  interface CanvasViewportExpose {
702
1004
  zoomToFit: (options?: ZoomToFitOptions) => void;
703
1005
  centerContent: () => void;
704
1006
  getZoom: () => number;
705
1007
  }
706
- interface FlowEditExpose extends CanvasViewportExpose {
1008
+ /** 受控创建能力。返回 false 表示未通过同步守卫,开发态会打印具体原因 */
1009
+ interface GlobalVariableCreateExpose {
1010
+ openGlobalVariableCreate: (request?: OpenGlobalVariableCreateRequest) => boolean;
1011
+ }
1012
+ interface FlowEditExpose extends CanvasViewportExpose, GlobalVariableCreateExpose {
707
1013
  isFlowEdited: boolean;
708
1014
  updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
709
1015
  openGlobalVariables: () => void;
@@ -711,7 +1017,7 @@ interface FlowEditExpose extends CanvasViewportExpose {
711
1017
  interface FlowViewExpose extends CanvasViewportExpose {
712
1018
  }
713
1019
  /** FlowDetail 统一详情页对外暴露(设计 §7.1) */
714
- interface FlowDetailExpose extends CanvasViewportExpose {
1020
+ interface FlowDetailExpose extends CanvasViewportExpose, GlobalVariableCreateExpose {
715
1021
  isFlowEdited: boolean;
716
1022
  updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
717
1023
  openGlobalVariables: () => void;
@@ -720,13 +1026,12 @@ interface FlowDetailExpose extends CanvasViewportExpose {
720
1026
  }
721
1027
 
722
1028
  type DebugContextStatus = 'idle' | 'running' | 'terminating';
723
- type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'suspended' | 'skipped';
1029
+ type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'revoked' | 'suspended' | 'skipped';
724
1030
  type DebugExecutionMode = 'real' | 'mock';
725
1031
  interface DebugMissingVar {
726
1032
  key: string;
727
1033
  source_node_id: string | null;
728
1034
  }
729
- type DebugRunMode = DebugExecutionMode | 'mixed';
730
1035
  type DebugRunType = 'global' | 'step';
731
1036
  type DebugRunStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'terminating' | 'finished' | 'failed' | 'revoked';
732
1037
  /** 运行级 / 节点级错误详情(last_error_detail、nodes[].error_detail)。 */
@@ -743,6 +1048,15 @@ interface DebugErrorDetail {
743
1048
  failures?: DebugErrorFailure[];
744
1049
  [key: string]: unknown;
745
1050
  }
1051
+ /** 条件网关分支求值结果(`debug_context.nodes[].condition_results`)。 */
1052
+ interface DebugConditionResult {
1053
+ flow_id: string;
1054
+ name?: string;
1055
+ expression?: string;
1056
+ resolved_expression?: string;
1057
+ matched?: boolean;
1058
+ [key: string]: unknown;
1059
+ }
746
1060
  interface DebugContextNode {
747
1061
  node_id: string;
748
1062
  node_type: string;
@@ -751,6 +1065,10 @@ interface DebugContextNode {
751
1065
  can_step: boolean;
752
1066
  missing_vars: DebugMissingVar[];
753
1067
  waiting_reason?: string | null;
1068
+ /** 是否支持单步调试;并行/汇聚网关为 false,仅用于展示全局调试状态。 */
1069
+ supports_step?: boolean;
1070
+ /** 是否支持 Mock;全部网关为 false。 */
1071
+ supports_mock?: boolean;
754
1072
  mock_result?: 'success' | 'fail' | null;
755
1073
  error_detail?: DebugErrorDetail | string | null;
756
1074
  duration_ms?: number | null;
@@ -762,6 +1080,10 @@ interface DebugContextNode {
762
1080
  mock_outputs?: Record<string, unknown> | null;
763
1081
  mock_error?: string | null;
764
1082
  outputs?: Record<string, unknown> | null;
1083
+ /** 条件网关命中的出边 flow_id;画布用它把命中连线标绿。 */
1084
+ selected_flow_ids?: string[];
1085
+ /** 条件网关每个分支的表达式与命中结果。 */
1086
+ condition_results?: DebugConditionResult[];
765
1087
  }
766
1088
  /**
767
1089
  * /debug_context/ 顶层结构。
@@ -800,28 +1122,10 @@ interface DebugInputSchema {
800
1122
  constants?: Record<string, unknown>;
801
1123
  [key: string]: unknown;
802
1124
  }
803
- interface DebugHistoryRun {
804
- task_id?: number | string | null;
805
- operator?: string;
806
- started_at?: string;
807
- finished_at?: string;
808
- status?: DebugRunStatus | string;
809
- run_type?: DebugRunType;
810
- run_mode?: DebugRunMode;
811
- [key: string]: unknown;
812
- }
813
- interface DebugHistory {
814
- runs?: DebugHistoryRun[];
815
- [key: string]: unknown;
816
- }
817
1125
  interface DebugResetImpact {
818
1126
  reset_node_ids: string[];
819
1127
  reasons?: Record<string, string>;
820
1128
  }
821
- interface DebugGlobalVarsResult {
822
- global_vars: Record<string, unknown>;
823
- [key: string]: unknown;
824
- }
825
1129
  interface UpdateNodeDebugMockResult {
826
1130
  node_id: string;
827
1131
  execution_mode: DebugExecutionMode;
@@ -835,6 +1139,8 @@ interface RunNodeDebugStepResult {
835
1139
  error_detail?: unknown;
836
1140
  updated_global_vars?: Record<string, unknown>;
837
1141
  log_ref?: DebugContextNode['log_ref'];
1142
+ selected_flow_ids?: string[];
1143
+ condition_results?: DebugConditionResult[];
838
1144
  [key: string]: unknown;
839
1145
  }
840
1146
  interface RunGlobalDebugResult {
@@ -842,19 +1148,22 @@ interface RunGlobalDebugResult {
842
1148
  status: DebugContextStatus;
843
1149
  [key: string]: unknown;
844
1150
  }
1151
+ /**
1152
+ * /debug_terminate/ 返回。
1153
+ *
1154
+ * 全局终止返回 `terminating`,需要继续轮询 /debug_context/ 直到 idle + last_run_status=revoked;
1155
+ * 单节点终止直接返回 `idle`,并用 reset_node_ids 告知哪些节点被恢复为「未调试」。
1156
+ */
845
1157
  interface TerminateDebugResult {
846
1158
  status?: DebugContextStatus;
1159
+ /** 单节点终止:被恢复为 not_run 的节点,本地需同步清空输入、输出、耗时、错误与日志。 */
1160
+ reset_node_ids?: string[];
847
1161
  [key: string]: unknown;
848
1162
  }
849
1163
  interface DebugResetResult {
850
1164
  reset_node_ids?: string[];
851
1165
  [key: string]: unknown;
852
1166
  }
853
- interface UpdateDebugContextVariableParams {
854
- templateId: string | number;
855
- key: string;
856
- value: unknown;
857
- }
858
1167
  interface UpdateNodeDebugMockParams {
859
1168
  templateId: string | number;
860
1169
  nodeId: string;
@@ -887,9 +1196,7 @@ interface ResetDebugResultParams {
887
1196
  interface DebugApiServices {
888
1197
  fetchDebugContext(templateId: string | number): Promise<DebugContext>;
889
1198
  fetchDebugInputSchema(templateId: string | number): Promise<DebugInputSchema>;
890
- fetchDebugHistory(templateId: string | number): Promise<DebugHistory>;
891
1199
  fetchDebugResetImpact(templateId: string | number): Promise<DebugResetImpact>;
892
- updateDebugContextVariable(params: UpdateDebugContextVariableParams): Promise<DebugGlobalVarsResult>;
893
1200
  updateNodeDebugMock(params: UpdateNodeDebugMockParams): Promise<UpdateNodeDebugMockResult>;
894
1201
  runNodeDebugStep(params: RunNodeDebugStepParams): Promise<RunNodeDebugStepResult>;
895
1202
  runGlobalDebug(params: RunGlobalDebugParams): Promise<RunGlobalDebugResult>;
@@ -925,6 +1232,7 @@ interface FetchTaskStateParams {
925
1232
  interface FetchTaskNodeDetailParams {
926
1233
  task_id: number | string;
927
1234
  node_id: string;
1235
+ component_code?: string;
928
1236
  }
929
1237
  interface FetchTaskNodeSnapshotParams {
930
1238
  task_id: number | string;
@@ -950,6 +1258,8 @@ interface FlowTaskDetail {
950
1258
  id: number | string;
951
1259
  template_id: number;
952
1260
  pipeline_tree: PipelineTree;
1261
+ /** 任务已耗时(秒),调试摘要弹层刷新恢复用。 */
1262
+ elapsed_time?: number;
953
1263
  [key: string]: unknown;
954
1264
  }
955
1265
  interface CreateFlowTaskParams {
@@ -1016,7 +1326,7 @@ interface FlowViewApiConfig {
1016
1326
  space_id: number;
1017
1327
  };
1018
1328
  fetchFlowDraftDetail?: (id: string) => Promise<FlowDraftDetail>;
1019
- fetchFlowDetailByVersion?: (id: string, version: string) => Promise<FlowDetailByVersion>;
1329
+ fetchFlowDetailByVersion?: (id: string, version?: string) => Promise<FlowDetailByVersion>;
1020
1330
  fetchVariableRef?: (params: {
1021
1331
  template_id: number;
1022
1332
  activities: Record<string, any>;
@@ -1070,6 +1380,10 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
1070
1380
  saveFlow: (id: string, params: UpdateFlowParams) => Promise<void>;
1071
1381
  fetchBkFlowInnerPluginList: () => Promise<BkflowInnerPluginMetaItem[]>;
1072
1382
  fetchBkFlowInnerPluginDetail: (code: string, version: string) => Promise<BkflowInnerPluginMetaItem>;
1383
+ fetchSubprocessOutput: (params?: {
1384
+ code?: string;
1385
+ version?: string;
1386
+ }) => Promise<BkflowInnerPluginMetaItem>;
1073
1387
  fetchInnerVariableDetail: (code: string) => Promise<BkflowInnerPluginMetaItem>;
1074
1388
  fetchBkFlowThirdPartyPluginList: (tag: number) => Promise<{
1075
1389
  data: {
@@ -1090,6 +1404,20 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
1090
1404
  fetchPluginGroupList: () => Promise<PluginGroupConfig[]>;
1091
1405
  fetchCategoryPlugins: (category: string) => Promise<PluginMetaItem[]>;
1092
1406
  fetchAllPluginGroups: () => Promise<GroupsPluginItem[]>;
1407
+ /**
1408
+ * 获取子流程模板列表
1409
+ */
1410
+ fetchSubflowTemplateList?: (params: {
1411
+ /** 每页条数 */
1412
+ limit: number;
1413
+ /** 偏移量 */
1414
+ offset: number;
1415
+ /** 名称模糊搜索*/
1416
+ keyword?: string;
1417
+ }) => Promise<{
1418
+ results: SubflowTemplateItem[];
1419
+ count: number;
1420
+ }>;
1093
1421
  enableThirdPlugin?: boolean;
1094
1422
  fetchPluginDetail?: (id: string) => Promise<UniformApiPluginDetail>;
1095
1423
  fetchApplyInstructionData?: (params: any) => Promise<any>;
@@ -1362,6 +1690,8 @@ type __VLS_Props$4 = {
1362
1690
  onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
1363
1691
  bkflowSaasUrl?: string;
1364
1692
  memberSelectorConfig?: MemberSelectorConfig;
1693
+ /** 执行时填写 filter 变量条件所需的能力;不传则这类变量退化为只读文本 */
1694
+ filterVariableConfig?: FilterVariableConfig;
1365
1695
  };
1366
1696
  declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1367
1697
  close: (...args: any[]) => void;
@@ -1394,6 +1724,12 @@ declare namespace __create_task_vue {
1394
1724
  };
1395
1725
  }
1396
1726
 
1727
+ interface CreateVariablePayload {
1728
+ keyword?: string;
1729
+ cursorIndex?: number;
1730
+ defaultCustomType?: string;
1731
+ }
1732
+
1397
1733
  type __VLS_Slots$3 = {
1398
1734
  header?: () => any;
1399
1735
  inputParams?: (props: {
@@ -1432,6 +1768,8 @@ type __VLS_Props$3 = {
1432
1768
  useCustomDebugConfirm?: boolean;
1433
1769
  selectPanelConfig?: SelectPanelConfig;
1434
1770
  memberSelectorConfig?: MemberSelectorConfig;
1771
+ /** 复合条件选择(filter)变量的宿主配置;不传则该类型变量不可用,其余功能不受影响 */
1772
+ filterVariableConfig?: FilterVariableConfig;
1435
1773
  onSave?: (flowData: FlowTemplate) => void;
1436
1774
  onSaveSuccess?: () => void;
1437
1775
  onBack?: () => void;
@@ -1441,6 +1779,7 @@ type __VLS_Props$3 = {
1441
1779
  taskId: number | string;
1442
1780
  templateId: number | string;
1443
1781
  }) => void;
1782
+ onSubflowView?: (template: SubflowTemplateItem) => void;
1444
1783
  enableVersion?: boolean;
1445
1784
  flowVersion?: string;
1446
1785
  defaultZoom?: number;
@@ -1449,11 +1788,13 @@ type __VLS_Props$3 = {
1449
1788
  quickAdd?: QuickAddConfig;
1450
1789
  /** 是否隐藏基础信息中的触发器配置表单,默认 false */
1451
1790
  hideTrigger?: boolean;
1791
+ subflowUpdateList?: SubflowUpdateItem[];
1452
1792
  };
1453
1793
  declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$3, {
1454
1794
  isFlowEdited: ComputedRef<FlowEditExpose["isFlowEdited"]>;
1455
1795
  updateNodeInputParams: FlowEditExpose["updateNodeInputParams"];
1456
1796
  openGlobalVariables: FlowEditExpose["openGlobalVariables"];
1797
+ openGlobalVariableCreate: FlowEditExpose["openGlobalVariableCreate"];
1457
1798
  zoomToFit: FlowEditExpose["zoomToFit"];
1458
1799
  centerContent: FlowEditExpose["centerContent"];
1459
1800
  getZoom: FlowEditExpose["getZoom"];
@@ -1467,10 +1808,8 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$3, {
1467
1808
  saveSuccess: () => any;
1468
1809
  exitEdit: () => any;
1469
1810
  debugBeforeClose: () => any;
1470
- createVariable: (payload: {
1471
- keyword: string;
1472
- cursorIndex: number;
1473
- }) => any;
1811
+ createVariable: (payload: CreateVariablePayload) => any;
1812
+ subflowView: (template: SubflowTemplateItem) => any;
1474
1813
  }, string, vue.PublicProps, Readonly<__VLS_Props$3> & Readonly<{
1475
1814
  onBack?: (() => any) | undefined;
1476
1815
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
@@ -1481,10 +1820,8 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$3, {
1481
1820
  onSaveSuccess?: (() => any) | undefined;
1482
1821
  onExitEdit?: (() => any) | undefined;
1483
1822
  onDebugBeforeClose?: (() => any) | undefined;
1484
- onCreateVariable?: ((payload: {
1485
- keyword: string;
1486
- cursorIndex: number;
1487
- }) => any) | undefined;
1823
+ onCreateVariable?: ((payload: CreateVariablePayload) => any) | undefined;
1824
+ onSubflowView?: ((template: SubflowTemplateItem) => any) | undefined;
1488
1825
  }>, {
1489
1826
  quickAdd: QuickAddConfig;
1490
1827
  enableThirdPlugin: boolean;
@@ -1562,6 +1899,7 @@ type __VLS_Props$2 = {
1562
1899
  }) => void;
1563
1900
  /** 是否隐藏基础信息中的触发器配置表单,默认 false */
1564
1901
  hideTrigger?: boolean;
1902
+ subflowUpdateList?: SubflowUpdateItem[];
1565
1903
  };
1566
1904
  declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$2, {
1567
1905
  zoomToFit: (options?: ZoomToFitOptions) => void;
@@ -1614,6 +1952,7 @@ declare namespace __view_vue {
1614
1952
  interface FlowDetailPermissions {
1615
1953
  canEdit: boolean;
1616
1954
  canDebug: boolean;
1955
+ canExecute: boolean;
1617
1956
  }
1618
1957
 
1619
1958
  type __VLS_Slots$1 = {
@@ -1633,6 +1972,12 @@ type __VLS_Slots$1 = {
1633
1972
  updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
1634
1973
  updateVariableSourceInfo: (variableKey: string, nodeId: string, formKey: string) => void;
1635
1974
  }) => any;
1975
+ customFormContent?: (props: {
1976
+ customFormData: Record<string, any>;
1977
+ additionalTaskParams: Record<string, any>;
1978
+ updateCustomFormData: (data: Record<string, any>) => void;
1979
+ updateAdditionalTaskParams: (params: Record<string, any>) => void;
1980
+ }) => any;
1636
1981
  };
1637
1982
  type __VLS_Props$1 = {
1638
1983
  flowId: string;
@@ -1647,14 +1992,18 @@ type __VLS_Props$1 = {
1647
1992
  hideTrigger?: boolean;
1648
1993
  selectPanelConfig?: SelectPanelConfig;
1649
1994
  memberSelectorConfig?: MemberSelectorConfig;
1995
+ /** 复合条件选择(filter)变量的宿主配置;不传则该类型变量不可用,其余功能不受影响 */
1996
+ filterVariableConfig?: FilterVariableConfig;
1650
1997
  onSave?: (flowData: FlowTemplate) => void;
1651
1998
  onSaveSuccess?: () => void;
1999
+ onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
1652
2000
  onBack?: () => void;
1653
2001
  };
1654
2002
  declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {
1655
2003
  isFlowEdited: ComputedRef<boolean>;
1656
2004
  updateNodeInputParams: FlowDetailExpose["updateNodeInputParams"];
1657
2005
  openGlobalVariables: FlowDetailExpose["openGlobalVariables"];
2006
+ openGlobalVariableCreate: FlowDetailExpose["openGlobalVariableCreate"];
1658
2007
  refreshDebugContext: FlowDetailExpose["refreshDebugContext"];
1659
2008
  openDebugResult: FlowDetailExpose["openDebugResult"];
1660
2009
  zoomToFit: FlowDetailExpose["zoomToFit"];
@@ -1664,18 +2013,14 @@ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {
1664
2013
  back: () => any;
1665
2014
  save: (flowData: FlowTemplate) => any;
1666
2015
  saveSuccess: () => any;
1667
- createVariable: (payload: {
1668
- keyword: string;
1669
- cursorIndex: number;
1670
- }) => any;
2016
+ createVariable: (payload: CreateVariablePayload) => any;
2017
+ executeSuccess: (result: FlowTaskExecuteSuccessResult) => any;
1671
2018
  }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1672
2019
  onBack?: (() => any) | undefined;
1673
2020
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
1674
2021
  onSaveSuccess?: (() => any) | undefined;
1675
- onCreateVariable?: ((payload: {
1676
- keyword: string;
1677
- cursorIndex: number;
1678
- }) => any) | undefined;
2022
+ onCreateVariable?: ((payload: CreateVariablePayload) => any) | undefined;
2023
+ onExecuteSuccess?: ((result: FlowTaskExecuteSuccessResult) => any) | undefined;
1679
2024
  }>, {
1680
2025
  quickAdd: QuickAddConfig;
1681
2026
  enableThirdPlugin: boolean;
@@ -1741,10 +2086,19 @@ declare function isMockableNode(node: NodeType | Activity | undefined | null): n
1741
2086
  declare const random4: () => string;
1742
2087
  declare const generateId: (group?: number) => string;
1743
2088
 
2089
+ interface ValidatePipelineTreeOptions {
2090
+ /**
2091
+ * 需要「已配置插件」的节点集合,不传时要求全部节点均已配置。
2092
+ *
2093
+ * 单步 / Mock 调试只依赖目标节点自身的配置(后端 step_run 用目标节点单独拼一棵最小流程树),
2094
+ * 画布其余未配置节点不影响调试,因此这类场景只传目标节点,允许空节点先存为草稿。
2095
+ */
2096
+ requireConfiguredNodeIds?: string[];
2097
+ }
1744
2098
  /**
1745
2099
  * 画布pipeline_tree数据校验
1746
2100
  */
1747
- declare const validatePipelineTree: (pipelineTree: PipelineTree) => {
2101
+ declare const validatePipelineTree: (pipelineTree: PipelineTree, options?: ValidatePipelineTreeOptions) => {
1748
2102
  valid: boolean;
1749
2103
  message: string;
1750
2104
  ids: string[];
@@ -1787,6 +2141,13 @@ declare class BkFlowNodeAccessor {
1787
2141
  get convergeGatewayId(): string | undefined;
1788
2142
  get isGateway(): boolean;
1789
2143
  get isTask(): boolean;
2144
+ get templateId(): string | number | undefined;
2145
+ get subflowConstants(): Record<string, any> | undefined;
2146
+ get subflowVersion(): string | undefined;
2147
+ get alwaysUseLatest(): boolean | undefined;
2148
+ get schemeIdList(): string[] | undefined;
2149
+ get templateSource(): string | undefined;
2150
+ get isSubflow(): boolean;
1790
2151
  get nodeModel(): FlowNodeModel;
1791
2152
  }
1792
2153
  declare class BkFlowModelAccessor {
@@ -1810,10 +2171,23 @@ declare class BkFlowModelAccessor {
1810
2171
  */
1811
2172
  interface DebugCanvasContext {
1812
2173
  isMockNode(nodeId: string): boolean;
2174
+ /** 节点调试状态;任务节点用它补充未执行(not_run)标识,不写入连线执行态。 */
2175
+ getNodeStatus?(nodeId: string): string | undefined;
1813
2176
  /** 当前独立调试聚焦节点(不复用 X6 编辑选择态,设计 §9.3.2) */
1814
2177
  focusedNodeId?(): string;
1815
2178
  /** 打开该节点详情侧滑的“调试配置”Tab */
1816
2179
  openNodeDebugPanel?(nodeId: string): void;
2180
+ /** 调试锁定期(running/terminating);节点配置据此展示只读说明 Alert */
2181
+ isLocked?(): boolean;
2182
+ }
2183
+ interface SubflowUpdateCanvasContext {
2184
+ /** 节点是否引用了已过期的子流程模板(红点显隐) */
2185
+ isNodeExpired(nodeId: string): boolean;
2186
+ /**
2187
+ * 红点动画的重播序号(每次"查看需要更新的子流程"定位时递增)。
2188
+ * 节点用其作 :key 重挂载红点元素以重新触发 ripple 动画;未实现时返回 0(仅首轮动画)。
2189
+ */
2190
+ getDotEpoch?(nodeId: string): number;
1817
2191
  }
1818
2192
 
1819
2193
  type __VLS_Props = {
@@ -1828,6 +2202,7 @@ type __VLS_Props = {
1828
2202
  toolbarItems?: CanvasToolbarItem[];
1829
2203
  simulateDebugContext?: SimulateDebugCanvasContext;
1830
2204
  debugContext?: DebugCanvasContext;
2205
+ subflowUpdateContext?: SubflowUpdateCanvasContext;
1831
2206
  };
1832
2207
  declare var __VLS_8: {};
1833
2208
  declare var __VLS_22: {
@@ -2003,5 +2378,5 @@ declare const _default: {
2003
2378
  FlowMockDebug: () => Promise<typeof __mock_vue>;
2004
2379
  };
2005
2380
 
2006
- export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$5 as FlowCreateTask, _default$7 as FlowDebug, _default$2 as FlowDetail, _default$4 as FlowEdit, _default$6 as FlowExecute, _default$8 as FlowMockDebug, _default$3 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, isMockableNode, mergeOutputs, normalizePluginOutputItems, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, random4, resolveExecutionActions, resolveMockFormControl, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
2007
- export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FlowApiConfig, FlowDetailExpose, FlowDetailPermissions, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, MemberSelectorConfig, MockOutputField, NodeExecutionState, NodeExecutionStatus, NodeMockConfig, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SimulateDebugCanvasContext, SimulateDebugStage, SimulateDebugState, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };
2381
+ export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$5 as FlowCreateTask, _default$7 as FlowDebug, _default$2 as FlowDetail, _default$4 as FlowEdit, _default$6 as FlowExecute, _default$8 as FlowMockDebug, _default$3 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, isMockableNode, mergeOutputs, normalizePluginOutputItems, provideFilterVariableConfig, provideFlowApiConfig, provideMemberSelectorConfig, provideSelectPanelConfig, random4, resolveExecutionActions, resolveMockFormControl, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useMemberSelectorConfig, useSelectPanelConfig, validatePipelineTree };
2382
+ export type { Activity, CanvasViewportExpose, CreateFlowTaskResult, DndNodeItem, ExecuteFlowTaskResult, ExecutionNodeAction, FilterCandidateQuery, FilterConditionOptions, FilterConditionValue, FilterVariableConfig, FilterVariableSourceContext, FilterVariableSourceNodeComponent, FilterWhereItem, FilterWhereValue, FlowApiConfig, FlowDetailExpose, FlowDetailPermissions, FlowEditExpose, FlowTaskExecuteSuccessResult, FlowTemplate, FlowViewExpose, Gateway, GatewayCondition, GlobalVariableCreateExpose, MemberSelectorConfig, MockOutputField, NodeExecutionState, NodeExecutionStatus, NodeMockConfig, NotifyConfig, OpenFilterVariableCreateRequest, OpenGlobalVariableCreateRequest, OpenStandardVariableCreateRequest, PipelineTree, PluginDetailCommon, PluginInputDataItem, RetrievalFilterField, SelectPanelConfig, SimulateDebugCanvasContext, SimulateDebugStage, SimulateDebugState, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };