@blueking/bkflow-canvas-editor 1.1.0-beta.0 → 1.1.0-beta.10

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
@@ -2,13 +2,79 @@ import * as vue from 'vue';
2
2
  import { ComputedRef, Ref } from 'vue';
3
3
  import { AxiosInstance, AxiosRequestConfig } from 'axios';
4
4
  import * as _blueking_flow_canvas from '@blueking/flow-canvas';
5
- import { CanvasUiEvent, QuickAddConfig, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CommandEnvelope, CanvasSchema } from '@blueking/flow-canvas';
6
- export { InsertDirection, QuickAddConfig, QuickAddInsertDirectionResolver, QuickAddPortResolver } from '@blueking/flow-canvas';
5
+ import { ZoomToFitOptions, CanvasUiEvent, QuickAddConfig, CanvasSchema, FlowModel, FlowNodeModel, NodeActionsConfig, ConnectionValidator, CanvasPlugin, CanvasToolbarItem, CommandEnvelope } from '@blueking/flow-canvas';
7
6
 
8
- type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED';
7
+ /**
8
+ * Flow API 配置接口
9
+ */
10
+ interface FlowApiConfig {
11
+ /** API 基础路径 */
12
+ baseURL?: string;
13
+ /** 自定义 axios 实例(可选,如果提供则优先使用) */
14
+ axiosInstance?: AxiosInstance;
15
+ /** axios 配置(可选,用于创建新的 axios 实例) */
16
+ axiosConfig?: AxiosRequestConfig;
17
+ /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
18
+ xsrfCookieName?: string;
19
+ /** 作用域数据(必需,由外部传入) */
20
+ scopeData: {
21
+ scope_type: string;
22
+ scope_value: number;
23
+ /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
24
+ space_id: number;
25
+ };
26
+ /**
27
+ * 用户查询 API 地址(可选)
28
+ * @deprecated 请改用 FlowEdit/FlowView 顶层组件的 `memberSelectorConfig.fetchUserApi`。
29
+ * 该字段仅保留向后兼容,未来版本会移除。
30
+ */
31
+ fetchUserApi?: string;
32
+ /** 是否启用第三方插件(可选,默认为 true) */
33
+ enableThirdPlugin?: boolean;
34
+ }
35
+
36
+ type __VLS_Slots$7 = {
37
+ header?: () => any;
38
+ extend?: () => any;
39
+ };
40
+ type __VLS_Props$7 = {
41
+ flowId: string;
42
+ taskId: string | number;
43
+ apiConfig: FlowApiConfig;
44
+ bkflowSaasUrl?: string;
45
+ defaultZoom?: number;
46
+ onBack?: () => void;
47
+ };
48
+ declare const __VLS_base$7: vue.DefineComponent<__VLS_Props$7, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
49
+ back: () => any;
50
+ }, string, vue.PublicProps, Readonly<__VLS_Props$7> & Readonly<{
51
+ onBack?: (() => any) | undefined;
52
+ }>, {
53
+ defaultZoom: number;
54
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
55
+ declare const __VLS_export$7: __VLS_WithSlots$7<typeof __VLS_base$7, __VLS_Slots$7>;
56
+ declare const _default$8: typeof __VLS_export$7;
57
+
58
+ type __VLS_WithSlots$7<T, S> = T & {
59
+ new (): {
60
+ $slots: S;
61
+ };
62
+ };
63
+
64
+ declare namespace __mock_vue {
65
+ export {
66
+ _default$8 as default,
67
+ };
68
+ }
69
+
70
+ type NodeExecutionStatus = 'CREATED' | 'RUNNING' | 'FINISHED' | 'FAILED' | 'SUSPENDED' | 'REVOKED' | 'SKIP';
9
71
  type ExecutionNodeAction = 'retry' | 'skip' | 'resume' | 'approve' | 'forceFail' | 'gatewaySkip';
10
72
  interface NodeExecutionState {
11
73
  status: NodeExecutionStatus;
74
+ version?: string;
75
+ start_time?: string;
76
+ finish_time?: string;
77
+ elapsed_time?: number;
12
78
  /** 旧版任务引擎的 task 状态,优先用于识别 REVOKED */
13
79
  taskState?: string;
14
80
  /** 兼容旧版 snake_case 字段 */
@@ -52,6 +118,8 @@ type PortOrientation = 'Top' | 'Right' | 'Bottom' | 'Left';
52
118
 
53
119
  type GatewayType = 'ExclusiveGateway' | 'ParallelGateway' | 'ConditionalParallelGateway' | 'ConvergeGateway';
54
120
 
121
+ type NodeType = StartEvent | EndEvent | Activity | Gateway;
122
+
55
123
  interface PluginInputDataItem {
56
124
  value:
57
125
  | string
@@ -507,6 +575,19 @@ interface DndNodeItem {
507
575
  disabledTip?: string;
508
576
  tipsImage?: string;
509
577
  }
578
+ interface UniformApiPluginOutputItem {
579
+ key: string;
580
+ name?: string;
581
+ type?: string;
582
+ description?: string;
583
+ schema?: Record<string, any>;
584
+ form_type?: string;
585
+ options?: Array<{
586
+ label?: string;
587
+ value?: unknown;
588
+ text?: string;
589
+ }>;
590
+ }
510
591
  interface UniformApiPluginDetail {
511
592
  alias: string;
512
593
  bk_tenant_id: string;
@@ -521,7 +602,7 @@ interface UniformApiPluginDetail {
521
602
  url: string;
522
603
  methods: string[];
523
604
  inputs: Record<string, any>;
524
- outputs: string[];
605
+ outputs?: Array<UniformApiPluginOutputItem | string>;
525
606
  scope_id: string;
526
607
  sign: string;
527
608
  updated_at: string;
@@ -616,33 +697,204 @@ interface CustomVariableType {
616
697
  code: string;
617
698
  }
618
699
 
619
- interface FlowEditExpose {
700
+ /** 画布视口相关方法,供 FlowView / FlowEdit 对外透传 */
701
+ interface CanvasViewportExpose {
702
+ zoomToFit: (options?: ZoomToFitOptions) => void;
703
+ centerContent: () => void;
704
+ getZoom: () => number;
705
+ }
706
+ interface FlowEditExpose extends CanvasViewportExpose {
620
707
  isFlowEdited: boolean;
621
708
  updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
622
709
  openGlobalVariables: () => void;
623
710
  }
711
+ interface FlowViewExpose extends CanvasViewportExpose {
712
+ }
713
+ /** FlowDetail 统一详情页对外暴露(设计 §7.1) */
714
+ interface FlowDetailExpose extends CanvasViewportExpose {
715
+ isFlowEdited: boolean;
716
+ updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
717
+ openGlobalVariables: () => void;
718
+ refreshDebugContext: () => Promise<void>;
719
+ openDebugResult: (nodeId?: string) => void;
720
+ }
624
721
 
722
+ type DebugContextStatus = 'idle' | 'running' | 'terminating';
723
+ type DebugNodeStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'finished' | 'failed' | 'suspended' | 'skipped';
724
+ type DebugExecutionMode = 'real' | 'mock';
725
+ interface DebugMissingVar {
726
+ key: string;
727
+ source_node_id: string | null;
728
+ }
729
+ type DebugRunMode = DebugExecutionMode | 'mixed';
730
+ type DebugRunType = 'global' | 'step';
731
+ type DebugRunStatus = 'not_run' | 'running' | 'waiting' | 'paused' | 'terminating' | 'finished' | 'failed' | 'revoked';
732
+ /** 运行级 / 节点级错误详情(last_error_detail、nodes[].error_detail)。 */
733
+ interface DebugErrorFailure {
734
+ message: string;
735
+ node_id?: string;
736
+ template_node_id?: string;
737
+ [key: string]: unknown;
738
+ }
739
+ interface DebugErrorDetail {
740
+ type?: string;
741
+ message?: string;
742
+ task_id?: number | string;
743
+ failures?: DebugErrorFailure[];
744
+ [key: string]: unknown;
745
+ }
746
+ interface DebugContextNode {
747
+ node_id: string;
748
+ node_type: string;
749
+ execution_mode: DebugExecutionMode;
750
+ status: DebugNodeStatus;
751
+ can_step: boolean;
752
+ missing_vars: DebugMissingVar[];
753
+ waiting_reason?: string | null;
754
+ mock_result?: 'success' | 'fail' | null;
755
+ error_detail?: DebugErrorDetail | string | null;
756
+ duration_ms?: number | null;
757
+ log_ref?: {
758
+ instance_id: number | string;
759
+ node_id: string;
760
+ version: string;
761
+ } | null;
762
+ mock_outputs?: Record<string, unknown> | null;
763
+ mock_error?: string | null;
764
+ outputs?: Record<string, unknown> | null;
765
+ }
625
766
  /**
626
- * Flow API 配置接口
767
+ * /debug_context/ 顶层结构。
768
+ *
769
+ * 前端按 status 分支:
770
+ * - running:任务定位用 active_*,进度用 last_run_status
771
+ * - terminating:继续用 active_*,UI 展示「终止中」并轮询
772
+ * - idle:active_* 为空,结果摘要用 last_*;last_task_id=null 表示尚无调试记录
627
773
  */
628
- interface FlowApiConfig {
629
- /** API 基础路径 */
630
- baseURL?: string;
631
- /** 自定义 axios 实例(可选,如果提供则优先使用) */
632
- axiosInstance?: AxiosInstance;
633
- /** axios 配置(可选,用于创建新的 axios 实例) */
634
- axiosConfig?: AxiosRequestConfig;
635
- /** CSRF cookie 名称(可选,用于创建新的 axios 实例时设置 xsrfCookieName) */
636
- xsrfCookieName?: string;
637
- /** 作用域数据(必需,由外部传入) */
638
- scopeData: {
639
- scope_type: string;
640
- scope_value: number;
641
- };
642
- /** 用户查询 API 地址(可选) */
643
- fetchUserApi?: string;
644
- /** 是否启用第三方插件(可选,默认为 true) */
645
- enableThirdPlugin?: boolean;
774
+ interface DebugContext {
775
+ template_id: number;
776
+ status: DebugContextStatus;
777
+ locked_by: string;
778
+ active_task_id: number | string | null;
779
+ active_run_type: DebugRunType | null;
780
+ active_node_id: string | null;
781
+ last_task_id: number | string | null;
782
+ last_run_type: DebugRunType | null;
783
+ last_run_status: DebugRunStatus | null;
784
+ last_error_detail?: DebugErrorDetail | null;
785
+ last_inputs?: Record<string, unknown>;
786
+ global_vars: Record<string, unknown>;
787
+ missing_vars?: DebugMissingVar[];
788
+ nodes: DebugContextNode[];
789
+ }
790
+ interface DebugInputSchemaField {
791
+ key: string;
792
+ name: string;
793
+ type: string;
794
+ default?: unknown;
795
+ required?: boolean;
796
+ [key: string]: unknown;
797
+ }
798
+ interface DebugInputSchema {
799
+ fields?: DebugInputSchemaField[];
800
+ constants?: Record<string, unknown>;
801
+ [key: string]: unknown;
802
+ }
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
+ interface DebugResetImpact {
818
+ reset_node_ids: string[];
819
+ reasons?: Record<string, string>;
820
+ }
821
+ interface DebugGlobalVarsResult {
822
+ global_vars: Record<string, unknown>;
823
+ [key: string]: unknown;
824
+ }
825
+ interface UpdateNodeDebugMockResult {
826
+ node_id: string;
827
+ execution_mode: DebugExecutionMode;
828
+ updated_global_vars?: Record<string, unknown>;
829
+ [key: string]: unknown;
830
+ }
831
+ interface RunNodeDebugStepResult {
832
+ node_id: string;
833
+ status: DebugNodeStatus;
834
+ outputs?: Record<string, unknown> | null;
835
+ error_detail?: unknown;
836
+ updated_global_vars?: Record<string, unknown>;
837
+ log_ref?: DebugContextNode['log_ref'];
838
+ [key: string]: unknown;
839
+ }
840
+ interface RunGlobalDebugResult {
841
+ task_id: number | string;
842
+ status: DebugContextStatus;
843
+ [key: string]: unknown;
844
+ }
845
+ interface TerminateDebugResult {
846
+ status?: DebugContextStatus;
847
+ [key: string]: unknown;
848
+ }
849
+ interface DebugResetResult {
850
+ reset_node_ids?: string[];
851
+ [key: string]: unknown;
852
+ }
853
+ interface UpdateDebugContextVariableParams {
854
+ templateId: string | number;
855
+ key: string;
856
+ value: unknown;
857
+ }
858
+ interface UpdateNodeDebugMockParams {
859
+ templateId: string | number;
860
+ nodeId: string;
861
+ enable: boolean;
862
+ mockResult?: 'success' | 'fail';
863
+ mockOutputs?: Record<string, unknown>;
864
+ mockError?: string;
865
+ }
866
+ interface RunNodeDebugStepParams {
867
+ templateId: string | number;
868
+ nodeId: string;
869
+ mode: 'real' | 'mock';
870
+ inputOverrides?: Record<string, unknown>;
871
+ mockResult?: 'success' | 'fail';
872
+ mockOutputs?: Record<string, unknown>;
873
+ mockError?: string;
874
+ }
875
+ interface RunGlobalDebugParams {
876
+ templateId: string | number;
877
+ inputs: Record<string, unknown>;
878
+ }
879
+ interface TerminateDebugParams {
880
+ templateId: string | number;
881
+ nodeId?: string;
882
+ }
883
+ interface ResetDebugResultParams {
884
+ templateId: string | number;
885
+ nodeIds?: string[];
886
+ }
887
+ interface DebugApiServices {
888
+ fetchDebugContext(templateId: string | number): Promise<DebugContext>;
889
+ fetchDebugInputSchema(templateId: string | number): Promise<DebugInputSchema>;
890
+ fetchDebugHistory(templateId: string | number): Promise<DebugHistory>;
891
+ fetchDebugResetImpact(templateId: string | number): Promise<DebugResetImpact>;
892
+ updateDebugContextVariable(params: UpdateDebugContextVariableParams): Promise<DebugGlobalVarsResult>;
893
+ updateNodeDebugMock(params: UpdateNodeDebugMockParams): Promise<UpdateNodeDebugMockResult>;
894
+ runNodeDebugStep(params: RunNodeDebugStepParams): Promise<RunNodeDebugStepResult>;
895
+ runGlobalDebug(params: RunGlobalDebugParams): Promise<RunGlobalDebugResult>;
896
+ terminateDebug(params: TerminateDebugParams): Promise<TerminateDebugResult>;
897
+ resetDebugResult(params: ResetDebugResultParams): Promise<DebugResetResult>;
646
898
  }
647
899
 
648
900
  interface DrawPipelineParams {
@@ -653,16 +905,115 @@ interface DrawPipelineParams {
653
905
  gateway_size?: [number, number];
654
906
  start?: [number, number];
655
907
  }
908
+ interface CreateMockDebugTaskParams {
909
+ template_id: number;
910
+ name: string;
911
+ pipeline_tree: PipelineTree;
912
+ mock_data: {
913
+ nodes: string[];
914
+ outputs: Record<string, Record<string, unknown>>;
915
+ mock_data_ids?: Record<string, number | string>;
916
+ };
917
+ creator?: string;
918
+ }
919
+ interface StopMockDebugTaskParams {
920
+ task_id: number | string;
921
+ }
922
+ interface FetchTaskStateParams {
923
+ task_id: number | string;
924
+ }
925
+ interface FetchTaskNodeDetailParams {
926
+ task_id: number | string;
927
+ node_id: string;
928
+ }
929
+ interface FetchTaskNodeSnapshotParams {
930
+ task_id: number | string;
931
+ node_id: string;
932
+ }
933
+ interface FetchTaskNodeLogParams {
934
+ task_id: number | string;
935
+ node_id: string;
936
+ version: string;
937
+ }
938
+ interface OperateTaskNodeParams {
939
+ task_id: number | string;
940
+ node_id: string;
941
+ action: ExecutionNodeAction;
942
+ data?: Record<string, unknown>;
943
+ /** 自定义 operation,优先级高于 action 默认映射 */
944
+ operation?: string;
945
+ }
946
+ interface GetFlowTaskDetailParams {
947
+ task_id: number | string;
948
+ }
949
+ interface FlowTaskDetail {
950
+ id: number | string;
951
+ template_id: number;
952
+ pipeline_tree: PipelineTree;
953
+ [key: string]: unknown;
954
+ }
955
+ interface CreateFlowTaskParams {
956
+ template_id: number;
957
+ name: string;
958
+ creator: string;
959
+ constants: Record<string, any>;
960
+ label_ids?: number[];
961
+ [key: string]: unknown;
962
+ }
963
+ interface CreateFlowTaskResult {
964
+ data: {
965
+ id: number | string;
966
+ template_id?: number;
967
+ [key: string]: unknown;
968
+ };
969
+ [key: string]: unknown;
970
+ }
971
+ interface ExecuteFlowTaskResult {
972
+ result?: boolean;
973
+ code?: number;
974
+ data?: {
975
+ /** 任务详情页跳转地址(含正确的 bkflow task id 与 templateId) */
976
+ url?: string;
977
+ [key: string]: unknown;
978
+ };
979
+ message?: string | null;
980
+ request_id?: string;
981
+ trace_id?: string | null;
982
+ [key: string]: unknown;
983
+ }
984
+ interface FlowTaskExecuteSuccessResult {
985
+ /** createFlowTask(create_task)接口响应 */
986
+ createResult: CreateFlowTaskResult;
987
+ /** executeFlowTask(operate_task)接口响应,data.url 用于任务详情跳转 */
988
+ executeResult: ExecuteFlowTaskResult;
989
+ }
990
+ interface TaskStateResult {
991
+ state?: string;
992
+ status?: string;
993
+ node_states?: TaskExecutionStates;
994
+ states?: Record<string, unknown>;
995
+ children?: Record<string, unknown> | unknown[];
996
+ nodes?: Record<string, unknown> | unknown[];
997
+ activities?: Record<string, unknown>;
998
+ gateways?: Record<string, unknown>;
999
+ [key: string]: unknown;
1000
+ }
656
1001
 
657
1002
  interface FlowViewApiConfig {
658
1003
  fetchFlowDetail: (id: string) => Promise<FlowTemplate>;
659
1004
  fetchSpaceFlowConfig: (id: string) => Promise<SpaceFlowConfig>;
660
1005
  fetchSystemVariables: (id: string) => Promise<Variable[]>;
1006
+ /**
1007
+ * 用户查询 API 地址
1008
+ * @deprecated 请改用 memberSelectorConfig.fetchUserApi(顶层组件 prop)
1009
+ */
661
1010
  fetchUserApi?: string;
662
1011
  /** 作用域数据(必需,由外部传入) */
663
1012
  scopeData: {
664
1013
  scope_type: string;
665
1014
  scope_value: number;
1015
+ /** 业务方传入的空间 ID,调试接口专用,语义独立于 scope_value */
1016
+ space_id: number;
666
1017
  };
667
1018
  fetchFlowDraftDetail?: (id: string) => Promise<FlowDraftDetail>;
668
1019
  fetchFlowDetailByVersion?: (id: string, version: string) => Promise<FlowDetailByVersion>;
@@ -682,24 +1033,32 @@ interface FlowViewApiConfig {
682
1033
  data: any[];
683
1034
  };
684
1035
  }>;
685
- createFlowTask?: (params: {
686
- template_id: number;
687
- name: string;
688
- creator: string;
689
- constants: Record<string, any>;
690
- }) => Promise<{
691
- data: {
692
- id: number;
693
- template_id: number;
694
- };
695
- }>;
1036
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
696
1037
  executeFlowTask?: (params: {
697
- task_id: number;
698
- action: string;
1038
+ task_id: number | string;
1039
+ resource_type: string;
1040
+ resource_id: number | string;
1041
+ permission_type: string;
1042
+ }) => Promise<ExecuteFlowTaskResult>;
1043
+ revokeFlowTask?: (params: {
1044
+ task_id: number | string;
699
1045
  resource_type: string;
700
- resource_id: number;
1046
+ resource_id: number | string;
701
1047
  permission_type: string;
702
1048
  }) => Promise<any>;
1049
+ createMockDebugTask?: (params: CreateMockDebugTaskParams) => Promise<{
1050
+ data: {
1051
+ id: number | string;
1052
+ template_id: number;
1053
+ };
1054
+ }>;
1055
+ stopMockDebugTask?: (params: StopMockDebugTaskParams) => Promise<void>;
1056
+ fetchTaskState?: (params: FetchTaskStateParams) => Promise<TaskStateResult>;
1057
+ fetchTaskNodeDetail?: (params: FetchTaskNodeDetailParams) => Promise<unknown>;
1058
+ fetchTaskNodeSnapshot?: (params: FetchTaskNodeSnapshotParams) => Promise<unknown>;
1059
+ fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
1060
+ operateTaskNode?: (params: OperateTaskNodeParams) => Promise<unknown>;
1061
+ getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
703
1062
  fetchControlConfig?: () => Promise<Record<string, any>>;
704
1063
  checkSpaceConfig?: (scopeValue: number, params: {
705
1064
  name: string;
@@ -727,7 +1086,7 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
727
1086
  fetchBkFlowThirdPartyPluginTags: () => Promise<BkflowThirdPartyPluginGroupItem[]>;
728
1087
  fetchBkFlowThirdPartyPluginMeta: (plugin_code: string) => Promise<BkflowThirdPartyPluginMetaDetail>;
729
1088
  fetchBkFlowThirdPartyPluginDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginDetail>;
730
- fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string) => Promise<BkflowThirdPartyPluginAppDetail>;
1089
+ fetchBkFlowThirdPartyPluginAppDetail: (plugin_code: string, plugin_version: string) => Promise<BkflowThirdPartyPluginAppDetail>;
731
1090
  fetchPluginGroupList: () => Promise<PluginGroupConfig[]>;
732
1091
  fetchCategoryPlugins: (category: string) => Promise<PluginMetaItem[]>;
733
1092
  fetchAllPluginGroups: () => Promise<GroupsPluginItem[]>;
@@ -737,27 +1096,127 @@ interface FlowEditApiConfig extends FlowViewApiConfig {
737
1096
  drawPipeline?: (params: DrawPipelineParams) => Promise<{
738
1097
  pipeline_tree: PipelineTree;
739
1098
  }>;
740
- createFlowTask?: (params: {
741
- template_id: number;
742
- name: string;
743
- creator: string;
744
- constants: Record<string, any>;
745
- }) => Promise<{
746
- data: {
747
- id: number;
748
- template_id: number;
749
- };
750
- }>;
1099
+ createFlowTask?: (params: CreateFlowTaskParams) => Promise<CreateFlowTaskResult>;
751
1100
  executeFlowTask?: (params: {
752
- task_id: number;
753
- action: string;
1101
+ task_id: number | string;
1102
+ resource_type: string;
1103
+ resource_id: number | string;
1104
+ permission_type: string;
1105
+ }) => Promise<ExecuteFlowTaskResult>;
1106
+ revokeFlowTask?: (params: {
1107
+ task_id: number | string;
754
1108
  resource_type: string;
755
- resource_id: number;
1109
+ resource_id: number | string;
756
1110
  permission_type: string;
757
1111
  }) => Promise<any>;
1112
+ createMockDebugTask?: (params: CreateMockDebugTaskParams) => Promise<{
1113
+ data: {
1114
+ id: number | string;
1115
+ template_id: number;
1116
+ };
1117
+ }>;
1118
+ stopMockDebugTask?: (params: StopMockDebugTaskParams) => Promise<void>;
1119
+ fetchTaskState?: (params: FetchTaskStateParams) => Promise<TaskStateResult>;
1120
+ fetchTaskNodeDetail?: (params: FetchTaskNodeDetailParams) => Promise<unknown>;
1121
+ fetchTaskNodeSnapshot?: (params: FetchTaskNodeSnapshotParams) => Promise<unknown>;
1122
+ fetchTaskNodeLog?: (params: FetchTaskNodeLogParams) => Promise<unknown>;
1123
+ getFlowTaskDetail?: (params: GetFlowTaskDetailParams) => Promise<FlowTaskDetail>;
1124
+ }
1125
+ interface FlowDetailApiConfig extends FlowEditApiConfig, Partial<DebugApiServices> {
758
1126
  }
759
1127
 
760
- type __VLS_Props$5 = {
1128
+ /**
1129
+ * 插件分组选择面板配置
1130
+ */
1131
+ interface SelectPanelConfig {
1132
+ agentApplyUrl?: string;
1133
+ agentResourceUrl?: string;
1134
+ agentButtonText?: string;
1135
+ knowledgebaseResourceUrl?: string;
1136
+ }
1137
+ /**
1138
+ * 人员选择器配置
1139
+ * 采用判别联合(discriminated union):
1140
+ * - mode 缺省或为 'legacy':使用组件内置的 UserSelector,依赖 fetchUserApi
1141
+ * - mode 为 'tenant':使用多租户人员选择器 @blueking/bk-user-selector,
1142
+ * tenantId 与 apiBaseUrl 在类型上即为必填
1143
+ * 接入方需自行安装 npm 包 @blueking/bk-user-selector
1144
+ */
1145
+ type MemberSelectorConfig = {
1146
+ mode?: 'legacy';
1147
+ /** 用户查询 API 地址 */
1148
+ fetchUserApi?: string;
1149
+ } | {
1150
+ mode: 'tenant';
1151
+ /** 租户 ID */
1152
+ tenantId: string;
1153
+ /** bk-user 服务的 API 基础地址 */
1154
+ apiBaseUrl: string;
1155
+ /** 当前登录用户 ID,开启后可在下拉中快捷选择"我" */
1156
+ currentUserId?: string;
1157
+ /** 是否启用跨租户搜索,默认 false */
1158
+ enableMultiTenantMode?: boolean;
1159
+ /** 是否展示头像,默认 false */
1160
+ hasAvatar?: boolean;
1161
+ /** 头像 CDN 基础地址 */
1162
+ avatarBaseUrl?: string;
1163
+ /** 最近选择的用户 ID 列表 */
1164
+ recentUserIds?: string[];
1165
+ };
1166
+ /**
1167
+ * 在顶层组件中提供 FlowApiConfig
1168
+ * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
1169
+ * @returns 返回处理后的 API 配置对象
1170
+ */
1171
+ declare function provideFlowApiConfig(config: FlowApiConfig | FlowDetailApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowDetailApiConfig | FlowEditApiConfig | FlowViewApiConfig;
1172
+ /**
1173
+ * 在子组件中注入 FlowApiConfig(通用版本)
1174
+ * @returns FlowEditApiConfig
1175
+ * @throws 如果 apiConfig 未提供则抛出错误
1176
+ */
1177
+ declare function useFlowApiConfig(): FlowDetailApiConfig;
1178
+ /**
1179
+ * 在子组件中注入 FlowEditApiConfig(类型化版本)
1180
+ * @returns FlowEditApiConfig
1181
+ */
1182
+ declare function useFlowEditApiConfig(): FlowEditApiConfig;
1183
+ /**
1184
+ * 在子组件中注入 FlowViewApiConfig(类型化版本)
1185
+ * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
1186
+ * @returns FlowViewApiConfig
1187
+ */
1188
+ declare function useFlowViewApiConfig(): FlowViewApiConfig;
1189
+ /**
1190
+ * 在顶层组件中提供 SelectPanelConfig
1191
+ * @param config SelectPanelConfig 配置对象
1192
+ */
1193
+ declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
1194
+ /**
1195
+ * 在子组件中注入 SelectPanelConfig
1196
+ * @returns SelectPanelConfig 或 null(如果未提供配置)
1197
+ */
1198
+ declare function useSelectPanelConfig(): SelectPanelConfig | null;
1199
+ /**
1200
+ * 在顶层组件中提供 MemberSelectorConfig
1201
+ *
1202
+ * 注意:当 `config` 为 undefined 时,**不会调用 provide**,从而不会遮蔽
1203
+ * 父级(如外层 FlowView/FlowEdit)已经 provide 的配置。
1204
+ * 例如 `FlowView` 内部渲染 `FlowCreateTask` 时,如果调用方仅在 `FlowView`
1205
+ * 上传入 `memberSelectorConfig`,则 `FlowCreateTask` 不会因为自己未收到 prop
1206
+ * 而把 tenant 配置覆盖回 legacy。
1207
+ *
1208
+ * 若调用方主动传入 `{ mode: 'legacy' }`,则视为显式覆盖,按正常 provide。
1209
+ *
1210
+ * @param config MemberSelectorConfig 配置对象;为 undefined 时跳过 provide
1211
+ */
1212
+ declare function provideMemberSelectorConfig(config?: MemberSelectorConfig): void;
1213
+ /**
1214
+ * 在子组件中注入 MemberSelectorConfig
1215
+ * @returns MemberSelectorConfig,未提供时返回 { mode: 'legacy' }
1216
+ */
1217
+ declare function useMemberSelectorConfig(): MemberSelectorConfig;
1218
+
1219
+ type __VLS_Props$6 = {
761
1220
  flowId: string;
762
1221
  show: boolean;
763
1222
  editable?: boolean;
@@ -768,10 +1227,12 @@ type __VLS_Props$5 = {
768
1227
  variablesValue: Record<string, any>;
769
1228
  }) => Promise<void> | void;
770
1229
  useCustomConfirm?: boolean;
771
- onExecuteSuccess?: (taskId: number, templateId: number) => void;
1230
+ mockData?: CreateMockDebugTaskParams['mock_data'];
1231
+ onExecuteSuccess?: (taskId: number | string, templateId: number) => void;
772
1232
  bkflowSaasUrl?: string;
773
1233
  enableVersion?: boolean;
774
1234
  flowVersion?: string;
1235
+ memberSelectorConfig?: MemberSelectorConfig;
775
1236
  };
776
1237
  declare var __VLS_72: {
777
1238
  formData: {
@@ -779,15 +1240,15 @@ declare var __VLS_72: {
779
1240
  };
780
1241
  variablesValue: Record<string, any>;
781
1242
  };
782
- type __VLS_Slots$4 = {} & {
1243
+ type __VLS_Slots$6 = {} & {
783
1244
  'custom-form-content'?: (props: typeof __VLS_72) => any;
784
1245
  };
785
- declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1246
+ declare const __VLS_base$6: vue.DefineComponent<__VLS_Props$6, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
786
1247
  close: (...args: any[]) => void;
787
1248
  "update:show": (...args: any[]) => void;
788
1249
  confirm: (...args: any[]) => void;
789
1250
  "before-close": (...args: any[]) => void;
790
- }, string, vue.PublicProps, Readonly<__VLS_Props$5> & Readonly<{
1251
+ }, string, vue.PublicProps, Readonly<__VLS_Props$6> & Readonly<{
791
1252
  onClose?: ((...args: any[]) => any) | undefined;
792
1253
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
793
1254
  onConfirm?: ((...args: any[]) => any) | undefined;
@@ -795,13 +1256,13 @@ declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, v
795
1256
  }>, {
796
1257
  editable: boolean;
797
1258
  showFlowEntry: boolean;
798
- enableVersion: boolean;
799
1259
  useCustomConfirm: boolean;
1260
+ enableVersion: boolean;
800
1261
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
801
- declare const __VLS_export$5: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
802
- declare const _default$6: typeof __VLS_export$5;
1262
+ declare const __VLS_export$6: __VLS_WithSlots$6<typeof __VLS_base$6, __VLS_Slots$6>;
1263
+ declare const _default$7: typeof __VLS_export$6;
803
1264
 
804
- type __VLS_WithSlots$4<T, S> = T & {
1265
+ type __VLS_WithSlots$6<T, S> = T & {
805
1266
  new (): {
806
1267
  $slots: S;
807
1268
  };
@@ -809,15 +1270,15 @@ type __VLS_WithSlots$4<T, S> = T & {
809
1270
 
810
1271
  declare namespace __debug_vue {
811
1272
  export {
812
- _default$6 as default,
1273
+ _default$7 as default,
813
1274
  };
814
1275
  }
815
1276
 
816
- type __VLS_Slots$3 = {
1277
+ type __VLS_Slots$5 = {
817
1278
  header?: () => any;
818
1279
  extend?: () => any;
819
1280
  };
820
- type __VLS_Props$4 = {
1281
+ type __VLS_Props$5 = {
821
1282
  pipelineTree: PipelineTree;
822
1283
  nodeStates?: TaskExecutionStates;
823
1284
  defaultZoom?: number;
@@ -826,15 +1287,15 @@ type __VLS_Props$4 = {
826
1287
  showHeader?: boolean;
827
1288
  onBack?: () => void;
828
1289
  };
829
- declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1290
+ declare const __VLS_base$5: vue.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
830
1291
  retry: (nodeId: string) => any;
831
1292
  skip: (nodeId: string) => any;
832
1293
  resume: (nodeId: string) => any;
833
1294
  approve: (nodeId: string) => any;
834
1295
  forceFail: (nodeId: string) => any;
835
1296
  gatewaySkip: (nodeId: string) => any;
836
- back: () => any;
837
1297
  "ui-event": (event: CanvasUiEvent) => any;
1298
+ back: () => any;
838
1299
  "node-click": (event: {
839
1300
  type: "node.click";
840
1301
  nodeId: string;
@@ -845,15 +1306,15 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
845
1306
  nodeId: string;
846
1307
  action: ExecutionNodeAction;
847
1308
  }) => any;
848
- }, string, vue.PublicProps, Readonly<__VLS_Props$4> & Readonly<{
1309
+ }, string, vue.PublicProps, Readonly<__VLS_Props$5> & Readonly<{
849
1310
  onRetry?: ((nodeId: string) => any) | undefined;
850
1311
  onSkip?: ((nodeId: string) => any) | undefined;
851
1312
  onResume?: ((nodeId: string) => any) | undefined;
852
1313
  onApprove?: ((nodeId: string) => any) | undefined;
853
1314
  onForceFail?: ((nodeId: string) => any) | undefined;
854
1315
  onGatewaySkip?: ((nodeId: string) => any) | undefined;
855
- onBack?: (() => any) | undefined;
856
1316
  "onUi-event"?: ((event: CanvasUiEvent) => any) | undefined;
1317
+ onBack?: (() => any) | undefined;
857
1318
  "onNode-click"?: ((event: {
858
1319
  type: "node.click";
859
1320
  nodeId: string;
@@ -869,10 +1330,10 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, v
869
1330
  defaultZoom: number;
870
1331
  nodeStates: TaskExecutionStates;
871
1332
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
872
- declare const __VLS_export$4: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
873
- declare const _default$5: typeof __VLS_export$4;
1333
+ declare const __VLS_export$5: __VLS_WithSlots$5<typeof __VLS_base$5, __VLS_Slots$5>;
1334
+ declare const _default$6: typeof __VLS_export$5;
874
1335
 
875
- type __VLS_WithSlots$3<T, S> = T & {
1336
+ type __VLS_WithSlots$5<T, S> = T & {
876
1337
  new (): {
877
1338
  $slots: S;
878
1339
  };
@@ -880,26 +1341,35 @@ type __VLS_WithSlots$3<T, S> = T & {
880
1341
 
881
1342
  declare namespace __execute_vue {
882
1343
  export {
883
- _default$5 as default,
1344
+ _default$6 as default,
884
1345
  };
885
1346
  }
886
1347
 
887
- type __VLS_Props$3 = {
1348
+ type __VLS_Slots$4 = {
1349
+ customFormContent?: (props: {
1350
+ customFormData: Record<string, any>;
1351
+ additionalTaskParams: Record<string, any>;
1352
+ updateCustomFormData: (data: Record<string, any>) => void;
1353
+ updateAdditionalTaskParams: (params: Record<string, any>) => void;
1354
+ }) => any;
1355
+ };
1356
+ type __VLS_Props$4 = {
888
1357
  flowId: string;
889
1358
  show: boolean;
890
1359
  editable?: boolean;
891
1360
  showFlowEntry?: boolean;
892
1361
  apiConfig: FlowApiConfig;
893
- onExecuteSuccess?: (taskId: number, templateId: number) => void;
1362
+ onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
894
1363
  bkflowSaasUrl?: string;
1364
+ memberSelectorConfig?: MemberSelectorConfig;
895
1365
  };
896
- declare const __VLS_export$3: vue.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1366
+ declare const __VLS_base$4: vue.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
897
1367
  close: (...args: any[]) => void;
898
1368
  "update:show": (...args: any[]) => void;
899
1369
  confirm: (...args: any[]) => void;
900
1370
  "before-close": (...args: any[]) => void;
901
1371
  "view-flow": (...args: any[]) => void;
902
- }, string, vue.PublicProps, Readonly<__VLS_Props$3> & Readonly<{
1372
+ }, string, vue.PublicProps, Readonly<__VLS_Props$4> & Readonly<{
903
1373
  onClose?: ((...args: any[]) => any) | undefined;
904
1374
  "onUpdate:show"?: ((...args: any[]) => any) | undefined;
905
1375
  onConfirm?: ((...args: any[]) => any) | undefined;
@@ -909,58 +1379,22 @@ declare const __VLS_export$3: vue.DefineComponent<__VLS_Props$3, {}, {}, {}, {},
909
1379
  editable: boolean;
910
1380
  showFlowEntry: boolean;
911
1381
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
912
- declare const _default$4: typeof __VLS_export$3;
1382
+ declare const __VLS_export$4: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
1383
+ declare const _default$5: typeof __VLS_export$4;
1384
+
1385
+ type __VLS_WithSlots$4<T, S> = T & {
1386
+ new (): {
1387
+ $slots: S;
1388
+ };
1389
+ };
913
1390
 
914
1391
  declare namespace __create_task_vue {
915
1392
  export {
916
- _default$4 as default,
1393
+ _default$5 as default,
917
1394
  };
918
1395
  }
919
1396
 
920
- /**
921
- * 插件分组选择面板配置
922
- */
923
- interface SelectPanelConfig {
924
- agentApplyUrl?: string;
925
- agentResourceUrl?: string;
926
- agentButtonText?: string;
927
- knowledgebaseResourceUrl?: string;
928
- }
929
- /**
930
- * 在顶层组件中提供 FlowApiConfig
931
- * @param config FlowApiConfig 配置对象或已处理的 API 配置对象
932
- * @returns 返回处理后的 API 配置对象
933
- */
934
- declare function provideFlowApiConfig(config: FlowApiConfig | FlowEditApiConfig | FlowViewApiConfig): FlowEditApiConfig | FlowViewApiConfig;
935
- /**
936
- * 在子组件中注入 FlowApiConfig(通用版本)
937
- * @returns FlowEditApiConfig
938
- * @throws 如果 apiConfig 未提供则抛出错误
939
- */
940
- declare function useFlowApiConfig(): FlowEditApiConfig;
941
- /**
942
- * 在子组件中注入 FlowEditApiConfig(类型化版本)
943
- * @returns FlowEditApiConfig
944
- */
945
- declare function useFlowEditApiConfig(): FlowEditApiConfig;
946
- /**
947
- * 在子组件中注入 FlowViewApiConfig(类型化版本)
948
- * 注意:实际上返回的是 FlowEditApiConfig,但类型上兼容 FlowViewApiConfig
949
- * @returns FlowViewApiConfig
950
- */
951
- declare function useFlowViewApiConfig(): FlowViewApiConfig;
952
- /**
953
- * 在顶层组件中提供 SelectPanelConfig
954
- * @param config SelectPanelConfig 配置对象
955
- */
956
- declare function provideSelectPanelConfig(config: SelectPanelConfig): void;
957
- /**
958
- * 在子组件中注入 SelectPanelConfig
959
- * @returns SelectPanelConfig 或 null(如果未提供配置)
960
- */
961
- declare function useSelectPanelConfig(): SelectPanelConfig | null;
962
-
963
- type __VLS_Slots$2 = {
1397
+ type __VLS_Slots$3 = {
964
1398
  header?: () => any;
965
1399
  inputParams?: (props: {
966
1400
  node: any;
@@ -984,7 +1418,7 @@ type __VLS_Slots$2 = {
984
1418
  variablesValue: Record<string, any>;
985
1419
  }) => any;
986
1420
  };
987
- type __VLS_Props$2 = {
1421
+ type __VLS_Props$3 = {
988
1422
  flowId: string;
989
1423
  apiConfig: FlowApiConfig;
990
1424
  permissions?: {
@@ -997,49 +1431,76 @@ type __VLS_Props$2 = {
997
1431
  }) => Promise<void> | void;
998
1432
  useCustomDebugConfirm?: boolean;
999
1433
  selectPanelConfig?: SelectPanelConfig;
1434
+ memberSelectorConfig?: MemberSelectorConfig;
1000
1435
  onSave?: (flowData: FlowTemplate) => void;
1001
1436
  onSaveSuccess?: () => void;
1002
1437
  onBack?: () => void;
1003
1438
  onExitEdit?: () => void;
1004
1439
  onBeforeLeave?: (isEdited: boolean) => Promise<boolean>;
1440
+ onMockDebugCreated?: (params: {
1441
+ taskId: number | string;
1442
+ templateId: number | string;
1443
+ }) => void;
1005
1444
  enableVersion?: boolean;
1006
1445
  flowVersion?: string;
1007
1446
  defaultZoom?: number;
1008
1447
  bkflowSaasUrl?: string;
1009
1448
  enableThirdPlugin?: boolean;
1010
1449
  quickAdd?: QuickAddConfig;
1450
+ /** 是否隐藏基础信息中的触发器配置表单,默认 false */
1451
+ hideTrigger?: boolean;
1011
1452
  };
1012
- declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$2, {
1453
+ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$3, {
1013
1454
  isFlowEdited: ComputedRef<FlowEditExpose["isFlowEdited"]>;
1014
1455
  updateNodeInputParams: FlowEditExpose["updateNodeInputParams"];
1015
1456
  openGlobalVariables: FlowEditExpose["openGlobalVariables"];
1457
+ zoomToFit: FlowEditExpose["zoomToFit"];
1458
+ centerContent: FlowEditExpose["centerContent"];
1459
+ getZoom: FlowEditExpose["getZoom"];
1016
1460
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1017
1461
  back: () => any;
1018
1462
  save: (flowData: FlowTemplate) => any;
1463
+ mockDebugCreated: (params: {
1464
+ taskId: number | string;
1465
+ templateId: number | string;
1466
+ }) => any;
1019
1467
  saveSuccess: () => any;
1020
1468
  exitEdit: () => any;
1021
1469
  debugBeforeClose: () => any;
1022
- }, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{
1470
+ createVariable: (payload: {
1471
+ keyword: string;
1472
+ cursorIndex: number;
1473
+ }) => any;
1474
+ }, string, vue.PublicProps, Readonly<__VLS_Props$3> & Readonly<{
1023
1475
  onBack?: (() => any) | undefined;
1024
1476
  onSave?: ((flowData: FlowTemplate) => any) | undefined;
1477
+ onMockDebugCreated?: ((params: {
1478
+ taskId: number | string;
1479
+ templateId: number | string;
1480
+ }) => any) | undefined;
1025
1481
  onSaveSuccess?: (() => any) | undefined;
1026
1482
  onExitEdit?: (() => any) | undefined;
1027
1483
  onDebugBeforeClose?: (() => any) | undefined;
1484
+ onCreateVariable?: ((payload: {
1485
+ keyword: string;
1486
+ cursorIndex: number;
1487
+ }) => any) | undefined;
1028
1488
  }>, {
1029
1489
  quickAdd: QuickAddConfig;
1490
+ enableThirdPlugin: boolean;
1491
+ hideTrigger: boolean;
1030
1492
  defaultZoom: number;
1493
+ enableDebug: boolean;
1494
+ enableVersion: boolean;
1031
1495
  permissions: {
1032
1496
  canSave?: boolean;
1033
1497
  };
1034
- enableVersion: boolean;
1035
- enableDebug: boolean;
1036
1498
  useCustomDebugConfirm: boolean;
1037
- enableThirdPlugin: boolean;
1038
1499
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1039
- declare const __VLS_export$2: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
1040
- declare const _default$3: typeof __VLS_export$2;
1500
+ declare const __VLS_export$3: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
1501
+ declare const _default$4: typeof __VLS_export$3;
1041
1502
 
1042
- type __VLS_WithSlots$2<T, S> = T & {
1503
+ type __VLS_WithSlots$3<T, S> = T & {
1043
1504
  new (): {
1044
1505
  $slots: S;
1045
1506
  };
@@ -1047,11 +1508,11 @@ type __VLS_WithSlots$2<T, S> = T & {
1047
1508
 
1048
1509
  declare namespace __edit_vue {
1049
1510
  export {
1050
- _default$3 as default,
1511
+ _default$4 as default,
1051
1512
  };
1052
1513
  }
1053
1514
 
1054
- type __VLS_Slots$1 = {
1515
+ type __VLS_Slots$2 = {
1055
1516
  header?: () => any;
1056
1517
  inputParams?: (props: {
1057
1518
  node: any;
@@ -1064,12 +1525,25 @@ type __VLS_Slots$1 = {
1064
1525
  }[];
1065
1526
  updateInputParams: (data: Record<string, any>) => void;
1066
1527
  }) => any;
1528
+ customFormContent?: (props: {
1529
+ customFormData: Record<string, any>;
1530
+ additionalTaskParams: Record<string, any>;
1531
+ updateCustomFormData: (data: Record<string, any>) => void;
1532
+ updateAdditionalTaskParams: (params: Record<string, any>) => void;
1533
+ }) => any;
1534
+ debugCustomFormContent?: (props: {
1535
+ formData: {
1536
+ name: string;
1537
+ };
1538
+ variablesValue: Record<string, any>;
1539
+ }) => any;
1067
1540
  };
1068
- type __VLS_Props$1 = {
1541
+ type __VLS_Props$2 = {
1069
1542
  flowId: string;
1070
1543
  apiConfig: FlowApiConfig;
1071
1544
  permissions?: {
1072
1545
  canEdit?: boolean;
1546
+ canExecute?: boolean;
1073
1547
  };
1074
1548
  onEdit?: () => void;
1075
1549
  onBack?: () => void;
@@ -1079,27 +1553,50 @@ type __VLS_Props$1 = {
1079
1553
  showHeaderActions?: boolean;
1080
1554
  defaultZoom?: number;
1081
1555
  bkflowSaasUrl?: string;
1082
- onExecuteSuccess?: (taskId: number, templateId: number) => void;
1556
+ onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
1557
+ memberSelectorConfig?: MemberSelectorConfig;
1558
+ enableDebug?: boolean;
1559
+ onMockDebugCreated?: (params: {
1560
+ taskId: number | string;
1561
+ templateId: number | string;
1562
+ }) => void;
1563
+ /** 是否隐藏基础信息中的触发器配置表单,默认 false */
1564
+ hideTrigger?: boolean;
1083
1565
  };
1084
- declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1085
- back: () => any;
1566
+ declare const __VLS_base$2: vue.DefineComponent<__VLS_Props$2, {
1567
+ zoomToFit: (options?: ZoomToFitOptions) => void;
1568
+ centerContent: () => void;
1569
+ getZoom: () => number;
1570
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1086
1571
  edit: () => any;
1087
- }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1088
- onBack?: (() => any) | undefined;
1572
+ back: () => any;
1573
+ mockDebugCreated: (params: {
1574
+ taskId: number | string;
1575
+ templateId: number | string;
1576
+ }) => any;
1577
+ }, string, vue.PublicProps, Readonly<__VLS_Props$2> & Readonly<{
1089
1578
  onEdit?: (() => any) | undefined;
1579
+ onBack?: (() => any) | undefined;
1580
+ onMockDebugCreated?: ((params: {
1581
+ taskId: number | string;
1582
+ templateId: number | string;
1583
+ }) => any) | undefined;
1090
1584
  }>, {
1091
1585
  thumbnail: boolean;
1586
+ hideTrigger: boolean;
1092
1587
  defaultZoom: number;
1588
+ enableDebug: boolean;
1589
+ enableVersion: boolean;
1093
1590
  permissions: {
1094
1591
  canEdit?: boolean;
1592
+ canExecute?: boolean;
1095
1593
  };
1096
- enableVersion: boolean;
1097
1594
  showHeaderActions: boolean;
1098
1595
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1099
- declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1100
- declare const _default$2: typeof __VLS_export$1;
1596
+ declare const __VLS_export$2: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
1597
+ declare const _default$3: typeof __VLS_export$2;
1101
1598
 
1102
- type __VLS_WithSlots$1<T, S> = T & {
1599
+ type __VLS_WithSlots$2<T, S> = T & {
1103
1600
  new (): {
1104
1601
  $slots: S;
1105
1602
  };
@@ -1107,10 +1604,148 @@ type __VLS_WithSlots$1<T, S> = T & {
1107
1604
 
1108
1605
  declare namespace __view_vue {
1109
1606
  export {
1110
- _default$2 as default,
1607
+ _default$3 as default,
1111
1608
  };
1112
1609
  }
1113
1610
 
1611
+ /**
1612
+ * FlowDetail 权限(默认拒绝,设计 §3.1 / §7.2)。
1613
+ */
1614
+ interface FlowDetailPermissions {
1615
+ canEdit: boolean;
1616
+ canDebug: boolean;
1617
+ canExecute: boolean;
1618
+ }
1619
+
1620
+ type __VLS_Slots$1 = {
1621
+ header?: () => any;
1622
+ inputParams?: (props: {
1623
+ node: any;
1624
+ pluginDetail: PluginDetailCommon | null;
1625
+ inputs: any[];
1626
+ editable: boolean;
1627
+ fullVariableList: {
1628
+ key: string;
1629
+ name: string;
1630
+ source_type?: string;
1631
+ custom_type?: string;
1632
+ }[];
1633
+ updateInputParams: (data: Record<string, PluginInputDataItem>) => void;
1634
+ updateNodeInputParams: (inputParams: Record<string, PluginInputDataItem>) => void;
1635
+ updateVariableSourceInfo: (variableKey: string, nodeId: string, formKey: string) => void;
1636
+ }) => any;
1637
+ customFormContent?: (props: {
1638
+ customFormData: Record<string, any>;
1639
+ additionalTaskParams: Record<string, any>;
1640
+ updateCustomFormData: (data: Record<string, any>) => void;
1641
+ updateAdditionalTaskParams: (params: Record<string, any>) => void;
1642
+ }) => any;
1643
+ };
1644
+ type __VLS_Props$1 = {
1645
+ flowId: string;
1646
+ apiConfig: FlowApiConfig | FlowDetailApiConfig;
1647
+ permissions?: Partial<FlowDetailPermissions>;
1648
+ enableVersion?: boolean;
1649
+ flowVersion?: string;
1650
+ defaultZoom?: number;
1651
+ bkflowSaasUrl?: string;
1652
+ enableThirdPlugin?: boolean;
1653
+ quickAdd?: QuickAddConfig;
1654
+ hideTrigger?: boolean;
1655
+ selectPanelConfig?: SelectPanelConfig;
1656
+ memberSelectorConfig?: MemberSelectorConfig;
1657
+ onSave?: (flowData: FlowTemplate) => void;
1658
+ onSaveSuccess?: () => void;
1659
+ onExecuteSuccess?: (result: FlowTaskExecuteSuccessResult) => void;
1660
+ onBack?: () => void;
1661
+ };
1662
+ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$1, {
1663
+ isFlowEdited: ComputedRef<boolean>;
1664
+ updateNodeInputParams: FlowDetailExpose["updateNodeInputParams"];
1665
+ openGlobalVariables: FlowDetailExpose["openGlobalVariables"];
1666
+ refreshDebugContext: FlowDetailExpose["refreshDebugContext"];
1667
+ openDebugResult: FlowDetailExpose["openDebugResult"];
1668
+ zoomToFit: FlowDetailExpose["zoomToFit"];
1669
+ centerContent: FlowDetailExpose["centerContent"];
1670
+ getZoom: FlowDetailExpose["getZoom"];
1671
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1672
+ back: () => any;
1673
+ save: (flowData: FlowTemplate) => any;
1674
+ saveSuccess: () => any;
1675
+ createVariable: (payload: {
1676
+ keyword: string;
1677
+ cursorIndex: number;
1678
+ }) => any;
1679
+ }, string, vue.PublicProps, Readonly<__VLS_Props$1> & Readonly<{
1680
+ onBack?: (() => any) | undefined;
1681
+ onSave?: ((flowData: FlowTemplate) => any) | undefined;
1682
+ onSaveSuccess?: (() => any) | undefined;
1683
+ onCreateVariable?: ((payload: {
1684
+ keyword: string;
1685
+ cursorIndex: number;
1686
+ }) => any) | undefined;
1687
+ }>, {
1688
+ quickAdd: QuickAddConfig;
1689
+ enableThirdPlugin: boolean;
1690
+ hideTrigger: boolean;
1691
+ defaultZoom: number;
1692
+ enableVersion: boolean;
1693
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1694
+ declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
1695
+ declare const _default$2: typeof __VLS_export$1;
1696
+
1697
+ type __VLS_WithSlots$1<T, S> = T & {
1698
+ new (): {
1699
+ $slots: S;
1700
+ };
1701
+ };
1702
+
1703
+ type SimulateDebugStage = 'edit' | 'mock-config' | 'mock-running';
1704
+ type MockFormControl = 'bk-input' | 'bk-input-number' | 'bk-textarea' | 'json-editor' | 'bk-select' | 'bk-checkbox-group' | 'bk-radio-group' | 'bk-switcher' | 'bk-date-picker' | 'bk-date-range-picker' | 'data-table';
1705
+ interface MockOutputField extends PluginOutputItem {
1706
+ form_type?: string;
1707
+ options?: Array<{
1708
+ label: string;
1709
+ value: unknown;
1710
+ text?: string;
1711
+ }>;
1712
+ schema?: Record<string, unknown>;
1713
+ default?: unknown;
1714
+ }
1715
+ interface NodeMockConfig {
1716
+ nodeId: string;
1717
+ outputs: Record<string, unknown>;
1718
+ fieldSnapshots: Record<string, MockOutputField>;
1719
+ }
1720
+ interface SimulateDebugState {
1721
+ stage: SimulateDebugStage;
1722
+ selectedNodeIds: Set<string>;
1723
+ mockConfigs: Record<string, NodeMockConfig>;
1724
+ activeConfigNodeId?: string;
1725
+ activeRunningNodeId?: string;
1726
+ taskId?: number | string;
1727
+ taskStatus?: 'RUNNING' | 'FINISHED' | 'FAILED';
1728
+ taskStartedAt?: number;
1729
+ nodeStates?: TaskExecutionStates;
1730
+ resultDrawerOpen: boolean;
1731
+ }
1732
+ interface SimulateDebugCanvasContext {
1733
+ stage: Ref<SimulateDebugStage>;
1734
+ isMockSelected: (nodeId: string) => boolean;
1735
+ toggleMockSelected: (nodeId: string) => void;
1736
+ hasMockConfig: (nodeId: string) => boolean;
1737
+ isAllMockNodesSelected?: () => boolean;
1738
+ }
1739
+
1740
+ interface OutputNormalizeOptions {
1741
+ includeSystem?: boolean;
1742
+ }
1743
+ declare function mergeOutputs(...groups: Array<Array<PluginOutputItem | MockOutputField>>): MockOutputField[];
1744
+ declare function normalizePluginOutputItems(outputs: unknown, options?: OutputNormalizeOptions): MockOutputField[];
1745
+ declare function resolveMockFormControl(field: MockOutputField): MockFormControl;
1746
+
1747
+ declare function isMockableNode(node: NodeType | Activity | undefined | null): node is Activity;
1748
+
1114
1749
  declare const random4: () => string;
1115
1750
  declare const generateId: (group?: number) => string;
1116
1751
 
@@ -1127,6 +1762,12 @@ declare const getVariableDefaultConfig: () => Variable;
1127
1762
 
1128
1763
  declare const getUniformApiPluginFormValue: (config: UniformApiPluginInputsItem$1) => PluginInputDataItem["value"];
1129
1764
 
1765
+ type BkflowBusinessCanvasMode = 'edit' | 'view' | 'mock-config' | 'execute';
1766
+ interface BkflowSchemaOptions {
1767
+ getBusinessMode?: () => BkflowBusinessCanvasMode;
1768
+ }
1769
+ declare function createBkflowSchema(options?: BkflowSchemaOptions): CanvasSchema;
1770
+
1130
1771
  declare class BkFlowNodeAccessor {
1131
1772
  private node;
1132
1773
  constructor(node: FlowNodeModel);
@@ -1168,15 +1809,35 @@ declare class BkFlowModelAccessor {
1168
1809
  get flowModel(): FlowModel;
1169
1810
  }
1170
1811
 
1812
+ /**
1813
+ * 新调试(FlowDetail)向画布节点透出的最小上下文(设计 §14.3)。
1814
+ *
1815
+ * - isMockNode:节点渲染据此显示 MOCK 标签;
1816
+ * - 其余为可选能力:独立调试聚焦态、打开节点调试面板。
1817
+ * 保持可选以兼容仅需 Mock 标签的场景,且不改变对外 npm 公共 API。
1818
+ */
1819
+ interface DebugCanvasContext {
1820
+ isMockNode(nodeId: string): boolean;
1821
+ /** 节点调试状态;任务节点用它补充未执行(not_run)标识,不写入连线执行态。 */
1822
+ getNodeStatus?(nodeId: string): string | undefined;
1823
+ /** 当前独立调试聚焦节点(不复用 X6 编辑选择态,设计 §9.3.2) */
1824
+ focusedNodeId?(): string;
1825
+ /** 打开该节点详情侧滑的“调试配置”Tab */
1826
+ openNodeDebugPanel?(nodeId: string): void;
1827
+ }
1828
+
1171
1829
  type __VLS_Props = {
1172
1830
  pipelineTree: PipelineTree;
1173
- mode?: 'edit' | 'view';
1831
+ mode?: BkflowBusinessCanvasMode;
1174
1832
  thumbnail?: boolean;
1175
1833
  defaultZoom?: number;
1176
1834
  nodeActions?: NodeActionsConfig;
1177
1835
  quickAdd?: QuickAddConfig;
1178
1836
  connectionValidator?: ConnectionValidator;
1179
1837
  additionalPlugins?: CanvasPlugin[];
1838
+ toolbarItems?: CanvasToolbarItem[];
1839
+ simulateDebugContext?: SimulateDebugCanvasContext;
1840
+ debugContext?: DebugCanvasContext;
1180
1841
  };
1181
1842
  declare var __VLS_8: {};
1182
1843
  declare var __VLS_22: {
@@ -1271,8 +1932,8 @@ declare const __VLS_base: vue.DefineComponent<__VLS_Props, {
1271
1932
  }) => any) | undefined;
1272
1933
  "onFormat-position"?: (() => any) | undefined;
1273
1934
  }>, {
1274
- mode: "edit" | "view";
1275
1935
  thumbnail: boolean;
1936
+ mode: BkflowBusinessCanvasMode;
1276
1937
  nodeActions: NodeActionsConfig;
1277
1938
  quickAdd: QuickAddConfig;
1278
1939
  defaultZoom: number;
@@ -1303,8 +1964,6 @@ declare function importFromPipelineTree(tree: PipelineTree): FlowModel;
1303
1964
 
1304
1965
  declare function exportToPipelineTree(flowModel: FlowModel): PipelineTree;
1305
1966
 
1306
- declare function createBkflowSchema(): CanvasSchema;
1307
-
1308
1967
  /**
1309
1968
  * 创建 bkflow 业务插件实例。
1310
1969
  * 每次调用返回独立实例,避免多个画布共享模块级可变状态。
@@ -1317,7 +1976,8 @@ declare function createBkflowSchema(): CanvasSchema;
1317
1976
  * 若目标是 placeholder 且删后无入边,级联删除该 placeholder
1318
1977
  * - edge.reconnect:若源从条件网关迁出,清理旧条件
1319
1978
  * - node.remove:主动查找将被级联删除的边,清理对应网关条件;
1320
- * 若删除的是分支网关,级联删除关联的 placeholder 节点
1979
+ * 若删除的是分支网关,级联删除关联的 placeholder 节点;
1980
+ * 同时清理全局变量中对被删除节点的 source_info 引用,并删除已无引用的变量
1321
1981
  */
1322
1982
  declare function createBkflowPlugin(): CanvasPlugin;
1323
1983
 
@@ -1346,7 +2006,12 @@ declare const _default: {
1346
2006
  FlowCreateTask: () => Promise<typeof __create_task_vue>;
1347
2007
  FlowExecute: () => Promise<typeof __execute_vue>;
1348
2008
  FlowDebug: () => Promise<typeof __debug_vue>;
2009
+ /**
2010
+ * @deprecated Use FlowDetail with permissions.canDebug instead.
2011
+ * FlowMockDebug will be removed in the next major version.
2012
+ */
2013
+ FlowMockDebug: () => Promise<typeof __mock_vue>;
1349
2014
  };
1350
2015
 
1351
- export { _default$1 as BkFlowCanvas, BkFlowModelAccessor, BkFlowNodeAccessor, _default$4 as FlowCreateTask, _default$6 as FlowDebug, _default$3 as FlowEdit, _default$5 as FlowExecute, _default$2 as FlowView, bkflowConnectionValidator, createBkflowPlugin, createBkflowSchema, createExecutionStatusPlugin, _default as default, exportToPipelineTree, generateId, getUniformApiPluginFormValue, getVariableDefaultConfig, importFromPipelineTree, provideFlowApiConfig, provideSelectPanelConfig, random4, resolveExecutionActions, useFlowApiConfig, useFlowEditApiConfig, useFlowViewApiConfig, useSelectPanelConfig, validatePipelineTree };
1352
- export type { Activity, DndNodeItem, ExecutionNodeAction, FlowApiConfig, FlowEditExpose, FlowTemplate, Gateway, GatewayCondition, NodeExecutionState, NodeExecutionStatus, NotifyConfig, PipelineTree, PluginDetailCommon, PluginInputDataItem, SelectPanelConfig, SpaceFlowConfig, TaskExecutionStates, TemplateConfigs, TriggerCron, TriggerItem, UniformApiPluginInputsItem, UpdateFlowParams, Variable, VariableReference };
2016
+ 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 };
2017
+ 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 };