@blueking/chat-x 2.4.0 → 2.4.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.
@@ -1,12 +1,19 @@
1
1
  import { type VNode } from 'vue';
2
2
  /** 归一后的执行状态 */
3
- export type ConvergedState = 'failed' | 'pending' | 'running' | 'skipped' | 'success' | 'suspended';
3
+ export type ConvergedState = 'failed' | 'pending' | 'running' | 'skipped' | 'success' | 'suspended' | 'terminated';
4
4
  /** 单个归一状态的完整定义 */
5
- interface FlowStateDef {
6
- /** 状态主题色,供统计标签文字与图标语义复用 */
5
+ export interface FlowStateDef {
6
+ /** 状态主题色,供统计标签文字、整体 header 文案与图标语义复用 */
7
7
  color: string;
8
- /** 节点状态点的边框色,缺省回退到 color(仅 pending 与主题色不同) */
8
+ /** 节点 / 统计圆点的边框色,缺省回退到 color(仅 pending 与主题色不同) */
9
9
  dotColor?: string;
10
+ /** 节点 / 统计圆点的填充色;缺省透明(空心环)。已终止等实心底圆点在此声明 */
11
+ dotFill?: string;
12
+ /**
13
+ * 任一任务 task_state 命中该状态时,标题栏前置该标签并括号包裹统计。
14
+ * 后续若有同类「整体覆盖态」,只需在对应 def 上打开此标记。
15
+ */
16
+ flowHeader?: boolean;
10
17
  /** 状态图标(VNode);running 走 Loading 动画,故为 null */
11
18
  icon: null | VNode;
12
19
  /** 归一状态标识 */
@@ -15,20 +22,30 @@ interface FlowStateDef {
15
22
  label: string;
16
23
  /** 归一到该状态的后端原始状态枚举 */
17
24
  rawStates: string[];
25
+ /** 是否出现在标题栏 / tooltip 统计;缺省 true */
26
+ showInStats?: boolean;
18
27
  }
19
28
  /**
20
29
  * 执行状态唯一配置源(Single Source of Truth)。
21
- * 新增 / 调整状态只需维护此处:归一映射、统计标签、颜色、图标均由它派生,
30
+ * 新增 / 调整状态只需维护此处:归一映射、统计标签、颜色、图标、整体 header 覆盖均由它派生,
22
31
  * 避免状态逻辑散落在组件与 SCSS 多处。
23
32
  * 数组顺序即统计概览(visibleStats)的展示顺序。
24
33
  */
25
34
  export declare const STATE_DEFS: FlowStateDef[];
26
35
  /** 后端原始状态归一;未知状态回退 running(保持原有行为) */
27
36
  export declare const getConvergedState: (rawState: string) => ConvergedState;
37
+ /**
38
+ * 根据任务原始状态扫描整体 header 覆盖定义。
39
+ * 只遍历 task_state(O(任务数)),命中首个 flowHeader 即返回。
40
+ */
41
+ export declare const getFlowHeaderDef: (rawTaskStates: Iterable<string>) => FlowStateDef | undefined;
42
+ /** 是否进入标题栏 / tooltip 统计;未声明时默认展示 */
43
+ export declare const isShownInStats: (def: FlowStateDef) => boolean;
28
44
  /** 状态主题色(用于统计标签文字) */
29
45
  export declare const getStateColor: (state: ConvergedState) => string;
30
- /** 节点状态点边框色 */
46
+ /** 节点 / 统计圆点边框色 */
31
47
  export declare const getStateDotColor: (state: ConvergedState) => string;
48
+ /** 节点 / 统计圆点填充色;未声明时返回 undefined,保持空心环 */
49
+ export declare const getStateDotFill: (state: ConvergedState) => string | undefined;
32
50
  /** 取状态图标,返回深拷贝的 VNode 以支持多处复用;running 无图标返回 null */
33
51
  export declare const getStateIcon: (state: ConvergedState) => null | VNode;
34
- export {};
@@ -1,10 +1,12 @@
1
1
  import { type ComputedRef, type Ref, type VNode } from 'vue';
2
- import { type ConvergedState } from './flow-agent-state';
3
2
  import type { BkFlowMessageContent, BkFlowNode, BkFlowTask } from '../../../ag-ui/types/contents';
3
+ import type { ConvergedState, FlowStateDef } from './flow-agent-state';
4
4
  /** 节点视图模型:模板直接消费,避免重复 Object.values / 状态归一 / 时间格式化 */
5
5
  export interface FlowNodeVM {
6
6
  convergedState: ConvergedState;
7
7
  dotColor: string;
8
+ /** 实心底圆点填充色;空心环时缺省 */
9
+ dotFill?: string;
8
10
  elapsedTimeText: string;
9
11
  id: string;
10
12
  name: string;
@@ -21,6 +23,8 @@ export interface FlowStatVM {
21
23
  display: string;
22
24
  /** 状态圆点(环)边框色,pending 等需与文字色区分时回退到独立 dotColor */
23
25
  dotColor: string;
26
+ /** 实心底圆点填充色;空心环时缺省 */
27
+ dotFill?: string;
24
28
  key: ConvergedState;
25
29
  label: string;
26
30
  }
@@ -43,6 +47,7 @@ export interface FlowTaskVM {
43
47
  * 纯派生逻辑(不依赖注入),便于复用与单测。
44
48
  */
45
49
  export declare const useFlowAgent: (contentRef: Ref<BkFlowMessageContent | undefined>) => {
50
+ flowHeaderDef: ComputedRef<FlowStateDef | undefined>;
46
51
  isTaskExpanded: (task: BkFlowTask) => boolean;
47
52
  taskList: ComputedRef<BkFlowTask[]>;
48
53
  toggleTaskExpanded: (task: BkFlowTask) => void;
@@ -4,6 +4,10 @@ export declare const BkFlowSuccessIcon: import("vue").VNode<import("vue").Render
4
4
  export declare const BkFlowFailedIcon: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
5
5
  [key: string]: any;
6
6
  }>;
7
+ /** 已终止(REVOKED)任务图标,来自设计稿节点 2013:4495,保留 14×14 原始 path */
8
+ export declare const BkFlowTerminatedIcon: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
9
+ [key: string]: any;
10
+ }>;
7
11
  export declare const BkFlowSuspendedIcon: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
8
12
  [key: string]: any;
9
13
  }>;