import { type ComputedRef, type Ref, type VNode } from 'vue'; import { type ConvergedState } from './flow-agent-state'; import type { BkFlowMessageContent, BkFlowNode, BkFlowTask } from '../../../ag-ui/types/contents'; /** 节点视图模型:模板直接消费,避免重复 Object.values / 状态归一 / 时间格式化 */ export interface FlowNodeVM { convergedState: ConvergedState; dotColor: string; elapsedTimeText: string; id: string; name: string; raw: BkFlowNode; /** 是否可重试(失败节点行尾「重试」按钮的显隐依据) */ retryable: boolean; /** 是否可跳过(失败节点行尾「跳过」按钮的显隐依据) */ skippable: boolean; } /** 统计概览项视图模型 */ export interface FlowStatVM { /** 计数文字色 */ color: string; display: string; /** 状态圆点(环)边框色,pending 等需与文字色区分时回退到独立 dotColor */ dotColor: string; key: ConvergedState; label: string; } /** 任务视图模型 */ export interface FlowTaskVM { confidenceTitle?: string; convergedState: ConvergedState; hasConfidence: boolean; isActive: boolean; nodes: FlowNodeVM[]; raw: BkFlowTask; stateIcon: null | VNode; taskId: number; taskName: string; totalTimeText: string; } /** * flow-agent 视图模型 composable。 * 将原始 BkFlowTask[] 转换为模板友好的视图模型,并集中处理统计聚合与展开态, * 纯派生逻辑(不依赖注入),便于复用与单测。 */ export declare const useFlowAgent: (contentRef: Ref) => { isTaskExpanded: (task: BkFlowTask) => boolean; taskList: ComputedRef; toggleTaskExpanded: (task: BkFlowTask) => void; viewTasks: ComputedRef; visibleStats: ComputedRef; };