Files
AgentCoord/frontend/src/stores/modules/selection.ts

793 lines
25 KiB
TypeScript
Raw Normal View History

2025-12-31 19:04:58 +08:00
import { ref } from 'vue'
import { defineStore } from 'pinia'
import { v4 as uuidv4 } from 'uuid'
import { store } from '../index'
import type { IRawStepTask, IApiStepTask } from './agents'
import type { Node, Edge } from '@vue-flow/core'
import { useAgentsStoreHook } from './agents'
2025-12-31 19:04:58 +08:00
2026-01-19 09:12:06 +08:00
/**
*
* @description
*/
2025-12-31 19:04:58 +08:00
export interface IBranchData {
2026-01-19 09:12:06 +08:00
/** 分支唯一 ID */
id: string
/** 父节点 ID根节点或任务节点 */
parentNodeId: string
/** 分支需求内容 */
branchContent: string
/** 分支类型 */
branchType: 'root' | 'task'
/** 分支包含的所有节点 */
nodes: Node[]
/** 分支包含的所有边 */
edges: Edge[]
/** 分支的任务数据 */
tasks: IRawStepTask[]
/** 创建时间 */
createdAt: number
2025-12-31 19:04:58 +08:00
}
export const useSelectionStore = defineStore('selection', () => {
// ==================== 任务大纲探索分支数据存储 ====================
2026-01-19 09:12:06 +08:00
/** 流程图分支列表 */
const flowBranches = ref<IBranchData[]>([])
2025-12-31 19:04:58 +08:00
2026-01-19 09:12:06 +08:00
/**
*
* @param data
* @returns ID
*/
2025-12-31 19:04:58 +08:00
function addFlowBranch(data: {
parentNodeId: string
branchContent: string
branchType: 'root' | 'task'
nodes: Node[]
edges: Edge[]
tasks: IRawStepTask[]
}): string {
const branchId = `flow-branch-${uuidv4()}`
const newBranch: IBranchData = {
id: branchId,
parentNodeId: data.parentNodeId,
branchContent: data.branchContent,
branchType: data.branchType,
nodes: data.nodes,
edges: data.edges,
tasks: data.tasks,
createdAt: Date.now(),
}
flowBranches.value.push(newBranch)
return branchId
}
2026-01-19 09:12:06 +08:00
/**
*
* @returns
*/
2025-12-31 19:04:58 +08:00
function getAllFlowBranches(): IBranchData[] {
return flowBranches.value
}
2026-01-19 09:12:06 +08:00
/**
* ID
* @param parentNodeId ID
* @returns
*/
2025-12-31 19:04:58 +08:00
function getFlowBranchesByParent(parentNodeId: string): IBranchData[] {
return flowBranches.value.filter((branch) => branch.parentNodeId === parentNodeId)
}
2026-01-19 09:12:06 +08:00
/**
*
* @param branchId ID
* @returns
*/
2025-12-31 19:04:58 +08:00
function removeFlowBranch(branchId: string): boolean {
const index = flowBranches.value.findIndex((branch) => branch.id === branchId)
if (index > -1) {
flowBranches.value.splice(index, 1)
return true
}
return false
}
2026-01-19 09:12:06 +08:00
/** 清除所有流程图分支 */
2025-12-31 19:04:58 +08:00
function clearFlowBranches() {
flowBranches.value = []
}
2026-01-19 09:12:06 +08:00
/**
* ID
* @param parentNodeId ID
*/
2025-12-31 19:04:58 +08:00
function clearFlowBranchesByParent(parentNodeId: string) {
flowBranches.value = flowBranches.value.filter((branch) => branch.parentNodeId !== parentNodeId)
}
// ==================== 任务过程探索分支数据存储 ====================
2026-01-19 09:12:06 +08:00
/**
*
* @description 存储结构: Map<taskStepId, Map<agentGroupKey, IBranchData[]>>
* - taskStepId: 任务步骤 ID
* - agentGroupKey: agent JSON
* - IBranchData[]: agent
*/
const taskProcessBranchesMap = ref<Map<string, Map<string, IBranchData[]>>>(new Map())
2025-12-31 19:04:58 +08:00
2026-01-19 09:12:06 +08:00
/**
*
* @param taskStepId ID
* @param agents Agent
* @param data
* @returns ID
*/
2025-12-31 19:04:58 +08:00
function addTaskProcessBranch(
taskStepId: string,
2026-01-19 09:12:06 +08:00
agents: string[],
2025-12-31 19:04:58 +08:00
data: {
parentNodeId: string
branchContent: string
branchType: 'root' | 'task'
nodes: Node[]
edges: Edge[]
tasks: IRawStepTask[]
id?: string // 允许传入自定义 id
2025-12-31 19:04:58 +08:00
},
): string {
const branchId = data.id || `task-process-branch-${uuidv4()}`
console.log('[store.addTaskProcessBranch] 生成的 branchId:', branchId, '传入的 id:', data.id)
2026-01-19 09:12:06 +08:00
const agentGroupKey = getAgentGroupKey(agents)
2025-12-31 19:04:58 +08:00
const newBranch: IBranchData = {
id: branchId,
parentNodeId: data.parentNodeId,
branchContent: data.branchContent,
branchType: data.branchType,
nodes: data.nodes,
edges: data.edges,
tasks: data.tasks,
createdAt: Date.now(),
}
// 获取或创建该任务步骤的 Map
2025-12-31 19:04:58 +08:00
if (!taskProcessBranchesMap.value.has(taskStepId)) {
taskProcessBranchesMap.value.set(taskStepId, new Map())
}
// 获取或创建该 agent 组合的分支列表
const agentMap = taskProcessBranchesMap.value.get(taskStepId)!
if (!agentMap.has(agentGroupKey)) {
agentMap.set(agentGroupKey, [])
2025-12-31 19:04:58 +08:00
}
agentMap.get(agentGroupKey)!.push(newBranch)
2025-12-31 19:04:58 +08:00
return branchId
}
2026-01-19 09:12:06 +08:00
/**
* agent
* @param taskStepId ID
* @param agents Agent
* @returns
*/
function getTaskProcessBranches(taskStepId: string, agents: string[]): IBranchData[] {
const agentGroupKey = getAgentGroupKey(agents)
return taskProcessBranchesMap.value.get(taskStepId)?.get(agentGroupKey) || []
2025-12-31 19:04:58 +08:00
}
2026-01-19 09:12:06 +08:00
/**
*
* @returns
*/
function getAllTaskProcessBranches(): Map<string, Map<string, IBranchData[]>> {
2025-12-31 19:04:58 +08:00
return taskProcessBranchesMap.value
}
2026-01-19 09:12:06 +08:00
/**
* ID
* @param taskStepId ID
* @param agents Agent
* @param parentNodeId ID
* @returns
*/
function getTaskProcessBranchesByParent(
taskStepId: string,
agents: string[],
parentNodeId: string,
): IBranchData[] {
const agentGroupKey = getAgentGroupKey(agents)
const branches = taskProcessBranchesMap.value.get(taskStepId)?.get(agentGroupKey) || []
2025-12-31 19:04:58 +08:00
return branches.filter((branch) => branch.parentNodeId === parentNodeId)
}
2026-01-19 09:12:06 +08:00
/**
*
* @param taskStepId ID
* @param agents Agent
* @param branchId ID
* @returns
*/
function removeTaskProcessBranch(
taskStepId: string,
agents: string[],
branchId: string,
): boolean {
const agentGroupKey = getAgentGroupKey(agents)
const branches = taskProcessBranchesMap.value.get(taskStepId)?.get(agentGroupKey)
2025-12-31 19:04:58 +08:00
if (branches) {
const index = branches.findIndex((branch) => branch.id === branchId)
if (index > -1) {
branches.splice(index, 1)
return true
}
}
return false
}
/**
*
* @param taskStepId ID
* @param agents Agent
* @param branchId ID
* @param nodeId ID
* @param incomingEdges edges
* @param outgoingEdges edges
* @param newEdges
* @returns
*/
function removeNodeFromBranch(
taskStepId: string,
agents: string[],
branchId: string,
nodeId: string,
incomingEdges: any[] = [],
outgoingEdges: any[] = [],
newEdges: any[] = [],
): boolean {
const agentGroupKey = getAgentGroupKey(agents)
const branches = taskProcessBranchesMap.value.get(taskStepId)?.get(agentGroupKey)
if (!branches) return false
const branchIndex = branches.findIndex((branch) => branch.id === branchId)
if (branchIndex === -1) return false
const branch = branches[branchIndex]
if (!branch || !branch.nodes || !branch.tasks) return false
// 找到节点在分支中的索引
const nodeIndex = branch.nodes.findIndex((n: any) => n.id === nodeId)
if (nodeIndex === -1) return false
// 精准删除:只删除对应索引的节点和任务
branch.nodes.splice(nodeIndex, 1)
branch.tasks.splice(nodeIndex, 1)
// 更新 edges移除相关边添加新边
if (incomingEdges.length > 0 || outgoingEdges.length > 0) {
const relatedEdgeIds = [
...incomingEdges.map((e: any) => e.id),
...outgoingEdges.map((e: any) => e.id),
]
// 过滤掉相关的旧边
branch.edges = (branch.edges || []).filter((e: any) => !relatedEdgeIds.includes(e.id))
// 添加新边
if (newEdges.length > 0) {
branch.edges.push(...newEdges)
}
}
return true
}
2026-01-19 09:12:06 +08:00
/**
* agent
* @param taskStepId ID
* @param agents Agent
*/
function clearTaskProcessBranches(taskStepId: string, agents?: string[]) {
if (agents) {
// 清除指定 agent 组合的分支
const agentGroupKey = getAgentGroupKey(agents)
const agentMap = taskProcessBranchesMap.value.get(taskStepId)
if (agentMap) {
agentMap.delete(agentGroupKey)
}
} else {
// 清除该任务步骤的所有分支(所有 agent 组合)
taskProcessBranchesMap.value.delete(taskStepId)
}
2025-12-31 19:04:58 +08:00
}
// ==================== 数据库持久化方法 ====================
/**
*
* @param dbBranches
*/
function restoreBranchesFromDB(dbBranches: IBranchData[]) {
// 清除现有分支
clearFlowBranches()
// 恢复分支数据到 store
dbBranches.forEach((branch) => {
if (branch && branch.id && branch.tasks) {
addFlowBranch({
parentNodeId: branch.parentNodeId,
branchContent: branch.branchContent,
branchType: branch.branchType,
nodes: branch.nodes || [],
edges: branch.edges || [],
tasks: branch.tasks,
})
}
})
}
/**
*
* @param taskId ID
* @returns Promise<boolean>
*/
async function saveBranchesToDB(taskId: string): Promise<boolean> {
// 导入 api避免循环导入问题
const { default: api } = await import('@/api')
const branches = getAllFlowBranches()
const result = await api.saveBranches(taskId, branches)
return result
}
/**
*
* @param TaskID ID
* @returns Promise<boolean>
* @description 存储结构: Map<taskStepId, Map<agentGroupKey, IBranchData[]>>
*/
async function saveTaskProcessBranchesToDB(TaskID: string): Promise<boolean> {
// 导入 api避免循环导入问题
const { default: api } = await import('@/api')
// 将 Map 转换为普通对象,便于序列化
const branchesMap = getAllTaskProcessBranches()
const branchesObj: Record<string, Record<string, any[]>> = {}
for (const [taskStepId, agentMap] of branchesMap.entries()) {
branchesObj[taskStepId] = {}
for (const [agentGroupKey, branches] of agentMap.entries()) {
branchesObj[taskStepId][agentGroupKey] = branches
}
}
const result = await api.saveTaskProcessBranches(TaskID, branchesObj)
return result
}
/**
*
* @param TaskID ID
* @param stepId ID
* @param branchId ID
* @returns Promise<boolean>
*/
async function deleteTaskProcessBranchFromDB(
TaskID: string,
stepId: string,
branchId: string,
): Promise<boolean> {
// 导入 api避免循环导入问题
const { default: api } = await import('@/api')
const result = await api.deleteTaskProcessBranch(TaskID, stepId, branchId)
return result
}
/**
*
* @param TaskID ID
* @param stepId ID
* @param branchId ID
* @param nodeId ID
* @returns Promise<boolean>
*/
async function deleteTaskProcessNodeFromDB(
TaskID: string,
stepId: string,
branchId: string,
nodeId: string,
edges: any[] = [],
): Promise<boolean> {
// 导入 api避免循环导入问题
const { default: api } = await import('@/api')
const result = await api.deleteTaskProcessNode(TaskID, stepId, branchId, nodeId, edges)
return result
}
/**
*
* @param dbBranches
* @param TaskID ID __CURRENT_TASK_ID__
* @description : { stepIdUUID: { agentGroupKey: [IBranchData...] } }
*/
function restoreTaskProcessBranchesFromDB(dbBranches: Record<string, Record<string, any[]>>) {
// 清除现有数据
taskProcessBranchesMap.value.clear()
if (!dbBranches) {
return
}
// 恢复数据
for (const [taskStepId, agentMap] of Object.entries(dbBranches)) {
if (typeof agentMap !== 'object' || agentMap === null) {
continue
}
// 获取或创建该步骤的 Map
if (!taskProcessBranchesMap.value.has(taskStepId)) {
taskProcessBranchesMap.value.set(taskStepId, new Map())
}
const stepMap = taskProcessBranchesMap.value.get(taskStepId)!
// 恢复 agent combinations
for (const [agentGroupKey, branches] of Object.entries(agentMap)) {
if (Array.isArray(branches)) {
stepMap.set(agentGroupKey, branches)
}
}
}
}
2025-12-31 19:04:58 +08:00
// ==================== Agent 组合 TaskProcess 数据存储 ====================
2026-01-19 09:12:06 +08:00
/**
* Agent TaskProcess
* @description fill_stepTask_TaskProcess
* 存储结构: Map<taskId, Map<agentGroupKey, IApiStepTask>>
* - taskId: 任务 ID
* - agentGroupKey: agent JSON
* - IApiStepTask: agent TaskProcess
*/
2025-12-31 19:04:58 +08:00
const agentTaskProcessMap = ref<Map<string, Map<string, IApiStepTask>>>(new Map())
2026-01-19 09:12:06 +08:00
/**
* agent key
* @description
* @param agents Agent
* @returns Agent
*/
2025-12-31 19:04:58 +08:00
function getAgentGroupKey(agents: string[]): string {
2026-01-19 09:12:06 +08:00
// 处理 undefined 或 null 的情况
if (!agents || !Array.isArray(agents)) {
return JSON.stringify([])
}
return JSON.stringify([...agents].sort())
2025-12-31 19:04:58 +08:00
}
2026-01-19 09:12:06 +08:00
/**
* agent TaskProcess
* @param stepId ID UUID agentTaskProcessMap
2026-01-19 09:12:06 +08:00
* @param agents Agent
* @param taskProcess TaskProcess
* @description 存储结构: Map<stepId, Map<agentGroupKey, { process, brief }>>
* agentTaskProcessMap = { stepId: { agentGroupKey: { process, brief } } }
* { process, brief }
2026-01-19 09:12:06 +08:00
*/
function setAgentTaskProcess(
stepId: string,
agents: string[],
taskProcess: IApiStepTask | { process: any; brief: any },
) {
2025-12-31 19:04:58 +08:00
const groupKey = getAgentGroupKey(agents)
// 获取或创建该步骤的 Map
if (!agentTaskProcessMap.value.has(stepId)) {
agentTaskProcessMap.value.set(stepId, new Map())
}
const stepMap = agentTaskProcessMap.value.get(stepId)!
// 统一转换为简化格式 { process, brief },与后端期望格式一致
const simplifiedData = {
process: (taskProcess as IApiStepTask).process || taskProcess.process || [],
brief: (taskProcess as IApiStepTask).brief || taskProcess.brief || {},
2025-12-31 19:04:58 +08:00
}
// 存储该 agent 组合的 TaskProcess 数据
stepMap.set(groupKey, simplifiedData)
2025-12-31 19:04:58 +08:00
}
2026-01-19 09:12:06 +08:00
/**
* agent TaskProcess
* @param taskId ID
* @param agents Agent
* @returns TaskProcess
*/
2025-12-31 19:04:58 +08:00
function getAgentTaskProcess(taskId: string, agents: string[]): IApiStepTask | undefined {
const groupKey = getAgentGroupKey(agents)
return agentTaskProcessMap.value.get(taskId)?.get(groupKey)
}
2026-01-19 09:12:06 +08:00
/**
* agent TaskProcess
* @param taskId ID
* @param agents Agent
* @returns
*/
2025-12-31 19:04:58 +08:00
function hasAgentTaskProcess(taskId: string, agents: string[]): boolean {
const groupKey = getAgentGroupKey(agents)
return agentTaskProcessMap.value.get(taskId)?.has(groupKey) || false
}
/**
* agent TaskProcess
* @param taskId ID
* @param agents Agent
*/
function removeAgentTaskProcess(taskId: string, agents: string[]) {
const groupKey = getAgentGroupKey(agents)
agentTaskProcessMap.value.get(taskId)?.delete(groupKey)
}
2026-01-19 09:12:06 +08:00
/**
* agent TaskProcess
* @param taskId ID
*/
2025-12-31 19:04:58 +08:00
function clearAgentTaskProcess(taskId: string) {
agentTaskProcessMap.value.delete(taskId)
}
2026-01-19 09:12:06 +08:00
/** 清除所有任务的 agent 组合 TaskProcess 数据 */
2025-12-31 19:04:58 +08:00
function clearAllAgentTaskProcess() {
agentTaskProcessMap.value.clear()
}
/**
* agent TaskProcess
* @param stepId ID UUID
* @returns agent_combinations { "[\"AgentA\",\"AgentB\"]": { process, brief }, ... }
* @description 存储结构: Map<stepId, Map<agentGroupKey, { process, brief }>>
* key stepId
*/
function getAgentCombinations(
stepId: string,
): Record<string, { process: any; brief: any }> | undefined {
// 直接使用 stepId 作为第一层 key
const stepMap = agentTaskProcessMap.value.get(stepId)
if (!stepMap) {
return undefined
}
// 将 Map 转换为普通对象
const result: Record<string, { process: any; brief: any }> = {}
for (const [key, value] of stepMap.entries()) {
result[key] = value
}
return result
}
// ==================== 数据库持久化恢复方法 ====================
/**
* assigned_agents agent
* @param assignedAgents assigned_agents
* @param taskId ID使 stepId key
* @description : { step_idUUID: { current: [...], confirmed_groups: [...], agent_combinations: {...} } }
* 存储结构: Map<stepId, Map<agentGroupKey, IApiStepTask>>
* agentTaskProcessMap = { stepId: { agentGroupKey: data } }
*/
function restoreAgentCombinationsFromDB(assignedAgents: Record<string, any>, taskId: string) {
// 获取 agents store 实例
const agentsStore = useAgentsStoreHook()
// 清除现有数据
clearAllAgentTaskProcess()
agentsStore.clearAllConfirmedAgentGroups()
if (!assignedAgents) {
return
}
// 🆕 简化版本:直接使用 stepId 作为第一层 key
// 遍历每个步骤的数据
for (const [stepId, stepData] of Object.entries(assignedAgents)) {
if (typeof stepData !== 'object' || stepData === null) {
continue
}
// 获取或创建该步骤的 Map
if (!agentTaskProcessMap.value.has(stepId)) {
agentTaskProcessMap.value.set(stepId, new Map<string, IApiStepTask>())
}
const stepMap = agentTaskProcessMap.value.get(stepId)!
// 恢复 agent_combinations 到 stepMap
// 格式: { agentGroupKey: { process, brief } }
if (stepData.agent_combinations) {
for (const [agentGroupKey, combinationData] of Object.entries(
stepData.agent_combinations,
)) {
stepMap.set(agentGroupKey, combinationData as IApiStepTask)
}
}
// 恢复 confirmed_groups
if (stepData.confirmed_groups) {
agentsStore.setConfirmedAgentGroups(stepId, stepData.confirmed_groups)
}
// 恢复 current当前选中的 agent 组合)
if (stepData.current) {
agentsStore.setSelectedAgentGroup(stepId, stepData.current)
// 同步更新 agentRawPlan 中对应步骤的 AgentSelection
const planData = agentsStore.agentRawPlan.data
if (planData && planData['Collaboration Process']) {
const process = planData['Collaboration Process']
const step = process.find((s: any) => s.Id === stepId)
if (step) {
step.AgentSelection = stepData.current
}
}
}
}
}
2026-01-09 13:54:32 +08:00
// ==================== 当前生效的任务过程分支 ====================
2026-01-19 09:12:06 +08:00
/**
*
* @description agent ID
* 存储结构: Map<taskStepId, Map<agentGroupKey, branchId>>
* - taskStepId: 任务步骤 ID
* - agentGroupKey: agent
* - branchId: 当前选中的分支 ID
*/
const activeTaskProcessBranchMap = ref<Map<string, Map<string, string>>>(new Map())
2026-01-09 13:54:32 +08:00
2026-01-19 09:12:06 +08:00
/**
* TaskProcess
* @description
* 存储结构: Map<taskStepId, Map<agentGroupKey, TaskProcess[]>>
*/
const activeTaskProcessDataMap = ref<Map<string, Map<string, any[]>>>(new Map())
2026-01-09 13:54:32 +08:00
2026-01-19 09:12:06 +08:00
/**
*
* @param taskStepId ID
* @param agents Agent
* @param branchId ID
*/
function setActiveTaskProcessBranch(taskStepId: string, agents: string[], branchId: string) {
const agentGroupKey = getAgentGroupKey(agents)
// 获取或创建该任务步骤的 Map
if (!activeTaskProcessBranchMap.value.has(taskStepId)) {
activeTaskProcessBranchMap.value.set(taskStepId, new Map())
}
activeTaskProcessBranchMap.value.get(taskStepId)!.set(agentGroupKey, branchId)
2026-01-09 13:54:32 +08:00
}
2026-01-19 09:12:06 +08:00
/**
* TaskProcess
* @param taskStepId ID
* @param agents Agent
* @param taskProcess TaskProcess
*/
function setActiveTaskProcessData(taskStepId: string, agents: string[], taskProcess: any[]) {
const agentGroupKey = getAgentGroupKey(agents)
// 获取或创建该任务步骤的 Map
if (!activeTaskProcessDataMap.value.has(taskStepId)) {
activeTaskProcessDataMap.value.set(taskStepId, new Map())
}
activeTaskProcessDataMap.value.get(taskStepId)!.set(agentGroupKey, taskProcess)
2026-01-09 13:54:32 +08:00
}
2026-01-19 09:12:06 +08:00
/**
* ID
* @param taskStepId ID
* @param agents Agent
* @returns ID
*/
function getActiveTaskProcessBranch(taskStepId: string, agents: string[]): string | undefined {
const agentGroupKey = getAgentGroupKey(agents)
return activeTaskProcessBranchMap.value.get(taskStepId)?.get(agentGroupKey)
2026-01-09 13:54:32 +08:00
}
2026-01-19 09:12:06 +08:00
/**
* TaskProcess
* @param taskStepId ID
* @param agents Agent
* @returns TaskProcess
*/
function getActiveTaskProcessData(taskStepId: string, agents: string[]): any[] | undefined {
const agentGroupKey = getAgentGroupKey(agents)
return activeTaskProcessDataMap.value.get(taskStepId)?.get(agentGroupKey)
2026-01-09 13:54:32 +08:00
}
2026-01-19 09:12:06 +08:00
/**
*
* @param taskStepId ID
* @param agents Agent
*/
function clearActiveTaskProcessBranch(taskStepId: string, agents?: string[]) {
if (agents) {
// 清除指定 agent 组合的生效分支
const agentGroupKey = getAgentGroupKey(agents)
activeTaskProcessBranchMap.value.get(taskStepId)?.delete(agentGroupKey)
activeTaskProcessDataMap.value.get(taskStepId)?.delete(agentGroupKey)
} else {
// 清除该任务步骤的所有生效分支(所有 agent 组合)
activeTaskProcessBranchMap.value.delete(taskStepId)
activeTaskProcessDataMap.value.delete(taskStepId)
}
2026-01-09 13:54:32 +08:00
}
2025-12-31 19:04:58 +08:00
return {
2026-01-19 09:12:06 +08:00
// ==================== 状态 ====================
2025-12-31 19:04:58 +08:00
flowBranches,
taskProcessBranchesMap,
agentTaskProcessMap,
2026-01-09 13:54:32 +08:00
activeTaskProcessBranchMap,
2026-01-19 09:12:06 +08:00
activeTaskProcessDataMap,
2025-12-31 19:04:58 +08:00
2026-01-19 09:12:06 +08:00
// ==================== 任务大纲分支管理方法 ====================
2025-12-31 19:04:58 +08:00
addFlowBranch,
getAllFlowBranches,
getFlowBranchesByParent,
removeFlowBranch,
clearFlowBranches,
clearFlowBranchesByParent,
2026-01-19 09:12:06 +08:00
// ==================== 任务过程分支管理方法 ====================
2025-12-31 19:04:58 +08:00
addTaskProcessBranch,
getTaskProcessBranches,
getAllTaskProcessBranches,
getTaskProcessBranchesByParent,
removeTaskProcessBranch,
removeNodeFromBranch,
2025-12-31 19:04:58 +08:00
clearTaskProcessBranches,
2026-01-19 09:12:06 +08:00
// ==================== 任务过程分支生效状态管理方法 ====================
2026-01-09 13:54:32 +08:00
setActiveTaskProcessBranch,
2026-01-19 09:12:06 +08:00
setActiveTaskProcessData,
2026-01-09 13:54:32 +08:00
getActiveTaskProcessBranch,
2026-01-19 09:12:06 +08:00
getActiveTaskProcessData,
2026-01-09 13:54:32 +08:00
clearActiveTaskProcessBranch,
2026-01-19 09:12:06 +08:00
// ==================== Agent 组合 TaskProcess 数据管理方法 ====================
2025-12-31 19:04:58 +08:00
getAgentGroupKey,
setAgentTaskProcess,
getAgentTaskProcess,
hasAgentTaskProcess,
removeAgentTaskProcess,
2025-12-31 19:04:58 +08:00
clearAgentTaskProcess,
getAgentCombinations,
2025-12-31 19:04:58 +08:00
clearAllAgentTaskProcess,
// ==================== 数据库持久化方法 ====================
restoreBranchesFromDB,
saveBranchesToDB,
restoreAgentCombinationsFromDB,
saveTaskProcessBranchesToDB,
deleteTaskProcessBranchFromDB,
deleteTaskProcessNodeFromDB,
restoreTaskProcessBranchesFromDB,
2025-12-31 19:04:58 +08:00
}
})
/**
* 使 Selection Store
2026-01-19 09:12:06 +08:00
* @returns Selection Store
2025-12-31 19:04:58 +08:00
*/
export function useSelectionStoreHook() {
return useSelectionStore(store)
}