@flowgram.ai/runtime-js 0.5.5 → 0.5.7

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 +1 @@
1
- {"version":3,"sources":["../../../interface/src/api/task-validate/index.ts","../../../interface/src/api/schema.ts","../../../interface/src/api/constant.ts","../../../interface/src/api/task-run/index.ts","../../../interface/src/api/task-result/index.ts","../../../interface/src/api/task-report/index.ts","../../../interface/src/api/task-cancel/index.ts","../../../interface/src/api/server-info/index.ts","../../../interface/src/api/define.ts","../../../interface/src/schema/constant.ts","../../../interface/src/node/constant.ts","../../../interface/src/node/condition/constant.ts","../../../interface/src/node/http/constant.ts","../../../interface/src/runtime/engine/index.ts","../../../interface/src/runtime/executor/executor.ts","../../../interface/src/runtime/status/index.ts","../../../interface/src/runtime/validation/index.ts","../../../interface/src/runtime/message/index.ts","../../src/nodes/start/index.ts","../../src/nodes/loop/index.ts","../../src/infrastructure/utils/uuid.ts","../../src/infrastructure/utils/runtime-type.ts","../../src/infrastructure/utils/traverse-nodes.ts","../../src/infrastructure/utils/compare-node-groups.ts","../../src/infrastructure/utils/json-schema-validator.ts","../../src/nodes/llm/index.ts","../../src/nodes/http/index.ts","../../src/nodes/end/index.ts","../../src/nodes/empty/index.ts","../../src/nodes/continue/index.ts","../../src/nodes/condition/index.ts","../../src/nodes/condition/rules.ts","../../src/nodes/condition/handlers/string.ts","../../src/nodes/condition/handlers/object.ts","../../src/nodes/condition/handlers/number.ts","../../src/nodes/condition/handlers/null.ts","../../src/nodes/condition/handlers/map.ts","../../src/nodes/condition/handlers/datetime.ts","../../src/nodes/condition/handlers/boolean.ts","../../src/nodes/condition/handlers/array.ts","../../src/nodes/condition/handlers/index.ts","../../src/nodes/code/index.ts","../../src/nodes/break/index.ts","../../src/nodes/index.ts","../../src/domain/validation/validators/cycle-detection.ts","../../src/domain/validation/validators/start-end-node.ts","../../src/domain/validation/validators/edge-source-target-exist.ts","../../src/domain/validation/validators/schema-format.ts","../../src/domain/validation/index.ts","../../src/domain/executor/index.ts","../../src/domain/task/index.ts","../../src/domain/message/message-value-object/index.ts","../../src/domain/message/message-center/index.ts","../../src/domain/cache/index.ts","../../src/domain/variable/variable-store/index.ts","../../src/domain/variable/variable-value-object/index.ts","../../src/domain/status/status-entity/index.ts","../../src/domain/status/status-center/index.ts","../../src/domain/state/index.ts","../../src/domain/snapshot/snapshot-entity/index.ts","../../src/domain/snapshot/snapshot-center/index.ts","../../src/domain/report/report-value-object/index.ts","../../src/domain/report/reporter/index.ts","../../src/domain/io-center/index.ts","../../src/domain/document/entity/edge/index.ts","../../src/domain/document/entity/node/index.ts","../../src/domain/document/entity/port/index.ts","../../src/domain/document/document/flat-schema.ts","../../src/domain/document/document/create-store.ts","../../src/domain/document/document/index.ts","../../src/domain/context/index.ts","../../src/domain/engine/index.ts","../../src/domain/container/index.ts","../../src/application/workflow.ts","../../src/api/task-validate.ts","../../src/api/task-run.ts","../../src/api/task-result.ts","../../src/api/task-report.ts","../../src/api/task-cancel.ts","../../src/api/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult, WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskValidateInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskValidateOutput extends ValidationResult {}\n\nexport const TaskValidateDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskValidate,\n method: FlowGramAPIMethod.POST,\n path: '/task/validate',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n valid: z.boolean(),\n errors: z.array(z.string()).optional(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\n\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\n\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nconst WorkflowNodeReportZodSchema = z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n});\n\nconst WorkflowReportsZodSchema = z.record(z.string(), WorkflowNodeReportZodSchema);\n\nconst WorkflowMessageZodSchema = z.object({\n id: z.string(),\n type: z.enum(['log', 'info', 'debug', 'error', 'warning']),\n message: z.string(),\n nodeID: z.string().optional(),\n timestamp: z.number(),\n});\n\nconst WorkflowMessagesZodSchema = z.record(\n z.enum(['log', 'info', 'debug', 'error', 'warning']),\n z.array(WorkflowMessageZodSchema)\n);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n Reports: WorkflowReportsZodSchema,\n Messages: WorkflowMessagesZodSchema,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n TaskValidate = 'TaskValidate',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: WorkflowZodSchema.Reports,\n messages: WorkflowZodSchema.Messages,\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIDefines } from './type';\nimport { TaskValidateDefine } from './task-validate';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.TaskValidate]: TaskValidateDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Map = 'map',\n DateTime = 'date-time',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n Code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n HTTP = 'http',\n Break = 'break',\n Continue = 'continue',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperator {\n /** Equal */\n EQ = 'eq',\n /** Not Equal */\n NEQ = 'neq',\n /** Greater Than */\n GT = 'gt',\n /** Greater Than or Equal */\n GTE = 'gte',\n /** Less Than */\n LT = 'lt',\n /** Less Than or Equal */\n LTE = 'lte',\n /** In */\n IN = 'in',\n /** Not In */\n NIN = 'nin',\n /** Contains */\n CONTAINS = 'contains',\n /** Not Contains */\n NOT_CONTAINS = 'not_contains',\n /** Is Empty */\n IS_EMPTY = 'is_empty',\n /** Is Not Empty */\n IS_NOT_EMPTY = 'is_not_empty',\n /** Is True */\n IS_TRUE = 'is_true',\n /** Is False */\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum HTTPMethod {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Delete = 'DELETE',\n Patch = 'PATCH',\n Head = 'HEAD',\n}\n\nexport enum HTTPBodyType {\n None = 'none',\n FormData = 'form-data',\n XWwwFormUrlencoded = 'x-www-form-urlencoded',\n RawText = 'raw-text',\n JSON = 'JSON',\n Binary = 'binary',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IValidation } from '@runtime/validation';\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Validation: IValidation;\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Canceled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { InvokeParams } from '@runtime/base';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n invoke(params: InvokeParams): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowMessageType {\n Log = 'log',\n Info = 'info',\n Debug = 'debug',\n Error = 'error',\n Warn = 'warning',\n}\n\nexport interface MessageData {\n message: string;\n nodeID?: string;\n timestamp?: number;\n}\n\nexport interface IMessage extends MessageData {\n id: string;\n type: WorkflowMessageType;\n timestamp: number;\n}\n\nexport type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;\n\nexport interface IMessageCenter {\n init(): void;\n dispose(): void;\n log(data: MessageData): IMessage;\n info(data: MessageData): IMessage;\n debug(data: MessageData): IMessage;\n error(data: MessageData): IMessage;\n warn(data: MessageData): IMessage;\n export(): WorkflowMessages;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class StartExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Start;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: context.runtime.ioCenter.inputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n IContext,\n IEngine,\n IFlowRefValue,\n INode,\n INodeExecutor,\n IVariableParseResult,\n LoopNodeSchema,\n WorkflowVariableType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeType } from '@infra/index';\n\ntype LoopArray = Array<any>;\ntype LoopBlockVariables = Record<string, IVariableParseResult>;\ntype LoopOutputs = Record<string, any>;\n\nexport interface LoopExecutorInputs {\n loopFor: LoopArray;\n}\n\nexport class LoopExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Loop;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const loopNodeID = context.node.id;\n\n const engine = context.container.get<IEngine>(IEngine);\n const { value: loopArray, itemsType } = this.getLoopArrayVariable(context);\n const subNodes = context.node.children;\n const blockStartNode = subNodes.find((node) => node.type === FlowGramNode.BlockStart);\n\n if (!blockStartNode) {\n throw new Error('Loop block start node not found');\n }\n\n const blockOutputs: LoopOutputs[] = [];\n\n // not use Array method to make error stack more concise, and better performance\n for (let index = 0; index < loopArray.length; index++) {\n const loopItem = loopArray[index];\n const subContext = context.runtime.sub();\n subContext.variableStore.setVariable({\n nodeID: `${loopNodeID}_locals`,\n key: 'item',\n type: itemsType,\n value: loopItem,\n });\n subContext.variableStore.setVariable({\n nodeID: `${loopNodeID}_locals`,\n key: 'index',\n type: WorkflowVariableType.Number,\n value: index,\n });\n try {\n await engine.executeNode({\n context: subContext,\n node: blockStartNode,\n });\n } catch (e) {\n throw new Error(`Loop block execute error`);\n }\n if (this.isBreak(subContext)) {\n break;\n }\n if (this.isContinue(subContext)) {\n continue;\n }\n const blockOutput = this.getBlockOutput(context, subContext);\n blockOutputs.push(blockOutput);\n }\n\n this.setLoopNodeOutputs(context, blockOutputs);\n const outputs = this.combineBlockOutputs(context, blockOutputs);\n\n return {\n outputs,\n };\n }\n\n private getLoopArrayVariable(\n executionContext: ExecutionContext\n ): IVariableParseResult<LoopArray> & {\n itemsType: WorkflowVariableType;\n } {\n const loopNodeData = executionContext.node.data as LoopNodeSchema['data'];\n const LoopArrayVariable = executionContext.runtime.state.parseRef<LoopArray>(\n loopNodeData.loopFor\n );\n this.checkLoopArray(LoopArrayVariable);\n return LoopArrayVariable as IVariableParseResult<LoopArray> & {\n itemsType: WorkflowVariableType;\n };\n }\n\n private checkLoopArray(LoopArrayVariable: IVariableParseResult<LoopArray> | null): void {\n const loopArray = LoopArrayVariable?.value;\n if (!loopArray || isNil(loopArray) || !Array.isArray(loopArray)) {\n throw new Error('Loop \"loopFor\" is required');\n }\n const loopArrayType = LoopArrayVariable.type;\n if (loopArrayType !== WorkflowVariableType.Array) {\n throw new Error('Loop \"loopFor\" must be an array');\n }\n const loopArrayItemType = LoopArrayVariable.itemsType;\n if (isNil(loopArrayItemType)) {\n throw new Error('Loop \"loopFor.items\" must be array items');\n }\n }\n\n private getBlockOutput(\n executionContext: ExecutionContext,\n subContext: IContext\n ): LoopBlockVariables {\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const blockOutput = Object.entries(loopOutputsDeclare).reduce(\n (acc, [outputName, outputRef]) => {\n const outputVariable = subContext.state.parseRef(outputRef);\n if (!outputVariable) {\n return acc;\n }\n return {\n ...acc,\n [outputName]: outputVariable,\n };\n },\n {} as LoopBlockVariables\n );\n return blockOutput;\n }\n\n private setLoopNodeOutputs(\n executionContext: ExecutionContext,\n blockOutputs: LoopBlockVariables[]\n ) {\n const loopNode = executionContext.node as INode<LoopNodeSchema['data']>;\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const loopOutputNames = Object.keys(loopOutputsDeclare);\n loopOutputNames.forEach((outputName) => {\n const outputVariables = blockOutputs.map((blockOutput) => blockOutput[outputName]);\n const outputTypes = outputVariables.map((fieldVariable) => fieldVariable.type);\n const itemsType = WorkflowRuntimeType.getArrayItemsType(outputTypes);\n const value = outputVariables.map((fieldVariable) => fieldVariable.value);\n executionContext.runtime.variableStore.setVariable({\n nodeID: loopNode.id,\n key: outputName,\n type: WorkflowVariableType.Array,\n itemsType,\n value,\n });\n });\n }\n\n private combineBlockOutputs(\n executionContext: ExecutionContext,\n blockOutputs: LoopBlockVariables[]\n ): LoopOutputs {\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const loopOutputNames = Object.keys(loopOutputsDeclare);\n const loopOutput = loopOutputNames.reduce(\n (outputs, outputName) => ({\n ...outputs,\n [outputName]: blockOutputs.map((blockOutput) => blockOutput[outputName].value),\n }),\n {} as LoopOutputs\n );\n return loopOutput;\n }\n\n private getLoopOutputsDeclare(executionContext: ExecutionContext): Record<string, IFlowRefValue> {\n const loopNodeData = executionContext.node.data as LoopNodeSchema['data'];\n const loopOutputsDeclare = loopNodeData.loopOutputs ?? {};\n return loopOutputsDeclare;\n }\n\n private isBreak(subContext: IContext): boolean {\n return subContext.cache.get('loop-break') === true;\n }\n\n private isContinue(subContext: IContext): boolean {\n return subContext.cache.get('loop-continue') === true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { v4 } from 'uuid';\n\nexport const uuid = v4;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nexport namespace WorkflowRuntimeType {\n export const getWorkflowType = (value?: unknown): WorkflowVariableType | null => {\n // 处理 null 和 undefined 的情况\n if (value === null || value === undefined) {\n return WorkflowVariableType.Null;\n }\n\n // 处理基本类型\n if (typeof value === 'string') {\n // Check if string is a valid ISO 8601 datetime format\n const iso8601Regex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/;\n if (iso8601Regex.test(value)) {\n const date = new Date(value);\n // Validate that the date is actually valid\n if (!isNaN(date.getTime())) {\n return WorkflowVariableType.DateTime;\n }\n }\n return WorkflowVariableType.String;\n }\n\n if (typeof value === 'boolean') {\n return WorkflowVariableType.Boolean;\n }\n\n if (typeof value === 'number') {\n if (Number.isInteger(value)) {\n return WorkflowVariableType.Integer;\n }\n return WorkflowVariableType.Number;\n }\n\n // 处理数组\n if (Array.isArray(value)) {\n return WorkflowVariableType.Array;\n }\n\n // 处理普通对象\n if (typeof value === 'object') {\n return WorkflowVariableType.Object;\n }\n\n return null;\n };\n\n export const isMatchWorkflowType = (value: unknown, type: WorkflowVariableType): boolean => {\n const workflowType = getWorkflowType(value);\n if (!workflowType) {\n return false;\n }\n return workflowType === type;\n };\n\n export const isTypeEqual = (\n typeA: WorkflowVariableType,\n typeB: WorkflowVariableType\n ): boolean => {\n // 处理 Number 和 Integer 等价的情况\n if (\n (typeA === WorkflowVariableType.Number && typeB === WorkflowVariableType.Integer) ||\n (typeA === WorkflowVariableType.Integer && typeB === WorkflowVariableType.Number)\n ) {\n return true;\n }\n return typeA === typeB;\n };\n\n export const getArrayItemsType = (types: WorkflowVariableType[]): WorkflowVariableType => {\n const expectedType = types[0];\n types.forEach((type) => {\n if (type !== expectedType) {\n throw new Error(`Array items type must be same, expect ${expectedType}, but got ${type}`);\n }\n });\n return expectedType;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INode } from '@flowgram.ai/runtime-interface';\n\n/**\n * Generic function to traverse a node graph\n * @param startNode The starting node\n * @param getConnectedNodes Function to get connected nodes\n * @returns Array of all traversed nodes\n */\nexport function traverseNodes(\n startNode: INode,\n getConnectedNodes: (node: INode) => INode[]\n): INode[] {\n const visited = new Set<string>();\n const result: INode[] = [];\n\n const traverse = (node: INode) => {\n for (const connectedNode of getConnectedNodes(node)) {\n if (!visited.has(connectedNode.id)) {\n visited.add(connectedNode.id);\n result.push(connectedNode);\n traverse(connectedNode);\n }\n }\n };\n\n traverse(startNode);\n return result;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INode } from '@flowgram.ai/runtime-interface';\n\n/**\n * Interface for node comparison results\n */\nexport interface NodeComparisonResult {\n /** Nodes common to both groups A and B */\n common: INode[];\n /** Nodes unique to group A */\n uniqueToA: INode[];\n /** Nodes unique to group B */\n uniqueToB: INode[];\n}\n\n/**\n * Compare two groups of node arrays to find common nodes and nodes unique to each group\n *\n * @param groupA Array of nodes in group A\n * @param groupB Array of nodes in group B\n * @returns Node comparison result\n *\n * @example\n * ```typescript\n * const groupA = [\n * [node1, node4, node5, node6, node10],\n * [node2, node3, node4, node5, node6, node10]\n * ];\n * const groupB = [\n * [node7, node8, node9, node4, node5, node6, node10]\n * ];\n *\n * const result = compareNodeGroups(groupA, groupB);\n * -> result.common: [node4, node5, node6, node10]\n * -> result.uniqueToA: [node1, node2, node3]\n * -> result.uniqueToB: [node7, node8, node9]\n * ```\n */\nexport function compareNodeGroups(groupA: INode[][], groupB: INode[][]): NodeComparisonResult {\n // Flatten and deduplicate all nodes in group A\n const flatA = groupA.flat();\n const setA = new Map<string, INode>();\n flatA.forEach((node) => {\n setA.set(node.id, node);\n });\n\n // Flatten and deduplicate all nodes in group B\n const flatB = groupB.flat();\n const setB = new Map<string, INode>();\n flatB.forEach((node) => {\n setB.set(node.id, node);\n });\n\n // Find common nodes\n const common: INode[] = [];\n const uniqueToA: INode[] = [];\n const uniqueToB: INode[] = [];\n\n // Iterate through group A nodes to find common nodes and nodes unique to A\n setA.forEach((node, id) => {\n if (setB.has(id)) {\n common.push(node);\n } else {\n uniqueToA.push(node);\n }\n });\n\n // Iterate through group B nodes to find nodes unique to B\n setB.forEach((node, id) => {\n if (!setA.has(id)) {\n uniqueToB.push(node);\n }\n });\n\n return {\n common,\n uniqueToA,\n uniqueToB,\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IJsonSchema } from '@flowgram.ai/runtime-interface';\n\n// Define validation result type\ntype ValidationResult = {\n result: boolean;\n errorMessage?: string;\n};\n\n// Define JSON Schema validator parameters type\ntype JSONSchemaValidatorParams = {\n schema: IJsonSchema;\n value: unknown;\n};\n\nconst ROOT_PATH = 'root';\n\nexport const isRootPath = (path: string) => path === ROOT_PATH;\n\n// Recursively validate value against JSON Schema\nconst validateValue = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n // Handle $ref references (temporarily skip as no reference resolution mechanism is provided)\n if (schema.$ref) {\n return { result: true }; // Temporarily skip reference validation\n }\n\n // Check enum values\n if (schema.enum && schema.enum.length > 0) {\n if (!schema.enum.includes(value as string | number)) {\n return {\n result: false,\n errorMessage: `Value at ${path} must be one of: ${schema.enum.join(\n ', '\n )}, but got: ${JSON.stringify(value)}`,\n };\n }\n }\n\n // Validate based on type\n switch (schema.type) {\n case 'boolean':\n return validateBoolean(value, path);\n\n case 'string':\n return validateString(value, path);\n\n case 'integer':\n return validateInteger(value, path);\n\n case 'number':\n return validateNumber(value, path);\n\n case 'object':\n return validateObject(value, schema, path);\n\n case 'array':\n return validateArray(value, schema, path);\n\n case 'map':\n return validateMap(value, schema, path);\n\n default:\n return {\n result: false,\n errorMessage: `Unknown type \"${schema.type}\" at ${path}`,\n };\n }\n};\n\n// Validate boolean value\nconst validateBoolean = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'boolean') {\n return {\n result: false,\n errorMessage: `Expected boolean at ${path}, but got: ${typeof value}`,\n };\n }\n return { result: true };\n};\n\n// Validate string value\nconst validateString = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'string') {\n return {\n result: false,\n errorMessage: `Expected string at ${path}, but got: ${typeof value}`,\n };\n }\n return { result: true };\n};\n\n// Validate integer value\nconst validateInteger = (value: unknown, path: string): ValidationResult => {\n if (!Number.isInteger(value)) {\n return {\n result: false,\n errorMessage: `Expected integer at ${path}, but got: ${JSON.stringify(value)}`,\n };\n }\n return { result: true };\n};\n\n// Validate number value\nconst validateNumber = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'number' || isNaN(value)) {\n return {\n result: false,\n errorMessage: `Expected number at ${path}, but got: ${JSON.stringify(value)}`,\n };\n }\n return { result: true };\n};\n\n// Validate object value\nconst validateObject = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (value === null || value === undefined) {\n return {\n result: false,\n errorMessage: `Expected object at ${path}, but got: ${value}`,\n };\n }\n\n if (typeof value !== 'object' || Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected object at ${path}, but got: ${\n Array.isArray(value) ? 'array' : typeof value\n }`,\n };\n }\n\n const objectValue = value as Record<string, unknown>;\n\n // Check required properties\n if (schema.required && schema.required.length > 0) {\n for (const requiredProperty of schema.required) {\n if (!(requiredProperty in objectValue)) {\n return {\n result: false,\n errorMessage: `Missing required property \"${requiredProperty}\" at ${path}`,\n };\n }\n }\n }\n\n // Check is field required\n if (schema.properties) {\n for (const [propertyName] of Object.entries(schema.properties)) {\n const isRequired = schema.required?.includes(propertyName) ?? false;\n if (isRequired && !(propertyName in objectValue)) {\n return {\n result: false,\n errorMessage: `Missing required property \"${propertyName}\" at ${path}`,\n };\n }\n }\n }\n\n // Validate properties\n if (schema.properties) {\n for (const [propertyName, propertySchema] of Object.entries(schema.properties)) {\n if (propertyName in objectValue) {\n const propertyPath = isRootPath(path) ? propertyName : `${path}.${propertyName}`;\n const propertyResult = validateValue(\n objectValue[propertyName],\n propertySchema,\n propertyPath\n );\n if (!propertyResult.result) {\n return propertyResult;\n }\n }\n }\n }\n\n // Validate additional properties\n if (schema.additionalProperties) {\n const definedProperties = new Set(Object.keys(schema.properties || {}));\n for (const [propertyName, propertyValue] of Object.entries(objectValue)) {\n if (!definedProperties.has(propertyName)) {\n const propertyPath = isRootPath(path) ? propertyName : `${path}.${propertyName}`;\n const propertyResult = validateValue(\n propertyValue,\n schema.additionalProperties,\n propertyPath\n );\n if (!propertyResult.result) {\n return propertyResult;\n }\n }\n }\n }\n\n return { result: true };\n};\n\n// Validate array value\nconst validateArray = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (!Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected array at ${path}, but got: ${typeof value}`,\n };\n }\n\n // Validate array items\n if (schema.items) {\n for (const [index, item] of value.entries()) {\n const itemPath = `${path}[${index}]`;\n const itemResult = validateValue(item, schema.items, itemPath);\n if (!itemResult.result) {\n return itemResult;\n }\n }\n }\n\n return { result: true };\n};\n\n// Validate map value (similar to object, but all values must conform to the same schema)\nconst validateMap = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (value === null || value === undefined) {\n return {\n result: false,\n errorMessage: `Expected map at ${path}, but got: ${value}`,\n };\n }\n\n if (typeof value !== 'object' || Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected map at ${path}, but got: ${\n Array.isArray(value) ? 'array' : typeof value\n }`,\n };\n }\n\n const mapValue = value as Record<string, unknown>;\n\n // If additionalProperties exists, validate all values\n if (schema.additionalProperties) {\n for (const [key, mapItemValue] of Object.entries(mapValue)) {\n const keyPath = isRootPath(path) ? key : `${path}.${key}`;\n const keyResult = validateValue(mapItemValue, schema.additionalProperties, keyPath);\n if (!keyResult.result) {\n return keyResult;\n }\n }\n }\n\n return { result: true };\n};\n\n// Main JSON Schema validator function\nexport const JSONSchemaValidator = (params: JSONSchemaValidatorParams): ValidationResult => {\n const { schema, value } = params;\n\n try {\n const validationResult = validateValue(value, schema, ROOT_PATH);\n return validationResult;\n } catch (error) {\n return {\n result: false,\n errorMessage: `Validation error: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { SystemMessage, HumanMessage, BaseMessageLike } from '@langchain/core/messages';\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface LLMExecutorInputs {\n modelName: string;\n apiKey: string;\n apiHost: string;\n temperature: number;\n systemPrompt?: string;\n prompt: string;\n}\n\nexport class LLMExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.LLM;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = context.inputs as LLMExecutorInputs;\n this.checkInputs(inputs);\n\n const { modelName, temperature, apiKey, apiHost, systemPrompt, prompt } = inputs;\n\n const model = new ChatOpenAI({\n modelName,\n temperature,\n apiKey,\n configuration: {\n baseURL: apiHost,\n },\n maxRetries: 3,\n });\n\n const messages: BaseMessageLike[] = [];\n\n if (systemPrompt) {\n messages.push(new SystemMessage(systemPrompt));\n }\n messages.push(new HumanMessage(prompt));\n\n let apiMessage;\n try {\n apiMessage = await model.invoke(messages);\n } catch (error) {\n // 调用 LLM API 失败\n const errorMessage = (error as Error)?.message;\n if (errorMessage === 'Connection error.') {\n throw new Error(`Network error: unreachable api \"${apiHost}\"`);\n }\n throw error;\n }\n\n const result = apiMessage.content;\n return {\n outputs: {\n result,\n },\n };\n }\n\n protected checkInputs(inputs: LLMExecutorInputs) {\n const { modelName, temperature, apiKey, apiHost, prompt } = inputs;\n const missingInputs = [];\n\n if (!modelName) missingInputs.push('modelName');\n if (isNil(temperature)) missingInputs.push('temperature');\n if (!apiKey) missingInputs.push('apiKey');\n if (!apiHost) missingInputs.push('apiHost');\n if (!prompt) missingInputs.push('prompt');\n\n if (missingInputs.length > 0) {\n throw new Error(`LLM node missing required inputs: \"${missingInputs.join('\", \"')}\"`);\n }\n\n this.checkApiHost(apiHost);\n }\n\n private checkApiHost(apiHost: string): void {\n if (!apiHost || typeof apiHost !== 'string') {\n throw new Error(`Invalid API host format - ${apiHost}`);\n }\n\n const url = new URL(apiHost);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error(`Invalid API host protocol - ${url.protocol}`);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n HTTPBodyType,\n HTTPMethod,\n HTTPNodeSchema,\n INode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface HTTPExecutorInputs {\n method: HTTPMethod;\n url: string;\n headers: Record<string, string>;\n params: Record<string, string>;\n bodyType: HTTPBodyType;\n body: string;\n retryTimes: number;\n timeout: number;\n}\n\nexport class HTTPExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.HTTP;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = this.parseInputs(context);\n const response = await this.request(inputs);\n\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n const responseBody = await response.text();\n\n return {\n outputs: {\n headers: responseHeaders,\n statusCode: response.status,\n body: responseBody,\n },\n };\n }\n\n private async request(inputs: HTTPExecutorInputs): Promise<Response> {\n const { method, url, headers, params, bodyType, body, retryTimes, timeout } = inputs;\n\n // Build URL with query parameters\n const urlWithParams = this.buildUrlWithParams(url, params);\n\n // Prepare request options\n const requestOptions: RequestInit = {\n method,\n headers: this.prepareHeaders(headers, bodyType),\n signal: AbortSignal.timeout(timeout),\n };\n\n // Add body if method supports it\n if (method !== 'GET' && method !== 'HEAD' && body) {\n requestOptions.body = this.prepareBody(body, bodyType);\n }\n\n // Implement retry logic\n let lastError: Error | null = null;\n for (let attempt = 0; attempt <= retryTimes; attempt++) {\n try {\n const response = await fetch(urlWithParams, requestOptions);\n return response;\n } catch (error) {\n lastError = error as Error;\n if (attempt < retryTimes) {\n // Wait before retry (exponential backoff)\n await new Promise((resolve) => setTimeout(resolve, Math.pow(2, attempt) * 1000));\n }\n }\n }\n\n throw lastError || new Error('HTTP request failed after all retry attempts');\n }\n\n private parseInputs(context: ExecutionContext): HTTPExecutorInputs {\n const httpNode = context.node as INode<HTTPNodeSchema['data']>;\n const method = httpNode.data.api.method;\n const urlVariable = context.runtime.state.parseTemplate(httpNode.data.api.url);\n if (!urlVariable) {\n throw new Error('HTTP url is required');\n }\n const url = urlVariable.value;\n const headers = context.runtime.state.parseInputs({\n values: httpNode.data.headersValues,\n declare: httpNode.data.headers,\n });\n const params = context.runtime.state.parseInputs({\n values: httpNode.data.paramsValues,\n declare: httpNode.data.params,\n });\n const body = this.parseBody(context);\n const retryTimes = httpNode.data.timeout.retryTimes;\n const timeout = httpNode.data.timeout.timeout;\n const inputs = {\n method,\n url,\n headers,\n params,\n bodyType: body.bodyType,\n body: body.body,\n retryTimes,\n timeout,\n };\n context.snapshot.update({\n inputs: JSON.parse(JSON.stringify(inputs)),\n });\n return inputs;\n }\n\n private parseBody(context: ExecutionContext): {\n bodyType: HTTPBodyType;\n body: string;\n } {\n const httpNode = context.node as INode<HTTPNodeSchema['data']>;\n const bodyType = httpNode.data.body.bodyType;\n if (bodyType === HTTPBodyType.None) {\n return {\n bodyType,\n body: '',\n };\n }\n if (bodyType === HTTPBodyType.JSON) {\n if (!httpNode.data.body.json) {\n throw new Error('HTTP json body is required');\n }\n const jsonVariable = context.runtime.state.parseTemplate(httpNode.data.body.json);\n if (!jsonVariable) {\n throw new Error('HTTP json body is required');\n }\n return {\n bodyType,\n body: jsonVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.FormData) {\n if (!httpNode.data.body.formData || !httpNode.data.body.formDataValues) {\n throw new Error('HTTP form-data body is required');\n }\n\n const formData = context.runtime.state.parseInputs({\n values: httpNode.data.body.formDataValues,\n declare: httpNode.data.body.formData,\n });\n return {\n bodyType,\n body: JSON.stringify(formData),\n };\n }\n if (bodyType === HTTPBodyType.RawText) {\n if (!httpNode.data.body.json) {\n throw new Error('HTTP json body is required');\n }\n const jsonVariable = context.runtime.state.parseTemplate(httpNode.data.body.json);\n if (!jsonVariable) {\n throw new Error('HTTP json body is required');\n }\n return {\n bodyType,\n body: jsonVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.Binary) {\n if (!httpNode.data.body.binary) {\n throw new Error('HTTP binary body is required');\n }\n const binaryVariable = context.runtime.state.parseTemplate(httpNode.data.body.binary);\n if (!binaryVariable) {\n throw new Error('HTTP binary body is required');\n }\n return {\n bodyType,\n body: binaryVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.XWwwFormUrlencoded) {\n if (!httpNode.data.body.xWwwFormUrlencoded || !httpNode.data.body.xWwwFormUrlencodedValues) {\n throw new Error('HTTP x-www-form-urlencoded body is required');\n }\n const xWwwFormUrlencoded = context.runtime.state.parseInputs({\n values: httpNode.data.body.xWwwFormUrlencodedValues,\n declare: httpNode.data.body.xWwwFormUrlencoded,\n });\n return {\n bodyType,\n body: JSON.stringify(xWwwFormUrlencoded),\n };\n }\n throw new Error(`HTTP invalid body type \"${bodyType}\"`);\n }\n\n private buildUrlWithParams(url: string, params: Record<string, string>): string {\n const urlObj = new URL(url);\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null && value !== '') {\n urlObj.searchParams.set(key, value);\n }\n });\n return urlObj.toString();\n }\n\n private prepareHeaders(\n headers: Record<string, string>,\n bodyType: HTTPBodyType\n ): Record<string, string> {\n const preparedHeaders = { ...headers };\n\n // Set Content-Type based on body type if not already set\n if (!preparedHeaders['Content-Type'] && !preparedHeaders['content-type']) {\n switch (bodyType) {\n case HTTPBodyType.JSON:\n preparedHeaders['Content-Type'] = 'application/json';\n break;\n case HTTPBodyType.FormData:\n // Don't set Content-Type for FormData, let browser set it with boundary\n break;\n case HTTPBodyType.XWwwFormUrlencoded:\n preparedHeaders['Content-Type'] = 'application/x-www-form-urlencoded';\n break;\n case HTTPBodyType.RawText:\n preparedHeaders['Content-Type'] = 'text/plain';\n break;\n case HTTPBodyType.Binary:\n preparedHeaders['Content-Type'] = 'application/octet-stream';\n break;\n }\n }\n\n return preparedHeaders;\n }\n\n private prepareBody(body: string, bodyType: HTTPBodyType): string | FormData {\n switch (bodyType) {\n case HTTPBodyType.JSON:\n return body;\n case HTTPBodyType.FormData:\n const formData = new FormData();\n try {\n const data = JSON.parse(body);\n Object.entries(data).forEach(([key, value]) => {\n formData.append(key, String(value));\n });\n } catch (error) {\n throw new Error('Invalid FormData body format');\n }\n return formData;\n case HTTPBodyType.XWwwFormUrlencoded:\n try {\n const data = JSON.parse(body);\n const params = new URLSearchParams();\n Object.entries(data).forEach(([key, value]) => {\n params.append(key, String(value));\n });\n return params.toString();\n } catch (error) {\n throw new Error('Invalid x-www-form-urlencoded body format');\n }\n case HTTPBodyType.RawText:\n case HTTPBodyType.Binary:\n default:\n return body;\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class EndExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.End;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.ioCenter.setOutputs(context.inputs);\n return {\n outputs: context.inputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class BlockStartExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.BlockStart;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: {},\n };\n }\n}\n\nexport class BlockEndExecutor implements INodeExecutor {\n public type = FlowGramNode.BlockEnd;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class ContinueExecutor implements INodeExecutor {\n public type = FlowGramNode.Continue;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.cache.set('loop-continue', true);\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n ConditionItem,\n ConditionOperator,\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n WorkflowVariableType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeType } from '@infra/index';\nimport { ConditionValue, Conditions } from './type';\nimport { conditionRules } from './rules';\nimport { conditionHandlers } from './handlers';\n\nexport class ConditionExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Condition;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const conditions: Conditions = context.node.data?.conditions;\n if (!conditions) {\n return {\n outputs: {},\n };\n }\n const parsedConditions = conditions\n .map((item) => this.parseCondition(item, context))\n .filter((item) => this.checkCondition(item));\n const activatedCondition = parsedConditions.find((item) => this.handleCondition(item));\n if (!activatedCondition) {\n return {\n outputs: {},\n branch: 'else',\n };\n }\n return {\n outputs: {},\n branch: activatedCondition.key,\n };\n }\n\n private parseCondition(item: ConditionItem, context: ExecutionContext): ConditionValue {\n const { key, value } = item;\n const { left, operator, right } = value;\n const parsedLeft = context.runtime.state.parseRef(left);\n const leftValue = parsedLeft?.value ?? null;\n const leftType = parsedLeft?.type ?? WorkflowVariableType.Null;\n const expectedRightType = this.getRuleType({ leftType, operator });\n const parsedRight = Boolean(right)\n ? context.runtime.state.parseFlowValue({\n flowValue: right,\n declareType: expectedRightType,\n })\n : null;\n const rightValue = parsedRight?.value ?? null;\n const rightType = parsedRight?.type ?? WorkflowVariableType.Null;\n return {\n key,\n leftValue,\n leftType,\n rightValue,\n rightType,\n operator,\n };\n }\n\n private checkCondition(condition: ConditionValue): boolean {\n const rule = conditionRules[condition.leftType];\n if (isNil(rule)) {\n throw new Error(`Condition left type \"${condition.leftType}\" is not supported`);\n }\n const ruleType = rule[condition.operator];\n if (isNil(ruleType)) {\n throw new Error(\n `Condition left type \"${condition.leftType}\" has no operator \"${condition.operator}\"`\n );\n }\n if (!WorkflowRuntimeType.isTypeEqual(ruleType, condition.rightType)) {\n return false;\n }\n return true;\n }\n\n private handleCondition(condition: ConditionValue): boolean {\n const handler = conditionHandlers[condition.leftType];\n if (!handler) {\n throw new Error(`Condition left type ${condition.leftType} is not supported`);\n }\n const isActive = handler(condition);\n return isActive;\n }\n\n private getRuleType(params: {\n leftType: WorkflowVariableType;\n operator: ConditionOperator;\n }): WorkflowVariableType {\n const { leftType, operator } = params;\n const rule = conditionRules[leftType];\n if (isNil(rule)) {\n return WorkflowVariableType.Null;\n }\n const ruleType = rule[operator];\n if (isNil(ruleType)) {\n return WorkflowVariableType.Null;\n }\n return ruleType;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ConditionOperator, WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionRules } from './type';\n\nexport const conditionRules: ConditionRules = {\n [WorkflowVariableType.String]: {\n [ConditionOperator.EQ]: WorkflowVariableType.String,\n [ConditionOperator.NEQ]: WorkflowVariableType.String,\n [ConditionOperator.CONTAINS]: WorkflowVariableType.String,\n [ConditionOperator.NOT_CONTAINS]: WorkflowVariableType.String,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.String,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.String,\n },\n [WorkflowVariableType.Number]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Number,\n [ConditionOperator.NEQ]: WorkflowVariableType.Number,\n [ConditionOperator.GT]: WorkflowVariableType.Number,\n [ConditionOperator.GTE]: WorkflowVariableType.Number,\n [ConditionOperator.LT]: WorkflowVariableType.Number,\n [ConditionOperator.LTE]: WorkflowVariableType.Number,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Integer]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Integer,\n [ConditionOperator.NEQ]: WorkflowVariableType.Integer,\n [ConditionOperator.GT]: WorkflowVariableType.Integer,\n [ConditionOperator.GTE]: WorkflowVariableType.Integer,\n [ConditionOperator.LT]: WorkflowVariableType.Integer,\n [ConditionOperator.LTE]: WorkflowVariableType.Integer,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Boolean]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Boolean,\n [ConditionOperator.NEQ]: WorkflowVariableType.Boolean,\n [ConditionOperator.IS_TRUE]: WorkflowVariableType.Null,\n [ConditionOperator.IS_FALSE]: WorkflowVariableType.Null,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Object]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Map]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.DateTime]: {\n [ConditionOperator.EQ]: WorkflowVariableType.DateTime,\n [ConditionOperator.NEQ]: WorkflowVariableType.DateTime,\n [ConditionOperator.GT]: WorkflowVariableType.DateTime,\n [ConditionOperator.GTE]: WorkflowVariableType.DateTime,\n [ConditionOperator.LT]: WorkflowVariableType.DateTime,\n [ConditionOperator.LTE]: WorkflowVariableType.DateTime,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Array]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Null]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Null,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionStringHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as string;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as string;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as string;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.CONTAINS) {\n const rightValue = condition.rightValue as string;\n return leftValue.includes(rightValue);\n }\n if (operator === ConditionOperator.NOT_CONTAINS) {\n const rightValue = condition.rightValue as string;\n return !leftValue.includes(rightValue);\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as string[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as string[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionObjectHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionNumberHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as number;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as number;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as number;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.GT) {\n const rightValue = condition.rightValue as number;\n return leftValue > rightValue;\n }\n if (operator === ConditionOperator.GTE) {\n const rightValue = condition.rightValue as number;\n return leftValue >= rightValue;\n }\n if (operator === ConditionOperator.LT) {\n const rightValue = condition.rightValue as number;\n return leftValue < rightValue;\n }\n if (operator === ConditionOperator.LTE) {\n const rightValue = condition.rightValue as number;\n return leftValue <= rightValue;\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as number[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as number[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionNullHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as unknown | null;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n return isNil(leftValue) && isNil(condition.rightValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionMapHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\n// Convert ISO string to Date object for comparison\nconst parseDateTime = (value: string | Date): Date => {\n if (value instanceof Date) {\n return value;\n }\n return new Date(value);\n};\n\nexport const conditionDateTimeHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as string;\n\n // Handle empty checks first\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n\n // For comparison operations, parse both datetime values\n const leftTime = parseDateTime(leftValue).getTime();\n const rightValue = condition.rightValue as string;\n const rightTime = parseDateTime(rightValue).getTime();\n\n if (operator === ConditionOperator.EQ) {\n return leftTime === rightTime;\n }\n if (operator === ConditionOperator.NEQ) {\n return leftTime !== rightTime;\n }\n if (operator === ConditionOperator.GT) {\n return leftTime > rightTime;\n }\n if (operator === ConditionOperator.GTE) {\n return leftTime >= rightTime;\n }\n if (operator === ConditionOperator.LT) {\n return leftTime < rightTime;\n }\n if (operator === ConditionOperator.LTE) {\n return leftTime <= rightTime;\n }\n\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionBooleanHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as boolean;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as boolean;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as boolean;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.IS_TRUE) {\n return leftValue === true;\n }\n if (operator === ConditionOperator.IS_FALSE) {\n return leftValue === false;\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as boolean[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as boolean[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionArrayHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandlers } from '../type';\nimport { conditionStringHandler } from './string';\nimport { conditionObjectHandler } from './object';\nimport { conditionNumberHandler } from './number';\nimport { conditionNullHandler } from './null';\nimport { conditionMapHandler } from './map';\nimport { conditionDateTimeHandler } from './datetime';\nimport { conditionBooleanHandler } from './boolean';\nimport { conditionArrayHandler } from './array';\n\nexport const conditionHandlers: ConditionHandlers = {\n [WorkflowVariableType.String]: conditionStringHandler,\n [WorkflowVariableType.Number]: conditionNumberHandler,\n [WorkflowVariableType.Integer]: conditionNumberHandler,\n [WorkflowVariableType.Boolean]: conditionBooleanHandler,\n [WorkflowVariableType.Object]: conditionObjectHandler,\n [WorkflowVariableType.Map]: conditionMapHandler,\n [WorkflowVariableType.Array]: conditionArrayHandler,\n [WorkflowVariableType.DateTime]: conditionDateTimeHandler,\n [WorkflowVariableType.Null]: conditionNullHandler,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n CodeNodeSchema,\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface CodeExecutorInputs {\n params: Record<string, any>;\n script: {\n language: 'javascript';\n content: string;\n };\n}\n\nexport class CodeExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Code;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = this.parseInputs(context);\n if (inputs.script.language === 'javascript') {\n return this.javascript(inputs);\n }\n throw new Error(`Unsupported code language \"${inputs.script.language}\"`);\n }\n\n private parseInputs(context: ExecutionContext): CodeExecutorInputs {\n const codeNode = context.node as INode<CodeNodeSchema['data']>;\n const params = context.inputs;\n const { language, content } = codeNode.data.script;\n if (!content) {\n throw new Error('Code content is required');\n }\n return {\n params,\n script: {\n language,\n content,\n },\n };\n }\n\n private async javascript(inputs: CodeExecutorInputs): Promise<ExecutionResult> {\n // Extract script content and inputs\n const { params = {}, script } = inputs;\n\n try {\n // Create a safe execution environment with basic restrictions\n const executeCode = new Function(\n 'params',\n `\n 'use strict';\n\n ${script.content}\n\n // Ensure main function exists\n if (typeof main !== 'function') {\n throw new Error('main function is required in the script');\n }\n\n // Execute main function with params\n return main({ params });\n `\n );\n\n // Execute with timeout protection (1 minute)\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => {\n reject(new Error('Code execution timeout: exceeded 1 minute'));\n }, 1000 * 60);\n });\n\n // Execute the code with input parameters and timeout\n const result = await Promise.race([executeCode(params), timeoutPromise]);\n\n // Ensure result is an object\n const outputs =\n result && typeof result === 'object' && !Array.isArray(result) ? result : { result };\n\n return {\n outputs,\n };\n } catch (error: any) {\n throw new Error(`Code execution failed: ${error.message}`);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class BreakExecutor implements INodeExecutor {\n public type = FlowGramNode.Break;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.cache.set('loop-break', true);\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INodeExecutorFactory } from '@flowgram.ai/runtime-interface';\n\nimport { StartExecutor } from './start';\nimport { LoopExecutor } from './loop';\nimport { LLMExecutor } from './llm';\nimport { HTTPExecutor } from './http';\nimport { EndExecutor } from './end';\nimport { BlockEndExecutor, BlockStartExecutor } from './empty';\nimport { ContinueExecutor } from './continue';\nimport { ConditionExecutor } from './condition';\nimport { CodeExecutor } from './code';\nimport { BreakExecutor } from './break';\n\nexport const WorkflowRuntimeNodeExecutors: INodeExecutorFactory[] = [\n StartExecutor,\n EndExecutor,\n LLMExecutor,\n ConditionExecutor,\n LoopExecutor,\n BlockStartExecutor,\n BlockEndExecutor,\n HTTPExecutor,\n CodeExecutor,\n BreakExecutor,\n ContinueExecutor,\n];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\nexport const cycleDetection = (schema: WorkflowSchema) => {\n const { nodes, edges } = schema;\n\n // Build adjacency list for the graph\n const adjacencyList = new Map<string, string[]>();\n const nodeIds = new Set(nodes.map((node) => node.id));\n\n // Initialize adjacency list\n nodeIds.forEach((nodeId) => {\n adjacencyList.set(nodeId, []);\n });\n\n // Populate adjacency list with edges\n edges.forEach((edge) => {\n const sourceList = adjacencyList.get(edge.sourceNodeID);\n if (sourceList) {\n sourceList.push(edge.targetNodeID);\n }\n });\n\n enum NodeStatus {\n Unvisited,\n Visiting,\n Visited,\n }\n\n const nodeStatusMap = new Map<string, NodeStatus>();\n\n // Initialize all nodes as WHITE\n nodeIds.forEach((nodeId) => {\n nodeStatusMap.set(nodeId, NodeStatus.Unvisited);\n });\n\n const detectCycleFromNode = (nodeId: string): boolean => {\n nodeStatusMap.set(nodeId, NodeStatus.Visiting);\n\n const neighbors = adjacencyList.get(nodeId) || [];\n for (const neighbor of neighbors) {\n const neighborColor = nodeStatusMap.get(neighbor);\n\n if (neighborColor === NodeStatus.Visiting) {\n // Back edge found - cycle detected\n return true;\n }\n\n if (neighborColor === NodeStatus.Unvisited && detectCycleFromNode(neighbor)) {\n return true;\n }\n }\n\n nodeStatusMap.set(nodeId, NodeStatus.Visited);\n return false;\n };\n\n // Check for cycles starting from each unvisited node\n for (const nodeId of nodeIds) {\n if (nodeStatusMap.get(nodeId) === NodeStatus.Unvisited) {\n if (detectCycleFromNode(nodeId)) {\n throw new Error('Workflow schema contains a cycle, which is not allowed');\n }\n }\n }\n\n // Recursively check cycles in nested blocks\n nodes.forEach((node) => {\n if (node.blocks) {\n cycleDetection({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema, FlowGramNode } from '@flowgram.ai/runtime-interface';\n\nconst blockStartEndNode = (schema: WorkflowSchema) => {\n // Optimize performance by using single traversal instead of two separate filter operations\n const { blockStartNodes, blockEndNodes } = schema.nodes.reduce(\n (acc, node) => {\n if (node.type === FlowGramNode.BlockStart) {\n acc.blockStartNodes.push(node);\n } else if (node.type === FlowGramNode.BlockEnd) {\n acc.blockEndNodes.push(node);\n }\n return acc;\n },\n { blockStartNodes: [] as typeof schema.nodes, blockEndNodes: [] as typeof schema.nodes }\n );\n if (!blockStartNodes.length && !blockEndNodes.length) {\n throw new Error('Workflow block schema must have a block-start node and a block-end node');\n }\n if (!blockStartNodes.length) {\n throw new Error('Workflow block schema must have a block-start node');\n }\n if (!blockEndNodes.length) {\n throw new Error('Workflow block schema must have an block-end node');\n }\n if (blockStartNodes.length > 1) {\n throw new Error('Workflow block schema must have only one block-start node');\n }\n if (blockEndNodes.length > 1) {\n throw new Error('Workflow block schema must have only one block-end node');\n }\n schema.nodes.forEach((node) => {\n if (node.blocks) {\n blockStartEndNode({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n\nexport const startEndNode = (schema: WorkflowSchema) => {\n // Optimize performance by using single traversal instead of two separate filter operations\n const { startNodes, endNodes } = schema.nodes.reduce(\n (acc, node) => {\n if (node.type === FlowGramNode.Start) {\n acc.startNodes.push(node);\n } else if (node.type === FlowGramNode.End) {\n acc.endNodes.push(node);\n }\n return acc;\n },\n { startNodes: [] as typeof schema.nodes, endNodes: [] as typeof schema.nodes }\n );\n if (!startNodes.length && !endNodes.length) {\n throw new Error('Workflow schema must have a start node and an end node');\n }\n if (!startNodes.length) {\n throw new Error('Workflow schema must have a start node');\n }\n if (!endNodes.length) {\n throw new Error('Workflow schema must have an end node');\n }\n if (startNodes.length > 1) {\n throw new Error('Workflow schema must have only one start node');\n }\n if (endNodes.length > 1) {\n throw new Error('Workflow schema must have only one end node');\n }\n schema.nodes.forEach((node) => {\n if (node.blocks) {\n blockStartEndNode({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\nexport const edgeSourceTargetExist = (schema: WorkflowSchema) => {\n const { nodes, edges } = schema;\n const nodeSet = new Set(nodes.map((node) => node.id));\n edges.forEach((edge) => {\n if (!nodeSet.has(edge.sourceNodeID)) {\n throw new Error(`Workflow schema edge source node \"${edge.sourceNodeID}\" not exist`);\n }\n if (!nodeSet.has(edge.targetNodeID)) {\n throw new Error(`Workflow schema edge target node \"${edge.targetNodeID}\" not exist`);\n }\n });\n nodes.forEach((node) => {\n if (node.blocks) {\n edgeSourceTargetExist({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\n/**\n * Validates the basic format and structure of a workflow schema\n * Ensures all required fields are present and have correct types\n */\nexport const schemaFormat = (schema: WorkflowSchema): void => {\n // Check if schema is a valid object\n if (!schema || typeof schema !== 'object') {\n throw new Error('Workflow schema must be a valid object');\n }\n\n // Check if nodes array exists and is valid\n if (!Array.isArray(schema.nodes)) {\n throw new Error('Workflow schema must have a valid nodes array');\n }\n\n // Check if edges array exists and is valid\n if (!Array.isArray(schema.edges)) {\n throw new Error('Workflow schema must have a valid edges array');\n }\n\n // Validate each node structure\n schema.nodes.forEach((node, index) => {\n validateNodeFormat(node, `nodes[${index}]`);\n });\n\n // Validate each edge structure\n schema.edges.forEach((edge, index) => {\n validateEdgeFormat(edge, `edges[${index}]`);\n });\n\n // Recursively validate nested blocks\n schema.nodes.forEach((node, nodeIndex) => {\n if (node.blocks) {\n if (!Array.isArray(node.blocks)) {\n throw new Error(`Node nodes[${nodeIndex}].blocks must be an array`);\n }\n\n const nestedSchema = {\n nodes: node.blocks,\n edges: node.edges || [],\n };\n\n schemaFormat(nestedSchema);\n }\n });\n};\n\n/**\n * Validates the format of a single node\n */\nconst validateNodeFormat = (node: any, path: string): void => {\n if (!node || typeof node !== 'object') {\n throw new Error(`${path} must be a valid object`);\n }\n\n // Check required fields\n if (typeof node.id !== 'string' || !node.id.trim()) {\n throw new Error(`${path}.id must be a non-empty string`);\n }\n\n if (typeof node.type !== 'string' || !node.type.trim()) {\n throw new Error(`${path}.type must be a non-empty string`);\n }\n\n if (!node.meta || typeof node.meta !== 'object') {\n throw new Error(`${path}.meta must be a valid object`);\n }\n\n if (!node.data || typeof node.data !== 'object') {\n throw new Error(`${path}.data must be a valid object`);\n }\n\n // Validate optional fields if present\n if (node.blocks !== undefined && !Array.isArray(node.blocks)) {\n throw new Error(`${path}.blocks must be an array if present`);\n }\n\n if (node.edges !== undefined && !Array.isArray(node.edges)) {\n throw new Error(`${path}.edges must be an array if present`);\n }\n\n // Validate data.inputs and data.outputs if present\n if (\n node.data.inputs !== undefined &&\n (typeof node.data.inputs !== 'object' || node.data.inputs === null)\n ) {\n throw new Error(`${path}.data.inputs must be a valid object if present`);\n }\n\n if (\n node.data.outputs !== undefined &&\n (typeof node.data.outputs !== 'object' || node.data.outputs === null)\n ) {\n throw new Error(`${path}.data.outputs must be a valid object if present`);\n }\n\n if (\n node.data.inputsValues !== undefined &&\n (typeof node.data.inputsValues !== 'object' || node.data.inputsValues === null)\n ) {\n throw new Error(`${path}.data.inputsValues must be a valid object if present`);\n }\n\n if (node.data.title !== undefined && typeof node.data.title !== 'string') {\n throw new Error(`${path}.data.title must be a string if present`);\n }\n};\n\n/**\n * Validates the format of a single edge\n */\nconst validateEdgeFormat = (edge: any, path: string): void => {\n if (!edge || typeof edge !== 'object') {\n throw new Error(`${path} must be a valid object`);\n }\n\n // Check required fields\n if (typeof edge.sourceNodeID !== 'string' || !edge.sourceNodeID.trim()) {\n throw new Error(`${path}.sourceNodeID must be a non-empty string`);\n }\n\n if (typeof edge.targetNodeID !== 'string' || !edge.targetNodeID.trim()) {\n throw new Error(`${path}.targetNodeID must be a non-empty string`);\n }\n\n // Validate optional fields if present\n if (edge.sourcePortID !== undefined && typeof edge.sourcePortID !== 'string') {\n throw new Error(`${path}.sourcePortID must be a string if present`);\n }\n\n if (edge.targetPortID !== undefined && typeof edge.targetPortID !== 'string') {\n throw new Error(`${path}.targetPortID must be a string if present`);\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowSchema,\n IValidation,\n ValidationResult,\n InvokeParams,\n IJsonSchema,\n FlowGramNode,\n} from '@flowgram.ai/runtime-interface';\n\nimport { JSONSchemaValidator } from '@infra/index';\nimport { cycleDetection, edgeSourceTargetExist, startEndNode, schemaFormat } from './validators';\n\nexport class WorkflowRuntimeValidation implements IValidation {\n public invoke(params: InvokeParams): ValidationResult {\n const { schema, inputs } = params;\n const schemaValidationResult = this.schema(schema);\n if (!schemaValidationResult.valid) {\n return schemaValidationResult;\n }\n const inputsValidationResult = this.inputs(this.getWorkflowInputsDeclare(schema), inputs);\n if (!inputsValidationResult.valid) {\n return inputsValidationResult;\n }\n return {\n valid: true,\n };\n }\n\n private schema(schema: WorkflowSchema): ValidationResult {\n const errors: string[] = [];\n\n // Run all validations concurrently and collect errors\n const validations = [\n () => schemaFormat(schema),\n () => cycleDetection(schema),\n () => edgeSourceTargetExist(schema),\n () => startEndNode(schema),\n ];\n\n // Execute all validations and collect any errors\n validations.forEach((validation) => {\n try {\n validation();\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n });\n\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n };\n }\n\n private inputs(inputsSchema: IJsonSchema, inputs: Record<string, unknown>): ValidationResult {\n const { result, errorMessage } = JSONSchemaValidator({\n schema: inputsSchema,\n value: inputs,\n });\n if (!result) {\n const error = `JSON Schema validation failed: ${errorMessage}`;\n return {\n valid: false,\n errors: [error],\n };\n }\n return {\n valid: true,\n };\n }\n\n private getWorkflowInputsDeclare(schema: WorkflowSchema): IJsonSchema {\n const startNode = schema.nodes.find((node) => node.type === FlowGramNode.Start)!;\n if (!startNode) {\n throw new Error('Workflow schema must have a start node');\n }\n return startNode.data.outputs;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramNode } from '@flowgram.ai/runtime-interface';\nimport {\n ExecutionContext,\n ExecutionResult,\n IExecutor,\n INodeExecutor,\n INodeExecutorFactory,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeExecutor implements IExecutor {\n private nodeExecutors: Map<FlowGramNode, INodeExecutor> = new Map();\n\n constructor(nodeExecutors: INodeExecutorFactory[]) {\n // register node executors\n nodeExecutors.forEach((executor) => {\n this.register(new executor());\n });\n }\n\n public register(executor: INodeExecutor): void {\n this.nodeExecutors.set(executor.type, executor);\n }\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const nodeType = context.node.type;\n const nodeExecutor = this.nodeExecutors.get(nodeType);\n if (!nodeExecutor) {\n throw new Error(`No executor found for node type ${nodeType}`);\n }\n const output = await nodeExecutor.execute(context);\n return output;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n IContext,\n ITask,\n TaskParams,\n WorkflowOutputs,\n WorkflowStatus,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeTask implements ITask {\n public readonly id: string;\n\n public readonly processing: Promise<WorkflowOutputs>;\n\n public readonly context: IContext;\n\n constructor(params: TaskParams) {\n this.id = uuid();\n this.context = params.context;\n this.processing = params.processing;\n }\n\n public cancel(): void {\n this.context.statusCenter.workflow.cancel();\n const cancelNodeIDs = this.context.statusCenter.getStatusNodeIDs(WorkflowStatus.Processing);\n cancelNodeIDs.forEach((nodeID) => {\n this.context.statusCenter.nodeStatus(nodeID).cancel();\n });\n }\n\n public static create(params: TaskParams): WorkflowRuntimeTask {\n return new WorkflowRuntimeTask(params);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IMessage, MessageData, WorkflowMessageType } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeMessage {\n export const create = (\n params: MessageData & {\n type: WorkflowMessageType;\n }\n ): IMessage => {\n const message = {\n id: uuid(),\n ...params,\n };\n if (!params.timestamp) {\n message.timestamp = Date.now();\n }\n return message as IMessage;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n IMessage,\n IMessageCenter,\n MessageData,\n WorkflowMessages,\n WorkflowMessageType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeMessage } from '../message-value-object';\n\nexport class WorkflowRuntimeMessageCenter implements IMessageCenter {\n private messages: WorkflowMessages;\n\n public init(): void {\n this.messages = {\n [WorkflowMessageType.Log]: [],\n [WorkflowMessageType.Info]: [],\n [WorkflowMessageType.Debug]: [],\n [WorkflowMessageType.Error]: [],\n [WorkflowMessageType.Warn]: [],\n };\n }\n\n public dispose(): void {}\n\n public log(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Log,\n ...data,\n });\n this.messages[WorkflowMessageType.Log].push(message);\n return message;\n }\n\n public info(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Info,\n ...data,\n });\n this.messages[WorkflowMessageType.Info].push(message);\n return message;\n }\n\n public debug(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Debug,\n ...data,\n });\n this.messages[WorkflowMessageType.Debug].push(message);\n return message;\n }\n\n public error(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Error,\n ...data,\n });\n this.messages[WorkflowMessageType.Error].push(message);\n return message;\n }\n\n public warn(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Warn,\n ...data,\n });\n this.messages[WorkflowMessageType.Warn].push(message);\n return message;\n }\n\n public export(): WorkflowMessages {\n return {\n [WorkflowMessageType.Log]: this.messages[WorkflowMessageType.Log].slice(),\n [WorkflowMessageType.Info]: this.messages[WorkflowMessageType.Info].slice(),\n [WorkflowMessageType.Debug]: this.messages[WorkflowMessageType.Debug].slice(),\n [WorkflowMessageType.Error]: this.messages[WorkflowMessageType.Error].slice(),\n [WorkflowMessageType.Warn]: this.messages[WorkflowMessageType.Warn].slice(),\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ICache } from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeCache implements ICache {\n private map: Map<string, any>;\n\n public init(): void {\n this.map = new Map();\n }\n\n public dispose(): void {\n this.map.clear();\n }\n\n public get(key: string): any {\n return this.map.get(key);\n }\n\n public set(key: string, value: any): this {\n this.map.set(key, value);\n return this;\n }\n\n public delete(key: string): boolean {\n return this.map.delete(key);\n }\n\n public has(key: string): boolean {\n return this.map.has(key);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { get, set } from 'lodash-es';\nimport {\n WorkflowVariableType,\n IVariableStore,\n IVariable,\n IVariableParseResult,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid, WorkflowRuntimeType } from '@infra/utils';\nimport { WorkflowRuntimeVariable } from '../variable-value-object';\n\nexport class WorkflowRuntimeVariableStore implements IVariableStore {\n public readonly id: string;\n\n private parent?: WorkflowRuntimeVariableStore;\n\n constructor() {\n this.id = uuid();\n }\n\n public store: Map<string, Map<string, IVariable>>;\n\n public init(): void {\n this.store = new Map();\n }\n\n public dispose(): void {\n this.store.clear();\n }\n\n public setParent(parent: IVariableStore): void {\n this.parent = parent as WorkflowRuntimeVariableStore;\n }\n\n public globalGet(nodeID: string): Map<string, IVariable> | undefined {\n const store = this.store.get(nodeID);\n if (!store && this.parent) {\n return this.parent.globalGet(nodeID);\n }\n return store;\n }\n\n public setVariable(params: {\n nodeID: string;\n key: string;\n value: Object;\n type: WorkflowVariableType;\n itemsType?: WorkflowVariableType;\n }): void {\n const { nodeID, key, value, type, itemsType } = params;\n if (!this.store.has(nodeID)) {\n // create node store\n this.store.set(nodeID, new Map());\n }\n const nodeStore = this.store.get(nodeID)!;\n // create variable store\n const variable = WorkflowRuntimeVariable.create({\n nodeID,\n key,\n value,\n type, // TODO check type\n itemsType, // TODO check is array\n });\n nodeStore.set(key, variable);\n }\n\n public setValue(params: {\n nodeID: string;\n variableKey: string;\n variablePath?: string[];\n value: Object;\n }): void {\n const { nodeID, variableKey, variablePath, value } = params;\n if (!this.store.has(nodeID)) {\n // create node store\n this.store.set(nodeID, new Map());\n }\n const nodeStore = this.store.get(nodeID)!;\n if (!nodeStore.has(variableKey)) {\n // create variable store\n const variable = WorkflowRuntimeVariable.create({\n nodeID,\n key: variableKey,\n value: {},\n type: WorkflowVariableType.Object,\n });\n nodeStore.set(variableKey, variable);\n }\n const variable = nodeStore.get(variableKey)!;\n if (!variablePath) {\n variable.value = value;\n return;\n }\n set(variable.value, variablePath, value);\n }\n\n public getValue<T = unknown>(params: {\n nodeID: string;\n variableKey: string;\n variablePath?: string[];\n }): IVariableParseResult<T> | null {\n const { nodeID, variableKey, variablePath } = params;\n const variable = this.globalGet(nodeID)?.get(variableKey);\n if (!variable) {\n return null;\n }\n if (!variablePath || variablePath.length === 0) {\n return {\n value: variable.value as T,\n type: variable.type,\n itemsType: variable.itemsType,\n };\n }\n const value = get(variable.value, variablePath) as T;\n const type = WorkflowRuntimeType.getWorkflowType(value);\n if (!type) {\n return null;\n }\n if (type === WorkflowVariableType.Array && Array.isArray(value)) {\n const itemsType = WorkflowRuntimeType.getWorkflowType(value[0]);\n if (!itemsType) {\n return null;\n }\n return {\n value,\n type,\n itemsType,\n };\n }\n return {\n value,\n type,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IVariable, VOData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeVariable {\n export const create = (params: VOData<IVariable>): IVariable => ({\n id: uuid(),\n ...params,\n });\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IStatus, StatusData, WorkflowStatus } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeStatus implements IStatus {\n public readonly id: string;\n\n private _status: WorkflowStatus;\n\n private _startTime: number;\n\n private _endTime?: number;\n\n constructor() {\n this.id = uuid();\n this._status = WorkflowStatus.Pending;\n }\n\n public get status(): WorkflowStatus {\n return this._status;\n }\n\n public get terminated(): boolean {\n return [WorkflowStatus.Succeeded, WorkflowStatus.Failed, WorkflowStatus.Canceled].includes(\n this.status\n );\n }\n\n public get startTime(): number {\n return this._startTime;\n }\n\n public get endTime(): number | undefined {\n return this._endTime;\n }\n\n public get timeCost(): number {\n if (!this.startTime) {\n return 0;\n }\n if (this.endTime) {\n return this.endTime - this.startTime;\n }\n return Date.now() - this.startTime;\n }\n\n public process(): void {\n this._status = WorkflowStatus.Processing;\n this._startTime = Date.now();\n this._endTime = undefined;\n }\n\n public success(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Succeeded;\n this._endTime = Date.now();\n }\n\n public fail(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Failed;\n this._endTime = Date.now();\n }\n\n public cancel(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Canceled;\n this._endTime = Date.now();\n }\n\n public export(): StatusData {\n return {\n status: this.status,\n terminated: this.terminated,\n startTime: this.startTime,\n endTime: this.endTime,\n timeCost: this.timeCost,\n };\n }\n\n public static create(): WorkflowRuntimeStatus {\n const status = new WorkflowRuntimeStatus();\n return status;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IStatus, IStatusCenter, StatusData, WorkflowStatus } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeStatus } from '../status-entity';\n\nexport class WorkflowRuntimeStatusCenter implements IStatusCenter {\n private _workflowStatus: IStatus;\n\n private _nodeStatus: Map<string, IStatus>;\n\n public startTime: number;\n\n public endTime?: number;\n\n public init(): void {\n this._workflowStatus = WorkflowRuntimeStatus.create();\n this._nodeStatus = new Map();\n }\n\n public dispose(): void {\n // because the data is not persisted, do not clear the execution result\n }\n\n public get workflow(): IStatus {\n return this._workflowStatus;\n }\n\n public get workflowStatus(): IStatus {\n return this._workflowStatus;\n }\n\n public nodeStatus(nodeID: string): IStatus {\n if (!this._nodeStatus.has(nodeID)) {\n this._nodeStatus.set(nodeID, WorkflowRuntimeStatus.create());\n }\n const status = this._nodeStatus.get(nodeID)!;\n return status;\n }\n\n public getStatusNodeIDs(status: WorkflowStatus): string[] {\n return Array.from(this._nodeStatus.entries())\n .filter(([, nodeStatus]) => nodeStatus.status === status)\n .map(([nodeID]) => nodeID);\n }\n\n public exportNodeStatus(): Record<string, StatusData> {\n return Object.fromEntries(\n Array.from(this._nodeStatus.entries()).map(([nodeID, status]) => [nodeID, status.export()])\n );\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n IState,\n IFlowValue,\n IFlowRefValue,\n IVariableParseResult,\n INode,\n WorkflowInputs,\n WorkflowOutputs,\n IVariableStore,\n WorkflowVariableType,\n IFlowTemplateValue,\n IJsonSchema,\n WorkflowSchema,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid, WorkflowRuntimeType } from '@infra/utils';\n\nexport class WorkflowRuntimeState implements IState {\n public readonly id: string;\n\n private executedNodes: Set<string>;\n\n constructor(public readonly variableStore: IVariableStore) {\n this.id = uuid();\n }\n\n public init(schema?: WorkflowSchema): void {\n this.setGlobalVariable(schema?.globalVariable);\n this.executedNodes = new Set();\n }\n\n public dispose(): void {\n this.executedNodes.clear();\n }\n\n public getNodeInputs(node: INode): WorkflowInputs {\n const inputsDeclare = node.declare.inputs;\n const inputsValues = node.declare.inputsValues;\n return this.parseInputs({\n values: inputsValues,\n declare: inputsDeclare,\n });\n }\n\n public setNodeOutputs(params: { node: INode; outputs: WorkflowOutputs }): void {\n const { node, outputs } = params;\n const outputsDeclare = node.declare.outputs as IJsonSchema<'object'>;\n if (outputsDeclare?.type !== 'object' || !outputsDeclare.properties) {\n return;\n }\n Object.entries(outputsDeclare.properties).forEach(([key, typeInfo]) => {\n if (!key || !typeInfo) {\n return;\n }\n const type = typeInfo.type as WorkflowVariableType;\n const itemsType = typeInfo.items?.type as WorkflowVariableType;\n const defaultValue = this.parseJSONContent(typeInfo.default, type);\n const value = outputs[key] ?? defaultValue;\n // create variable\n this.variableStore.setVariable({\n nodeID: node.id,\n key,\n value,\n type,\n itemsType,\n });\n });\n }\n\n public parseInputs(params: {\n values?: Record<string, IFlowValue>;\n declare?: IJsonSchema;\n }): WorkflowInputs {\n const { values, declare } = params;\n if (!declare || !values) {\n return {};\n }\n return Object.entries(values).reduce((prev, [key, flowValue]) => {\n const typeInfo = declare.properties?.[key];\n if (!typeInfo) {\n return prev;\n }\n const declareType = typeInfo.type as WorkflowVariableType;\n // get value\n const result = this.parseFlowValue({ flowValue, declareType });\n if (!result) {\n return prev;\n }\n const { value, type } = result;\n if (!WorkflowRuntimeType.isTypeEqual(type, declareType)) {\n return prev;\n }\n prev[key] = value;\n return prev;\n }, {} as WorkflowInputs);\n }\n\n public parseRef<T = unknown>(ref: IFlowRefValue): IVariableParseResult<T> | null {\n if (ref?.type !== 'ref') {\n throw new Error(`Invalid ref value: ${ref}`);\n }\n if (!ref.content || ref.content.length < 2) {\n return null;\n }\n const [nodeID, variableKey, ...variablePath] = ref.content;\n const result = this.variableStore.getValue<T>({\n nodeID,\n variableKey,\n variablePath,\n });\n if (!result) {\n return null;\n }\n return result;\n }\n\n public parseTemplate(template: IFlowTemplateValue): IVariableParseResult<string> | null {\n if (template?.type !== 'template') {\n throw new Error(`Invalid template value: ${template}`);\n }\n if (!template.content) {\n return null;\n }\n const parsedValue = template.content.replace(\n /\\{\\{([^\\}]+)\\}\\}/g,\n (match: string, pattern: string): string => {\n // 将路径分割成数组,如 'start_0.work.role' => ['start_0', 'work', 'role']\n const ref = pattern.trim().split('.');\n\n const variable = this.parseRef<string>({\n type: 'ref',\n content: ref,\n });\n\n if (!variable) {\n return '';\n }\n\n return variable.value;\n }\n );\n return {\n type: WorkflowVariableType.String,\n value: parsedValue,\n };\n }\n\n public parseFlowValue<T = unknown>(params: {\n flowValue: IFlowValue;\n declareType: WorkflowVariableType;\n }): IVariableParseResult<T> | null {\n const { flowValue, declareType } = params;\n if (!flowValue?.type) {\n throw new Error(`Invalid flow value type: ${(flowValue as any).type}`);\n }\n // constant\n if (flowValue.type === 'constant') {\n const value = this.parseJSONContent<T>(flowValue.content, declareType);\n const type = declareType ?? WorkflowRuntimeType.getWorkflowType(value);\n if (isNil(value) || !type) {\n return null;\n }\n return {\n value,\n type,\n };\n }\n // ref\n if (flowValue.type === 'ref') {\n return this.parseRef<T>(flowValue);\n }\n // template\n if (flowValue.type === 'template') {\n return this.parseTemplate(flowValue) as IVariableParseResult<T> | null;\n }\n // unknown type\n throw new Error(`Unknown flow value type: ${(flowValue as any).type}`);\n }\n\n public isExecutedNode(node: INode): boolean {\n return this.executedNodes.has(node.id);\n }\n\n public addExecutedNode(node: INode): void {\n this.executedNodes.add(node.id);\n }\n\n private parseJSONContent<T = unknown>(\n jsonContent: string | unknown,\n declareType: WorkflowVariableType\n ): T {\n const JSONTypes = [\n WorkflowVariableType.Object,\n WorkflowVariableType.Array,\n WorkflowVariableType.Map,\n ];\n if (declareType && JSONTypes.includes(declareType) && typeof jsonContent === 'string') {\n try {\n return JSON.parse(jsonContent) as T;\n } catch (e) {\n return jsonContent as T;\n }\n }\n return jsonContent as T;\n }\n\n private setGlobalVariable(globalVariableDeclare: IJsonSchema | undefined): void {\n if (globalVariableDeclare?.type !== 'object' || !globalVariableDeclare.properties) {\n return;\n }\n Object.entries(globalVariableDeclare.properties).forEach(([key, typeInfo]) => {\n if (!key || !typeInfo) {\n return;\n }\n const type = typeInfo.type as WorkflowVariableType;\n const itemsType = typeInfo.items?.type as WorkflowVariableType;\n const defaultValue = this.parseJSONContent(typeInfo.default, type);\n // create variable\n this.variableStore.setVariable({\n nodeID: 'global',\n key,\n value: defaultValue,\n type,\n itemsType,\n });\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ISnapshot, Snapshot, SnapshotData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeSnapshot implements ISnapshot {\n public readonly id: string;\n\n public readonly data: Partial<SnapshotData>;\n\n public constructor(data: Partial<SnapshotData>) {\n this.id = uuid();\n this.data = data;\n }\n\n public update(data: Partial<SnapshotData>): void {\n Object.assign(this.data, data);\n }\n\n public validate(): boolean {\n const required = ['nodeID', 'inputs', 'outputs', 'data'] as (keyof SnapshotData)[];\n return required.every((key) => this.data[key] !== undefined);\n }\n\n public export(): Snapshot {\n const snapshot: Snapshot = {\n id: this.id,\n ...this.data,\n } as Snapshot;\n return snapshot;\n }\n\n public static create(params: Partial<SnapshotData>): ISnapshot {\n return new WorkflowRuntimeSnapshot(params);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Snapshot, ISnapshotCenter, SnapshotData, ISnapshot } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\nimport { WorkflowRuntimeSnapshot } from '../snapshot-entity';\n\nexport class WorkflowRuntimeSnapshotCenter implements ISnapshotCenter {\n public readonly id: string;\n\n private snapshots: ISnapshot[];\n\n constructor() {\n this.id = uuid();\n }\n\n public create(snapshotData: Partial<SnapshotData>): ISnapshot {\n const snapshot = WorkflowRuntimeSnapshot.create(snapshotData);\n this.snapshots.push(snapshot);\n return snapshot;\n }\n\n public init(): void {\n this.snapshots = [];\n }\n\n public dispose(): void {\n // because the data is not persisted, do not clear the execution result\n }\n\n public exportAll(): Snapshot[] {\n return this.snapshots.slice().map((snapshot) => snapshot.export());\n }\n\n public export(): Record<string, Snapshot[]> {\n const result: Record<string, Snapshot[]> = {};\n this.exportAll().forEach((snapshot) => {\n if (result[snapshot.nodeID]) {\n result[snapshot.nodeID].push(snapshot);\n } else {\n result[snapshot.nodeID] = [snapshot];\n }\n });\n return result;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IReport, VOData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeReport {\n export const create = (params: VOData<IReport>): IReport => ({\n id: uuid(),\n ...params,\n });\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ISnapshotCenter,\n IReporter,\n IStatusCenter,\n IIOCenter,\n IReport,\n NodeReport,\n WorkflowReports,\n IMessageCenter,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeReport } from '../report-value-object';\n\nexport class WorkflowRuntimeReporter implements IReporter {\n constructor(\n public readonly ioCenter: IIOCenter,\n public readonly snapshotCenter: ISnapshotCenter,\n public readonly statusCenter: IStatusCenter,\n public readonly messageCenter: IMessageCenter\n ) {}\n\n public init(): void {}\n\n public dispose(): void {}\n\n public export(): IReport {\n const report = WorkflowRuntimeReport.create({\n inputs: this.ioCenter.inputs,\n outputs: this.ioCenter.outputs,\n workflowStatus: this.statusCenter.workflow.export(),\n reports: this.nodeReports(),\n messages: this.messageCenter.export(),\n });\n return report;\n }\n\n private nodeReports(): WorkflowReports {\n const reports: WorkflowReports = {};\n const statuses = this.statusCenter.exportNodeStatus();\n const snapshots = this.snapshotCenter.export();\n Object.keys(statuses).forEach((nodeID) => {\n const status = statuses[nodeID];\n const nodeSnapshots = snapshots[nodeID] || [];\n const nodeReport: NodeReport = {\n id: nodeID,\n ...status,\n snapshots: nodeSnapshots,\n };\n reports[nodeID] = nodeReport;\n });\n return reports;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IIOCenter, IOData, WorkflowInputs, WorkflowOutputs } from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeIOCenter implements IIOCenter {\n private _inputs: WorkflowInputs;\n\n private _outputs: WorkflowOutputs;\n\n public init(inputs: WorkflowInputs): void {\n this.setInputs(inputs);\n }\n\n public dispose(): void {}\n\n public get inputs(): WorkflowInputs {\n return this._inputs ?? {};\n }\n\n public get outputs(): WorkflowOutputs {\n return this._outputs ?? {};\n }\n\n public setInputs(inputs: WorkflowInputs): void {\n this._inputs = inputs;\n }\n\n public setOutputs(outputs: WorkflowOutputs): void {\n this._outputs = outputs;\n }\n\n public export(): IOData {\n return {\n inputs: this._inputs,\n outputs: this._outputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowEdgeSchema,\n CreateEdgeParams,\n IEdge,\n INode,\n IPort,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeEdge implements IEdge {\n public readonly id: string;\n\n public readonly from: INode;\n\n public readonly to: INode;\n\n private _fromPort: IPort;\n\n private _toPort: IPort;\n\n constructor(params: CreateEdgeParams) {\n const { id, from, to } = params;\n this.id = id;\n this.from = from;\n this.to = to;\n }\n\n public get fromPort() {\n return this._fromPort;\n }\n\n public set fromPort(port: IPort) {\n this._fromPort = port;\n }\n\n public get toPort() {\n return this._toPort;\n }\n\n public set toPort(port: IPort) {\n this._toPort = port;\n }\n\n public static createID(schema: WorkflowEdgeSchema): string {\n const { sourceNodeID, sourcePortID, targetNodeID, targetPortID } = schema;\n const sourcePart = sourcePortID ? `${sourceNodeID}:${sourcePortID}` : sourceNodeID;\n const targetPart = targetPortID ? `${targetNodeID}:${targetPortID}` : targetNodeID;\n return `${sourcePart}-${targetPart}`;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n FlowGramNode,\n PositionSchema,\n CreateNodeParams,\n IEdge,\n INode,\n IPort,\n NodeVariable,\n WorkflowPortType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { traverseNodes } from '@infra/index';\n\nexport class WorkflowRuntimeNode<T = any> implements INode {\n public readonly id: string;\n\n public readonly type: FlowGramNode;\n\n public readonly name: string;\n\n public readonly position: PositionSchema;\n\n public readonly declare: NodeVariable;\n\n public readonly data: T;\n\n private _parent: INode | null;\n\n private readonly _children: INode[];\n\n private readonly _ports: IPort[];\n\n private readonly _inputEdges: IEdge[];\n\n private readonly _outputEdges: IEdge[];\n\n private readonly _prev: INode[];\n\n private readonly _next: INode[];\n\n constructor(params: CreateNodeParams) {\n const { id, type, name, position, variable, data } = params;\n this.id = id;\n this.type = type;\n this.name = name;\n this.position = position;\n this.declare = variable ?? {};\n this.data = data ?? {};\n this._parent = null;\n this._children = [];\n this._ports = [];\n this._inputEdges = [];\n this._outputEdges = [];\n this._prev = [];\n this._next = [];\n }\n\n public get ports() {\n const inputs = this._ports.filter((port) => port.type === WorkflowPortType.Input);\n const outputs = this._ports.filter((port) => port.type === WorkflowPortType.Output);\n return {\n inputs,\n outputs,\n };\n }\n\n public get edges() {\n return {\n inputs: this._inputEdges,\n outputs: this._outputEdges,\n };\n }\n\n public get parent() {\n return this._parent;\n }\n\n public set parent(parent: INode | null) {\n this._parent = parent;\n }\n\n public get children() {\n return this._children;\n }\n\n public addChild(child: INode) {\n this._children.push(child);\n }\n\n public addPort(port: IPort) {\n this._ports.push(port);\n }\n\n public addInputEdge(edge: IEdge) {\n this._inputEdges.push(edge);\n this._prev.push(edge.from);\n }\n\n public addOutputEdge(edge: IEdge) {\n this._outputEdges.push(edge);\n this._next.push(edge.to);\n }\n\n public get prev() {\n return this._prev;\n }\n\n public get next() {\n return this._next;\n }\n\n public get successors(): INode[] {\n return traverseNodes(this, (node) => node.next);\n }\n\n public get predecessors(): INode[] {\n return traverseNodes(this, (node) => node.prev);\n }\n\n public get isBranch() {\n return this.ports.outputs.length > 1;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowPortType,\n CreatePortParams,\n IEdge,\n INode,\n IPort,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimePort implements IPort {\n public readonly id: string;\n\n public readonly node: INode;\n\n public readonly type: WorkflowPortType;\n\n private readonly _edges: IEdge[];\n\n constructor(params: CreatePortParams) {\n const { id, node } = params;\n this.id = id;\n this.node = node;\n this.type = params.type;\n this._edges = [];\n }\n\n public get edges() {\n return this._edges;\n }\n\n public addEdge(edge: IEdge) {\n this._edges.push(edge);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeSchema, WorkflowSchema, FlowGramNode } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeEdge } from '../entity';\n\nexport interface FlattenData {\n flattenSchema: WorkflowSchema;\n nodeBlocks: Map<string, string[]>;\n nodeEdges: Map<string, string[]>;\n}\n\ntype FlatSchema = (json: Partial<WorkflowSchema>) => FlattenData;\n\nconst flatLayer = (data: FlattenData, nodeSchema: WorkflowNodeSchema) => {\n const { blocks, edges } = nodeSchema;\n if (blocks) {\n data.flattenSchema.nodes.push(...blocks);\n const blockIDs: string[] = [];\n blocks.forEach((block) => {\n blockIDs.push(block.id);\n // 递归处理子节点的 blocks 和 edges\n if (block.blocks) {\n flatLayer(data, block);\n }\n });\n data.nodeBlocks.set(nodeSchema.id, blockIDs);\n delete nodeSchema.blocks;\n }\n if (edges) {\n data.flattenSchema.edges.push(...edges);\n const edgeIDs: string[] = [];\n edges.forEach((edge) => {\n const edgeID = WorkflowRuntimeEdge.createID(edge);\n edgeIDs.push(edgeID);\n });\n data.nodeEdges.set(nodeSchema.id, edgeIDs);\n delete nodeSchema.edges;\n }\n};\n\n/**\n * flat the tree json structure, extract the structure information to map\n */\nexport const flatSchema: FlatSchema = (schema = { nodes: [], edges: [] }) => {\n const rootNodes = schema.nodes ?? [];\n const rootEdges = schema.edges ?? [];\n\n const data: FlattenData = {\n flattenSchema: {\n nodes: [],\n edges: [],\n },\n nodeBlocks: new Map(),\n nodeEdges: new Map(),\n };\n\n const root: WorkflowNodeSchema = {\n id: FlowGramNode.Root,\n type: FlowGramNode.Root,\n blocks: rootNodes,\n edges: rootEdges,\n meta: {\n position: {\n x: 0,\n y: 0,\n },\n },\n data: {},\n };\n\n flatLayer(data, root);\n\n return data;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n FlowGramNode,\n WorkflowPortType,\n type CreateEdgeParams,\n type CreateNodeParams,\n type CreatePortParams,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeEdge, WorkflowRuntimeNode, WorkflowRuntimePort } from '../entity';\nimport { FlattenData } from './flat-schema';\n\nexport interface DocumentStore {\n nodes: Map<string, WorkflowRuntimeNode>;\n edges: Map<string, WorkflowRuntimeEdge>;\n ports: Map<string, WorkflowRuntimePort>;\n}\n\nconst createNode = (store: DocumentStore, params: CreateNodeParams): WorkflowRuntimeNode => {\n const node = new WorkflowRuntimeNode(params);\n store.nodes.set(node.id, node);\n return node;\n};\n\nconst createEdge = (store: DocumentStore, params: CreateEdgeParams): WorkflowRuntimeEdge => {\n const edge = new WorkflowRuntimeEdge(params);\n store.edges.set(edge.id, edge);\n return edge;\n};\n\nconst getOrCreatePort = (store: DocumentStore, params: CreatePortParams): WorkflowRuntimePort => {\n const createdPort = store.ports.get(params.id);\n if (createdPort) {\n return createdPort as WorkflowRuntimePort;\n }\n const port = new WorkflowRuntimePort(params);\n store.ports.set(port.id, port);\n return port;\n};\n\nexport const createStore = (params: FlattenData): DocumentStore => {\n const { flattenSchema, nodeBlocks } = params;\n const { nodes, edges } = flattenSchema;\n const store: DocumentStore = {\n nodes: new Map(),\n edges: new Map(),\n ports: new Map(),\n };\n // create root node\n createNode(store, {\n id: FlowGramNode.Root,\n type: FlowGramNode.Root,\n name: FlowGramNode.Root,\n position: { x: 0, y: 0 },\n });\n // create nodes\n nodes.forEach((nodeSchema) => {\n const id = nodeSchema.id;\n const type = nodeSchema.type as FlowGramNode;\n const {\n title = `${type}-${id}-untitled`,\n inputsValues,\n inputs,\n outputs,\n ...data\n } = nodeSchema.data ?? {};\n createNode(store, {\n id,\n type,\n name: title,\n position: nodeSchema.meta.position,\n variable: { inputsValues, inputs, outputs },\n data,\n });\n });\n // create node relations\n nodeBlocks.forEach((blockIDs, parentID) => {\n const parent = store.nodes.get(parentID) as WorkflowRuntimeNode;\n const children = blockIDs\n .map((id) => store.nodes.get(id))\n .filter(Boolean) as WorkflowRuntimeNode[];\n children.forEach((child) => {\n child.parent = parent;\n parent.addChild(child);\n });\n });\n // create edges & ports\n edges.forEach((edgeSchema) => {\n const id = WorkflowRuntimeEdge.createID(edgeSchema);\n const {\n sourceNodeID,\n targetNodeID,\n sourcePortID = 'defaultOutput',\n targetPortID = 'defaultInput',\n } = edgeSchema;\n const from = store.nodes.get(sourceNodeID);\n const to = store.nodes.get(targetNodeID);\n if (!from || !to) {\n throw new Error(`Invalid edge schema ID: ${id}, from: ${sourceNodeID}, to: ${targetNodeID}`);\n }\n const edge = createEdge(store, {\n id,\n from,\n to,\n });\n\n // create from port\n const fromPort = getOrCreatePort(store, {\n node: from,\n id: sourcePortID,\n type: WorkflowPortType.Output,\n });\n\n // build relation\n fromPort.addEdge(edge);\n edge.fromPort = fromPort;\n from.addPort(fromPort);\n from.addOutputEdge(edge);\n\n // create to port\n const toPort = getOrCreatePort(store, {\n node: to,\n id: targetPortID,\n type: WorkflowPortType.Input,\n });\n\n // build relation\n toPort.addEdge(edge);\n edge.toPort = toPort;\n to.addPort(toPort);\n to.addInputEdge(edge);\n });\n return store;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n type WorkflowSchema,\n FlowGramNode,\n type IDocument,\n type IEdge,\n type INode,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\nimport { flatSchema } from './flat-schema';\nimport { createStore, DocumentStore } from './create-store';\n\nexport class WorkflowRuntimeDocument implements IDocument {\n public readonly id: string;\n\n private store: DocumentStore;\n\n constructor() {\n this.id = uuid();\n }\n\n public get root(): INode {\n const rootNode = this.getNode(FlowGramNode.Root);\n if (!rootNode) {\n throw new Error('Root node not found');\n }\n return rootNode;\n }\n\n public get start(): INode {\n const startNode = this.nodes.find((n) => n.type === FlowGramNode.Start);\n if (!startNode) {\n throw new Error('Start node not found');\n }\n return startNode;\n }\n\n public get end(): INode {\n const endNode = this.nodes.find((n) => n.type === FlowGramNode.End);\n if (!endNode) {\n throw new Error('End node not found');\n }\n return endNode;\n }\n\n public getNode(id: string): INode | null {\n return this.store.nodes.get(id) ?? null;\n }\n\n public getEdge(id: string): IEdge | null {\n return this.store.edges.get(id) ?? null;\n }\n\n public get nodes(): INode[] {\n return Array.from(this.store.nodes.values());\n }\n\n public get edges(): IEdge[] {\n return Array.from(this.store.edges.values());\n }\n\n public init(schema: WorkflowSchema): void {\n const flattenSchema = flatSchema(schema);\n this.store = createStore(flattenSchema);\n }\n\n public dispose(): void {\n this.store.edges.clear();\n this.store.nodes.clear();\n this.store.ports.clear();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n InvokeParams,\n IContext,\n IDocument,\n IState,\n ISnapshotCenter,\n IVariableStore,\n IStatusCenter,\n IReporter,\n IIOCenter,\n ContextData,\n IMessageCenter,\n ICache,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeMessageCenter } from '@workflow/message';\nimport { WorkflowRuntimeCache } from '@workflow/cache';\nimport { uuid } from '@infra/utils';\nimport { WorkflowRuntimeVariableStore } from '../variable';\nimport { WorkflowRuntimeStatusCenter } from '../status';\nimport { WorkflowRuntimeState } from '../state';\nimport { WorkflowRuntimeSnapshotCenter } from '../snapshot';\nimport { WorkflowRuntimeReporter } from '../report';\nimport { WorkflowRuntimeIOCenter } from '../io-center';\nimport { WorkflowRuntimeDocument } from '../document';\n\nexport class WorkflowRuntimeContext implements IContext {\n public readonly id: string;\n\n public readonly cache: ICache;\n\n public readonly document: IDocument;\n\n public readonly variableStore: IVariableStore;\n\n public readonly state: IState;\n\n public readonly ioCenter: IIOCenter;\n\n public readonly snapshotCenter: ISnapshotCenter;\n\n public readonly statusCenter: IStatusCenter;\n\n public readonly messageCenter: IMessageCenter;\n\n public readonly reporter: IReporter;\n\n private subContexts: IContext[] = [];\n\n constructor(data: ContextData) {\n this.id = uuid();\n this.cache = data.cache;\n this.document = data.document;\n this.variableStore = data.variableStore;\n this.state = data.state;\n this.ioCenter = data.ioCenter;\n this.snapshotCenter = data.snapshotCenter;\n this.statusCenter = data.statusCenter;\n this.messageCenter = data.messageCenter;\n this.reporter = data.reporter;\n }\n\n public init(params: InvokeParams): void {\n const { schema, inputs } = params;\n this.cache.init();\n this.document.init(schema);\n this.variableStore.init();\n this.state.init(schema);\n this.ioCenter.init(inputs);\n this.snapshotCenter.init();\n this.statusCenter.init();\n this.messageCenter.init();\n this.reporter.init();\n }\n\n public dispose(): void {\n this.subContexts.forEach((subContext) => {\n subContext.dispose();\n });\n this.subContexts = [];\n this.cache.dispose();\n this.document.dispose();\n this.variableStore.dispose();\n this.state.dispose();\n this.ioCenter.dispose();\n this.snapshotCenter.dispose();\n this.statusCenter.dispose();\n this.messageCenter.dispose();\n this.reporter.dispose();\n }\n\n public sub(): IContext {\n const cache = new WorkflowRuntimeCache();\n const variableStore = new WorkflowRuntimeVariableStore();\n variableStore.setParent(this.variableStore);\n const state = new WorkflowRuntimeState(variableStore);\n const contextData: ContextData = {\n cache,\n document: this.document,\n ioCenter: this.ioCenter,\n snapshotCenter: this.snapshotCenter,\n statusCenter: this.statusCenter,\n messageCenter: this.messageCenter,\n reporter: this.reporter,\n variableStore,\n state,\n };\n const subContext = new WorkflowRuntimeContext(contextData);\n this.subContexts.push(subContext);\n subContext.cache.init();\n subContext.variableStore.init();\n subContext.state.init();\n return subContext;\n }\n\n public static create(): IContext {\n const cache = new WorkflowRuntimeCache();\n const document = new WorkflowRuntimeDocument();\n const variableStore = new WorkflowRuntimeVariableStore();\n const state = new WorkflowRuntimeState(variableStore);\n const ioCenter = new WorkflowRuntimeIOCenter();\n const snapshotCenter = new WorkflowRuntimeSnapshotCenter();\n const statusCenter = new WorkflowRuntimeStatusCenter();\n const messageCenter = new WorkflowRuntimeMessageCenter();\n const reporter = new WorkflowRuntimeReporter(\n ioCenter,\n snapshotCenter,\n statusCenter,\n messageCenter\n );\n return new WorkflowRuntimeContext({\n cache,\n document,\n variableStore,\n state,\n ioCenter,\n snapshotCenter,\n statusCenter,\n messageCenter,\n reporter,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n EngineServices,\n IEngine,\n IExecutor,\n INode,\n WorkflowOutputs,\n IContext,\n InvokeParams,\n ITask,\n FlowGramNode,\n IValidation,\n} from '@flowgram.ai/runtime-interface';\n\nimport { compareNodeGroups } from '@infra/utils';\nimport { WorkflowRuntimeTask } from '../task';\nimport { WorkflowRuntimeContext } from '../context';\nimport { WorkflowRuntimeContainer } from '../container';\n\nexport class WorkflowRuntimeEngine implements IEngine {\n private readonly validation: IValidation;\n\n private readonly executor: IExecutor;\n\n constructor(service: EngineServices) {\n this.validation = service.Validation;\n this.executor = service.Executor;\n }\n\n public invoke(params: InvokeParams): ITask {\n const context = WorkflowRuntimeContext.create();\n context.init(params);\n const valid = this.validate(params, context);\n if (!valid) {\n return WorkflowRuntimeTask.create({\n processing: Promise.resolve({}),\n context,\n });\n }\n const processing = this.process(context);\n processing.then(() => {\n context.dispose();\n });\n return WorkflowRuntimeTask.create({\n processing,\n context,\n });\n }\n\n public async executeNode(params: { context: IContext; node: INode }) {\n const { node, context } = params;\n if (!this.canExecuteNode({ node, context })) {\n return;\n }\n context.statusCenter.nodeStatus(node.id).process();\n const snapshot = context.snapshotCenter.create({\n nodeID: node.id,\n data: node.data,\n });\n let nextNodes: INode[] = [];\n try {\n const inputs = context.state.getNodeInputs(node);\n snapshot.update({\n inputs,\n });\n const result = await this.executor.execute({\n node,\n inputs,\n runtime: context,\n container: WorkflowRuntimeContainer.instance,\n snapshot,\n });\n if (context.statusCenter.workflow.terminated) {\n return;\n }\n const { outputs, branch } = result;\n snapshot.update({ outputs, branch });\n context.state.setNodeOutputs({ node, outputs });\n context.state.addExecutedNode(node);\n context.statusCenter.nodeStatus(node.id).success();\n nextNodes = this.getNextNodes({ node, branch, context });\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : 'An unknown error occurred';\n snapshot.update({ error: errorMessage });\n context.messageCenter.error({\n nodeID: node.id,\n message: errorMessage,\n });\n context.statusCenter.nodeStatus(node.id).fail();\n console.error(e);\n throw e;\n }\n await this.executeNext({ node, nextNodes, context });\n }\n\n private async process(context: IContext): Promise<WorkflowOutputs> {\n const startNode = context.document.start;\n context.statusCenter.workflow.process();\n try {\n await this.executeNode({ node: startNode, context });\n const outputs = context.ioCenter.outputs;\n context.statusCenter.workflow.success();\n return outputs;\n } catch (e) {\n context.statusCenter.workflow.fail();\n return {};\n }\n }\n\n private validate(params: InvokeParams, context: IContext): boolean {\n const { valid, errors } = this.validation.invoke(params);\n if (valid) {\n return true;\n }\n errors?.forEach((message) => {\n context.messageCenter.error({\n message,\n });\n });\n context.statusCenter.workflow.fail();\n return false;\n }\n\n private canExecuteNode(params: { context: IContext; node: INode }) {\n const { node, context } = params;\n const prevNodes = node.prev;\n if (prevNodes.length === 0) {\n return true;\n }\n return prevNodes.every((prevNode) => context.state.isExecutedNode(prevNode));\n }\n\n private getNextNodes(params: { context: IContext; node: INode; branch?: string }) {\n const { node, branch, context } = params;\n const allNextNodes = node.next;\n if (!branch) {\n return allNextNodes;\n }\n const targetPort = node.ports.outputs.find((port) => port.id === branch);\n if (!targetPort) {\n throw new Error(`Branch \"${branch}\" not found`);\n }\n const nextNodeIDs: Set<string> = new Set(targetPort.edges.map((edge) => edge.to.id));\n const nextNodes = allNextNodes.filter((nextNode) => nextNodeIDs.has(nextNode.id));\n const skipNodes = allNextNodes.filter((nextNode) => !nextNodeIDs.has(nextNode.id));\n const nextGroups = nextNodes.map((nextNode) => [nextNode, ...nextNode.successors]);\n const skipGroups = skipNodes.map((skipNode) => [skipNode, ...skipNode.successors]);\n const { uniqueToB: skippedNodes } = compareNodeGroups(nextGroups, skipGroups);\n skippedNodes.forEach((node) => {\n context.state.addExecutedNode(node);\n });\n return nextNodes;\n }\n\n private async executeNext(params: { context: IContext; node: INode; nextNodes: INode[] }) {\n const { context, node, nextNodes } = params;\n const terminatingNodeTypes = [\n FlowGramNode.End,\n FlowGramNode.BlockEnd,\n FlowGramNode.Break,\n FlowGramNode.Continue,\n ];\n if (terminatingNodeTypes.includes(node.type)) {\n return;\n }\n if (nextNodes.length === 0) {\n throw new Error(`Node \"${node.id}\" has no next nodes`); // inside loop node may have no next nodes\n }\n await Promise.all(\n nextNodes.map((nextNode) =>\n this.executeNode({\n node: nextNode,\n context,\n })\n )\n );\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ContainerService,\n IContainer,\n IEngine,\n IExecutor,\n IValidation,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeNodeExecutors } from '@nodes/index';\nimport { WorkflowRuntimeValidation } from '../validation';\nimport { WorkflowRuntimeExecutor } from '../executor';\nimport { WorkflowRuntimeEngine } from '../engine';\n\nexport class WorkflowRuntimeContainer implements IContainer {\n constructor(private readonly services: Record<string, ContainerService>) {}\n\n public get<T = ContainerService>(key: any): T {\n return this.services[key] as T;\n }\n\n private static _instance: IContainer;\n\n public static get instance(): IContainer {\n if (this._instance) {\n return this._instance;\n }\n const services = this.create();\n this._instance = new WorkflowRuntimeContainer(services);\n return this._instance;\n }\n\n private static create(): Record<symbol, ContainerService> {\n // services\n const Validation = new WorkflowRuntimeValidation();\n const Executor = new WorkflowRuntimeExecutor(WorkflowRuntimeNodeExecutors);\n const Engine = new WorkflowRuntimeEngine({\n Validation,\n Executor,\n });\n\n return {\n [IValidation]: Validation,\n [IExecutor]: Executor,\n [IEngine]: Engine,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable no-console */\nimport {\n InvokeParams,\n IContainer,\n IEngine,\n ITask,\n IReport,\n WorkflowOutputs,\n IValidation,\n ValidationResult,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeContainer } from '@workflow/container';\n\nexport class WorkflowApplication {\n private container: IContainer;\n\n public tasks: Map<string, ITask>;\n\n constructor() {\n this.container = WorkflowRuntimeContainer.instance;\n this.tasks = new Map();\n }\n\n public run(params: InvokeParams): string {\n const engine = this.container.get<IEngine>(IEngine);\n const task = engine.invoke(params);\n this.tasks.set(task.id, task);\n console.log('> POST TaskRun - taskID: ', task.id);\n console.log(params.inputs);\n task.processing.then((output) => {\n console.log('> LOG Task finished: ', task.id);\n console.log(output);\n });\n return task.id;\n }\n\n public cancel(taskID: string): boolean {\n console.log('> PUT TaskCancel - taskID: ', taskID);\n const task = this.tasks.get(taskID);\n if (!task) {\n return false;\n }\n task.cancel();\n return true;\n }\n\n public report(taskID: string): IReport | undefined {\n const task = this.tasks.get(taskID);\n console.log('> GET TaskReport - taskID: ', taskID);\n if (!task) {\n return;\n }\n return task.context.reporter.export();\n }\n\n public result(taskID: string): WorkflowOutputs | undefined {\n console.log('> GET TaskResult - taskID: ', taskID);\n const task = this.tasks.get(taskID);\n if (!task) {\n return;\n }\n if (!task.context.statusCenter.workflow.terminated) {\n return;\n }\n return task.context.ioCenter.outputs;\n }\n\n public validate(params: InvokeParams): ValidationResult {\n const validation = this.container.get<IValidation>(IValidation);\n const result = validation.invoke(params);\n console.log('> POST TaskValidate - valid: ', result.valid);\n return result;\n }\n\n private static _instance: WorkflowApplication;\n\n public static get instance(): WorkflowApplication {\n if (this._instance) {\n return this._instance;\n }\n this._instance = new WorkflowApplication();\n return this._instance;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskValidateInput, TaskValidateOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskValidateAPI = async (input: TaskValidateInput): Promise<TaskValidateOutput> => {\n const app = WorkflowApplication.instance;\n const { schema: stringSchema, inputs } = input;\n const schema = JSON.parse(stringSchema);\n const result = app.validate({\n schema,\n inputs,\n });\n const output: TaskValidateOutput = result;\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskRunInput, TaskRunOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskRunAPI = async (input: TaskRunInput): Promise<TaskRunOutput> => {\n const app = WorkflowApplication.instance;\n const { schema: stringSchema, inputs } = input;\n const schema = JSON.parse(stringSchema);\n const taskID = app.run({\n schema,\n inputs,\n });\n const output: TaskRunOutput = {\n taskID,\n };\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskResultInput, TaskResultOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskResultAPI = async (input: TaskResultInput): Promise<TaskResultOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const output: TaskResultOutput = app.result(taskID);\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable no-console */\nimport {\n TaskReportInput,\n TaskReportOutput,\n TaskReportDefine,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskReportAPI = async (input: TaskReportInput): Promise<TaskReportOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const output: TaskReportOutput = app.report(taskID);\n try {\n TaskReportDefine.schema.output.parse(output);\n } catch (e) {\n console.log('> TaskReportAPI - output: ', JSON.stringify(output));\n console.error(e);\n }\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskCancelInput, TaskCancelOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskCancelAPI = async (input: TaskCancelInput): Promise<TaskCancelOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const success = app.cancel(taskID);\n const output: TaskCancelOutput = {\n success,\n };\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIName } from '@flowgram.ai/runtime-interface';\n\nimport { TaskValidateAPI } from './task-validate';\nimport { TaskRunAPI } from './task-run';\nimport { TaskResultAPI } from './task-result';\nimport { TaskReportAPI } from './task-report';\nimport { TaskCancelAPI } from './task-cancel';\n\nexport { TaskRunAPI, TaskResultAPI, TaskReportAPI, TaskCancelAPI, TaskValidateAPI };\n\nexport const WorkflowRuntimeAPIs: Record<FlowGramAPIName, (i: any) => any> = {\n [FlowGramAPIName.ServerInfo]: () => {}, // TODO\n [FlowGramAPIName.TaskRun]: TaskRunAPI,\n [FlowGramAPIName.TaskReport]: TaskReportAPI,\n [FlowGramAPIName.TaskResult]: TaskResultAPI,\n [FlowGramAPIName.TaskCancel]: TaskCancelAPI,\n [FlowGramAPIName.TaskValidate]: TaskValidateAPI,\n};\n"],"mappings":";AAKA,OAAOA,QAAO;ACAd,OAAO,OAAO;AEAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ANEd,IAAM,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAExD,IAAM,4BAA4B,EAAE,OAAO;EACzC,IAAI,EAAE,OAAO;EACb,QAAQ,EAAE,OAAO;EACjB,QAAQ;EACR,SAAS,oBAAoB,SAAS;EACtC,MAAM;EACN,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;AAED,IAAM,yBAAyB;EAC7B,QAAQ,EAAE,OAAO;EACjB,YAAY,EAAE,QAAQ;EACtB,WAAW,EAAE,OAAO;EACpB,SAAS,EAAE,OAAO,EAAE,SAAS;EAC7B,UAAU,EAAE,OAAO;AACrB;AACA,IAAM,0BAA0B,EAAE,OAAO,sBAAsB;AAE/D,IAAM,8BAA8B,EAAE,OAAO;EAC3C,IAAI,EAAE,OAAO;EACb,GAAG;EACH,WAAW,EAAE,MAAM,yBAAyB;AAC9C,CAAC;AAED,IAAM,2BAA2B,EAAE,OAAO,EAAE,OAAO,GAAG,2BAA2B;AAEjF,IAAM,2BAA2B,EAAE,OAAO;EACxC,IAAI,EAAE,OAAO;EACb,MAAM,EAAE,KAAK,CAAC,OAAO,QAAQ,SAAS,SAAS,SAAS,CAAC;EACzD,SAAS,EAAE,OAAO;EAClB,QAAQ,EAAE,OAAO,EAAE,SAAS;EAC5B,WAAW,EAAE,OAAO;AACtB,CAAC;AAED,IAAM,4BAA4B,EAAE;EAClC,EAAE,KAAK,CAAC,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ACT;;;AChBO,IAAM,gBAAgB,OAAO,UAAsD;AACxF,QAAM,MAAM,oBAAoB;AAChC,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,UAAU,IAAI,OAAO,MAAM;AACjC,QAAM,SAA2B;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;;;ACFO,IAAM,sBAAgE;AAAA,EAC3E,CAAC,gBAAgB,UAAU,GAAG,MAAM;AAAA,EAAC;AAAA;AAAA,EACrC,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,YAAY,GAAG;AAClC;","names":["z","FlowGramAPIName","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperator","HTTPBodyType","WorkflowStatus","WorkflowMessageType","WorkflowRuntimeType","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","NodeStatus","WorkflowRuntimeMessage","WorkflowRuntimeVariable","variable","isNil","isNil","WorkflowRuntimeReport","node"]}
1
+ {"version":3,"sources":["../../../interface/src/api/task-validate/index.ts","../../../interface/src/api/schema.ts","../../../interface/src/api/constant.ts","../../../interface/src/api/task-run/index.ts","../../../interface/src/api/task-result/index.ts","../../../interface/src/api/task-report/index.ts","../../../interface/src/api/task-cancel/index.ts","../../../interface/src/api/server-info/index.ts","../../../interface/src/api/define.ts","../../../interface/src/schema/constant.ts","../../../interface/src/node/constant.ts","../../../interface/src/node/condition/constant.ts","../../../interface/src/node/http/constant.ts","../../../interface/src/runtime/engine/index.ts","../../../interface/src/runtime/executor/executor.ts","../../../interface/src/runtime/status/index.ts","../../../interface/src/runtime/validation/index.ts","../../../interface/src/runtime/message/index.ts","../../src/nodes/start/index.ts","../../src/nodes/loop/index.ts","../../src/infrastructure/utils/uuid.ts","../../src/infrastructure/utils/runtime-type.ts","../../src/infrastructure/utils/traverse-nodes.ts","../../src/infrastructure/utils/compare-node-groups.ts","../../src/infrastructure/utils/json-schema-validator.ts","../../src/nodes/llm/index.ts","../../src/nodes/http/index.ts","../../src/nodes/end/index.ts","../../src/nodes/empty/index.ts","../../src/nodes/continue/index.ts","../../src/nodes/condition/index.ts","../../src/nodes/condition/rules.ts","../../src/nodes/condition/handlers/string.ts","../../src/nodes/condition/handlers/object.ts","../../src/nodes/condition/handlers/number.ts","../../src/nodes/condition/handlers/null.ts","../../src/nodes/condition/handlers/map.ts","../../src/nodes/condition/handlers/datetime.ts","../../src/nodes/condition/handlers/boolean.ts","../../src/nodes/condition/handlers/array.ts","../../src/nodes/condition/handlers/index.ts","../../src/nodes/code/index.ts","../../src/nodes/break/index.ts","../../src/nodes/index.ts","../../src/domain/validation/validators/cycle-detection.ts","../../src/domain/validation/validators/start-end-node.ts","../../src/domain/validation/validators/edge-source-target-exist.ts","../../src/domain/validation/validators/schema-format.ts","../../src/domain/validation/index.ts","../../src/domain/executor/index.ts","../../src/domain/task/index.ts","../../src/domain/message/message-value-object/index.ts","../../src/domain/message/message-center/index.ts","../../src/domain/cache/index.ts","../../src/domain/variable/variable-store/index.ts","../../src/domain/variable/variable-value-object/index.ts","../../src/domain/status/status-entity/index.ts","../../src/domain/status/status-center/index.ts","../../src/domain/state/index.ts","../../src/domain/snapshot/snapshot-entity/index.ts","../../src/domain/snapshot/snapshot-center/index.ts","../../src/domain/report/report-value-object/index.ts","../../src/domain/report/reporter/index.ts","../../src/domain/io-center/index.ts","../../src/domain/document/entity/edge/index.ts","../../src/domain/document/entity/node/index.ts","../../src/domain/document/entity/port/index.ts","../../src/domain/document/document/flat-schema.ts","../../src/domain/document/document/create-store.ts","../../src/domain/document/document/index.ts","../../src/domain/context/index.ts","../../src/domain/engine/index.ts","../../src/domain/container/index.ts","../../src/application/workflow.ts","../../src/api/task-validate.ts","../../src/api/task-run.ts","../../src/api/task-result.ts","../../src/api/task-report.ts","../../src/api/task-cancel.ts","../../src/api/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { ValidationResult, WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskValidateInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskValidateOutput extends ValidationResult {}\n\nexport const TaskValidateDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskValidate,\n method: FlowGramAPIMethod.POST,\n path: '/task/validate',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n valid: z.boolean(),\n errors: z.array(z.string()).optional(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nconst WorkflowIOZodSchema = z.record(z.string(), z.any());\n\nconst WorkflowSnapshotZodSchema = z.object({\n id: z.string(),\n nodeID: z.string(),\n inputs: WorkflowIOZodSchema,\n outputs: WorkflowIOZodSchema.optional(),\n data: WorkflowIOZodSchema,\n branch: z.string().optional(),\n});\n\nconst WorkflowStatusZodShape = {\n status: z.string(),\n terminated: z.boolean(),\n startTime: z.number(),\n endTime: z.number().optional(),\n timeCost: z.number(),\n};\nconst WorkflowStatusZodSchema = z.object(WorkflowStatusZodShape);\n\nconst WorkflowNodeReportZodSchema = z.object({\n id: z.string(),\n ...WorkflowStatusZodShape,\n snapshots: z.array(WorkflowSnapshotZodSchema),\n});\n\nconst WorkflowReportsZodSchema = z.record(z.string(), WorkflowNodeReportZodSchema);\n\nconst WorkflowMessageZodSchema = z.object({\n id: z.string(),\n type: z.enum(['log', 'info', 'debug', 'error', 'warning']),\n message: z.string(),\n nodeID: z.string().optional(),\n timestamp: z.number(),\n});\n\nconst WorkflowMessagesZodSchema = z.record(\n z.enum(['log', 'info', 'debug', 'error', 'warning']),\n z.array(WorkflowMessageZodSchema)\n);\n\nexport const WorkflowZodSchema = {\n Inputs: WorkflowIOZodSchema,\n Outputs: WorkflowIOZodSchema,\n Status: WorkflowStatusZodSchema,\n Snapshot: WorkflowSnapshotZodSchema,\n Reports: WorkflowReportsZodSchema,\n Messages: WorkflowMessagesZodSchema,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramAPIMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\nexport enum FlowGramAPIName {\n ServerInfo = 'ServerInfo',\n TaskRun = 'TaskRun',\n TaskReport = 'TaskReport',\n TaskResult = 'TaskResult',\n TaskCancel = 'TaskCancel',\n TaskValidate = 'TaskValidate',\n}\n\nexport enum FlowGramAPIModule {\n Info = 'Info',\n Task = 'Task',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowInputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface TaskRunInput {\n inputs: WorkflowInputs;\n schema: string;\n}\n\nexport interface TaskRunOutput {\n taskID: string;\n}\n\nexport const TaskRunDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskRun,\n method: FlowGramAPIMethod.POST,\n path: '/task/run',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n schema: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n }),\n output: z.object({\n taskID: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { WorkflowOutputs } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskResultInput {\n taskID: string;\n}\n\nexport type TaskResultOutput = WorkflowOutputs | undefined;\n\nexport const TaskResultDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskResult,\n method: FlowGramAPIMethod.GET,\n path: '/task/result',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: WorkflowZodSchema.Outputs,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { IReport } from '@runtime/index';\nimport { FlowGramAPIDefine } from '@api/type';\nimport { WorkflowZodSchema } from '@api/schema';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskReportInput {\n taskID: string;\n}\n\nexport type TaskReportOutput = IReport | undefined;\n\nexport const TaskReportDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskReport,\n method: FlowGramAPIMethod.GET,\n path: '/task/report',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n id: z.string(),\n inputs: WorkflowZodSchema.Inputs,\n outputs: WorkflowZodSchema.Outputs,\n workflowStatus: WorkflowZodSchema.Status,\n reports: WorkflowZodSchema.Reports,\n messages: WorkflowZodSchema.Messages,\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIName, FlowGramAPIMethod, FlowGramAPIModule } from '@api/constant';\n\nexport interface TaskCancelInput {\n taskID: string;\n}\n\nexport type TaskCancelOutput = {\n success: boolean;\n};\n\nexport const TaskCancelDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.TaskCancel,\n method: FlowGramAPIMethod.PUT,\n path: '/task/cancel',\n module: FlowGramAPIModule.Task,\n schema: {\n input: z.object({\n taskID: z.string(),\n }),\n output: z.object({\n success: z.boolean(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport z from 'zod';\n\nimport { type FlowGramAPIDefine } from '@api/type';\nimport { FlowGramAPIMethod, FlowGramAPIModule, FlowGramAPIName } from '@api/constant';\n\nexport interface ServerInfoInput {}\n\nexport interface ServerInfoOutput {\n name: string;\n title: string;\n description: string;\n runtime: string;\n version: string;\n time: string;\n}\n\nexport const ServerInfoDefine: FlowGramAPIDefine = {\n name: FlowGramAPIName.ServerInfo,\n method: FlowGramAPIMethod.GET,\n path: '/info',\n module: FlowGramAPIModule.Info,\n schema: {\n input: z.undefined(),\n output: z.object({\n name: z.string(),\n runtime: z.string(),\n version: z.string(),\n time: z.string(),\n }),\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIDefines } from './type';\nimport { TaskValidateDefine } from './task-validate';\nimport { TaskRunDefine } from './task-run';\nimport { TaskResultDefine } from './task-result';\nimport { TaskReportDefine } from './task-report';\nimport { TaskCancelDefine } from './task-cancel';\nimport { ServerInfoDefine } from './server-info';\nimport { FlowGramAPIName } from './constant';\n\nexport const FlowGramAPIs: FlowGramAPIDefines = {\n [FlowGramAPIName.ServerInfo]: ServerInfoDefine,\n [FlowGramAPIName.TaskRun]: TaskRunDefine,\n [FlowGramAPIName.TaskReport]: TaskReportDefine,\n [FlowGramAPIName.TaskResult]: TaskResultDefine,\n [FlowGramAPIName.TaskCancel]: TaskCancelDefine,\n [FlowGramAPIName.TaskValidate]: TaskValidateDefine,\n};\n\nexport const FlowGramAPINames = Object.keys(FlowGramAPIs) as FlowGramAPIName[];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowPortType {\n Input = 'input',\n Output = 'output',\n}\n\nexport enum WorkflowVariableType {\n String = 'string',\n Integer = 'integer',\n Number = 'number',\n Boolean = 'boolean',\n Object = 'object',\n Array = 'array',\n Map = 'map',\n DateTime = 'date-time',\n Null = 'null',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum FlowGramNode {\n Root = 'root',\n Start = 'start',\n End = 'end',\n LLM = 'llm',\n Code = 'code',\n Condition = 'condition',\n Loop = 'loop',\n Comment = 'comment',\n Group = 'group',\n BlockStart = 'block-start',\n BlockEnd = 'block-end',\n HTTP = 'http',\n Break = 'break',\n Continue = 'continue',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum ConditionOperator {\n /** Equal */\n EQ = 'eq',\n /** Not Equal */\n NEQ = 'neq',\n /** Greater Than */\n GT = 'gt',\n /** Greater Than or Equal */\n GTE = 'gte',\n /** Less Than */\n LT = 'lt',\n /** Less Than or Equal */\n LTE = 'lte',\n /** In */\n IN = 'in',\n /** Not In */\n NIN = 'nin',\n /** Contains */\n CONTAINS = 'contains',\n /** Not Contains */\n NOT_CONTAINS = 'not_contains',\n /** Is Empty */\n IS_EMPTY = 'is_empty',\n /** Is Not Empty */\n IS_NOT_EMPTY = 'is_not_empty',\n /** Is True */\n IS_TRUE = 'is_true',\n /** Is False */\n IS_FALSE = 'is_false',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum HTTPMethod {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Delete = 'DELETE',\n Patch = 'PATCH',\n Head = 'HEAD',\n}\n\nexport enum HTTPBodyType {\n None = 'none',\n FormData = 'form-data',\n XWwwFormUrlencoded = 'x-www-form-urlencoded',\n RawText = 'raw-text',\n JSON = 'JSON',\n Binary = 'binary',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IValidation } from '@runtime/validation';\nimport { ITask } from '../task';\nimport { IExecutor } from '../executor';\nimport { INode } from '../document';\nimport { IContext } from '../context';\nimport { InvokeParams } from '../base';\n\nexport interface EngineServices {\n Validation: IValidation;\n Executor: IExecutor;\n}\n\nexport interface IEngine {\n invoke(params: InvokeParams): ITask;\n executeNode(params: { context: IContext; node: INode }): Promise<void>;\n}\n\nexport const IEngine = Symbol.for('Engine');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ExecutionContext, ExecutionResult, INodeExecutor } from './node-executor';\n\nexport interface IExecutor {\n execute: (context: ExecutionContext) => Promise<ExecutionResult>;\n register: (executor: INodeExecutor) => void;\n}\n\nexport const IExecutor = Symbol.for('Executor');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowStatus {\n Pending = 'pending',\n Processing = 'processing',\n Succeeded = 'succeeded',\n Failed = 'failed',\n Cancelled = 'canceled',\n}\n\nexport interface StatusData {\n status: WorkflowStatus;\n terminated: boolean;\n startTime: number;\n endTime?: number;\n timeCost: number;\n}\n\nexport interface IStatus extends StatusData {\n id: string;\n process(): void;\n success(): void;\n fail(): void;\n cancel(): void;\n export(): StatusData;\n}\n\nexport interface IStatusCenter {\n workflow: IStatus;\n nodeStatus(nodeID: string): IStatus;\n init(): void;\n dispose(): void;\n getStatusNodeIDs(status: WorkflowStatus): string[];\n exportNodeStatus(): Record<string, StatusData>;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { InvokeParams } from '@runtime/base';\n\nexport interface ValidationResult {\n valid: boolean;\n errors?: string[];\n}\n\nexport interface IValidation {\n invoke(params: InvokeParams): ValidationResult;\n}\n\nexport const IValidation = Symbol.for('Validation');\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum WorkflowMessageType {\n Log = 'log',\n Info = 'info',\n Debug = 'debug',\n Error = 'error',\n Warn = 'warning',\n}\n\nexport interface MessageData {\n message: string;\n nodeID?: string;\n timestamp?: number;\n}\n\nexport interface IMessage extends MessageData {\n id: string;\n type: WorkflowMessageType;\n timestamp: number;\n}\n\nexport type WorkflowMessages = Record<WorkflowMessageType, IMessage[]>;\n\nexport interface IMessageCenter {\n init(): void;\n dispose(): void;\n log(data: MessageData): IMessage;\n info(data: MessageData): IMessage;\n debug(data: MessageData): IMessage;\n error(data: MessageData): IMessage;\n warn(data: MessageData): IMessage;\n export(): WorkflowMessages;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class StartExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Start;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: context.runtime.ioCenter.inputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n IContext,\n IEngine,\n IFlowRefValue,\n INode,\n INodeExecutor,\n IVariableParseResult,\n LoopNodeSchema,\n WorkflowVariableType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeType } from '@infra/index';\n\ntype LoopArray = Array<any>;\ntype LoopBlockVariables = Record<string, IVariableParseResult>;\ntype LoopOutputs = Record<string, any>;\n\nexport interface LoopExecutorInputs {\n loopFor: LoopArray;\n}\n\nexport class LoopExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Loop;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const loopNodeID = context.node.id;\n\n const engine = context.container.get<IEngine>(IEngine);\n const { value: loopArray, itemsType } = this.getLoopArrayVariable(context);\n const subNodes = context.node.children;\n const blockStartNode = subNodes.find((node) => node.type === FlowGramNode.BlockStart);\n\n if (!blockStartNode) {\n throw new Error('Loop block start node not found');\n }\n\n const blockOutputs: LoopOutputs[] = [];\n\n // not use Array method to make error stack more concise, and better performance\n for (let index = 0; index < loopArray.length; index++) {\n const loopItem = loopArray[index];\n const subContext = context.runtime.sub();\n subContext.variableStore.setVariable({\n nodeID: `${loopNodeID}_locals`,\n key: 'item',\n type: itemsType,\n value: loopItem,\n });\n subContext.variableStore.setVariable({\n nodeID: `${loopNodeID}_locals`,\n key: 'index',\n type: WorkflowVariableType.Number,\n value: index,\n });\n try {\n await engine.executeNode({\n context: subContext,\n node: blockStartNode,\n });\n } catch (e) {\n throw new Error(`Loop block execute error`);\n }\n if (this.isBreak(subContext)) {\n break;\n }\n if (this.isContinue(subContext)) {\n continue;\n }\n const blockOutput = this.getBlockOutput(context, subContext);\n blockOutputs.push(blockOutput);\n }\n\n this.setLoopNodeOutputs(context, blockOutputs);\n const outputs = this.combineBlockOutputs(context, blockOutputs);\n\n return {\n outputs,\n };\n }\n\n private getLoopArrayVariable(\n executionContext: ExecutionContext\n ): IVariableParseResult<LoopArray> & {\n itemsType: WorkflowVariableType;\n } {\n const loopNodeData = executionContext.node.data as LoopNodeSchema['data'];\n const LoopArrayVariable = executionContext.runtime.state.parseRef<LoopArray>(\n loopNodeData.loopFor\n );\n this.checkLoopArray(LoopArrayVariable);\n return LoopArrayVariable as IVariableParseResult<LoopArray> & {\n itemsType: WorkflowVariableType;\n };\n }\n\n private checkLoopArray(LoopArrayVariable: IVariableParseResult<LoopArray> | null): void {\n const loopArray = LoopArrayVariable?.value;\n if (!loopArray || isNil(loopArray) || !Array.isArray(loopArray)) {\n throw new Error('Loop \"loopFor\" is required');\n }\n const loopArrayType = LoopArrayVariable.type;\n if (loopArrayType !== WorkflowVariableType.Array) {\n throw new Error('Loop \"loopFor\" must be an array');\n }\n const loopArrayItemType = LoopArrayVariable.itemsType;\n if (isNil(loopArrayItemType)) {\n throw new Error('Loop \"loopFor.items\" must be array items');\n }\n }\n\n private getBlockOutput(\n executionContext: ExecutionContext,\n subContext: IContext\n ): LoopBlockVariables {\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const blockOutput = Object.entries(loopOutputsDeclare).reduce(\n (acc, [outputName, outputRef]) => {\n const outputVariable = subContext.state.parseRef(outputRef);\n if (!outputVariable) {\n return acc;\n }\n return {\n ...acc,\n [outputName]: outputVariable,\n };\n },\n {} as LoopBlockVariables\n );\n return blockOutput;\n }\n\n private setLoopNodeOutputs(\n executionContext: ExecutionContext,\n blockOutputs: LoopBlockVariables[]\n ) {\n const loopNode = executionContext.node as INode<LoopNodeSchema['data']>;\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const loopOutputNames = Object.keys(loopOutputsDeclare);\n loopOutputNames.forEach((outputName) => {\n const outputVariables = blockOutputs.map((blockOutput) => blockOutput[outputName]);\n const outputTypes = outputVariables.map((fieldVariable) => fieldVariable.type);\n const itemsType = WorkflowRuntimeType.getArrayItemsType(outputTypes);\n const value = outputVariables.map((fieldVariable) => fieldVariable.value);\n executionContext.runtime.variableStore.setVariable({\n nodeID: loopNode.id,\n key: outputName,\n type: WorkflowVariableType.Array,\n itemsType,\n value,\n });\n });\n }\n\n private combineBlockOutputs(\n executionContext: ExecutionContext,\n blockOutputs: LoopBlockVariables[]\n ): LoopOutputs {\n const loopOutputsDeclare = this.getLoopOutputsDeclare(executionContext);\n const loopOutputNames = Object.keys(loopOutputsDeclare);\n const loopOutput = loopOutputNames.reduce(\n (outputs, outputName) => ({\n ...outputs,\n [outputName]: blockOutputs.map((blockOutput) => blockOutput[outputName].value),\n }),\n {} as LoopOutputs\n );\n return loopOutput;\n }\n\n private getLoopOutputsDeclare(executionContext: ExecutionContext): Record<string, IFlowRefValue> {\n const loopNodeData = executionContext.node.data as LoopNodeSchema['data'];\n const loopOutputsDeclare = loopNodeData.loopOutputs ?? {};\n return loopOutputsDeclare;\n }\n\n private isBreak(subContext: IContext): boolean {\n return subContext.cache.get('loop-break') === true;\n }\n\n private isContinue(subContext: IContext): boolean {\n return subContext.cache.get('loop-continue') === true;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { v4 } from 'uuid';\n\nexport const uuid = v4;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nexport namespace WorkflowRuntimeType {\n export const getWorkflowType = (value?: unknown): WorkflowVariableType | null => {\n // 处理 null 和 undefined 的情况\n if (value === null || value === undefined) {\n return WorkflowVariableType.Null;\n }\n\n // 处理基本类型\n if (typeof value === 'string') {\n // Check if string is a valid ISO 8601 datetime format\n const iso8601Regex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?$/;\n if (iso8601Regex.test(value)) {\n const date = new Date(value);\n // Validate that the date is actually valid\n if (!isNaN(date.getTime())) {\n return WorkflowVariableType.DateTime;\n }\n }\n return WorkflowVariableType.String;\n }\n\n if (typeof value === 'boolean') {\n return WorkflowVariableType.Boolean;\n }\n\n if (typeof value === 'number') {\n if (Number.isInteger(value)) {\n return WorkflowVariableType.Integer;\n }\n return WorkflowVariableType.Number;\n }\n\n // 处理数组\n if (Array.isArray(value)) {\n return WorkflowVariableType.Array;\n }\n\n // 处理普通对象\n if (typeof value === 'object') {\n return WorkflowVariableType.Object;\n }\n\n return null;\n };\n\n export const isMatchWorkflowType = (value: unknown, type: WorkflowVariableType): boolean => {\n const workflowType = getWorkflowType(value);\n if (!workflowType) {\n return false;\n }\n return workflowType === type;\n };\n\n export const isTypeEqual = (\n typeA: WorkflowVariableType,\n typeB: WorkflowVariableType\n ): boolean => {\n // 处理 Number 和 Integer 等价的情况\n if (\n (typeA === WorkflowVariableType.Number && typeB === WorkflowVariableType.Integer) ||\n (typeA === WorkflowVariableType.Integer && typeB === WorkflowVariableType.Number)\n ) {\n return true;\n }\n return typeA === typeB;\n };\n\n export const getArrayItemsType = (types: WorkflowVariableType[]): WorkflowVariableType => {\n const expectedType = types[0];\n types.forEach((type) => {\n if (type !== expectedType) {\n throw new Error(`Array items type must be same, expect ${expectedType}, but got ${type}`);\n }\n });\n return expectedType;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INode } from '@flowgram.ai/runtime-interface';\n\n/**\n * Generic function to traverse a node graph\n * @param startNode The starting node\n * @param getConnectedNodes Function to get connected nodes\n * @returns Array of all traversed nodes\n */\nexport function traverseNodes(\n startNode: INode,\n getConnectedNodes: (node: INode) => INode[]\n): INode[] {\n const visited = new Set<string>();\n const result: INode[] = [];\n\n const traverse = (node: INode) => {\n for (const connectedNode of getConnectedNodes(node)) {\n if (!visited.has(connectedNode.id)) {\n visited.add(connectedNode.id);\n result.push(connectedNode);\n traverse(connectedNode);\n }\n }\n };\n\n traverse(startNode);\n return result;\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INode } from '@flowgram.ai/runtime-interface';\n\n/**\n * Interface for node comparison results\n */\nexport interface NodeComparisonResult {\n /** Nodes common to both groups A and B */\n common: INode[];\n /** Nodes unique to group A */\n uniqueToA: INode[];\n /** Nodes unique to group B */\n uniqueToB: INode[];\n}\n\n/**\n * Compare two groups of node arrays to find common nodes and nodes unique to each group\n *\n * @param groupA Array of nodes in group A\n * @param groupB Array of nodes in group B\n * @returns Node comparison result\n *\n * @example\n * ```typescript\n * const groupA = [\n * [node1, node4, node5, node6, node10],\n * [node2, node3, node4, node5, node6, node10]\n * ];\n * const groupB = [\n * [node7, node8, node9, node4, node5, node6, node10]\n * ];\n *\n * const result = compareNodeGroups(groupA, groupB);\n * -> result.common: [node4, node5, node6, node10]\n * -> result.uniqueToA: [node1, node2, node3]\n * -> result.uniqueToB: [node7, node8, node9]\n * ```\n */\nexport function compareNodeGroups(groupA: INode[][], groupB: INode[][]): NodeComparisonResult {\n // Flatten and deduplicate all nodes in group A\n const flatA = groupA.flat();\n const setA = new Map<string, INode>();\n flatA.forEach((node) => {\n setA.set(node.id, node);\n });\n\n // Flatten and deduplicate all nodes in group B\n const flatB = groupB.flat();\n const setB = new Map<string, INode>();\n flatB.forEach((node) => {\n setB.set(node.id, node);\n });\n\n // Find common nodes\n const common: INode[] = [];\n const uniqueToA: INode[] = [];\n const uniqueToB: INode[] = [];\n\n // Iterate through group A nodes to find common nodes and nodes unique to A\n setA.forEach((node, id) => {\n if (setB.has(id)) {\n common.push(node);\n } else {\n uniqueToA.push(node);\n }\n });\n\n // Iterate through group B nodes to find nodes unique to B\n setB.forEach((node, id) => {\n if (!setA.has(id)) {\n uniqueToB.push(node);\n }\n });\n\n return {\n common,\n uniqueToA,\n uniqueToB,\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IJsonSchema } from '@flowgram.ai/runtime-interface';\n\n// Define validation result type\ntype ValidationResult = {\n result: boolean;\n errorMessage?: string;\n};\n\n// Define JSON Schema validator parameters type\ntype JSONSchemaValidatorParams = {\n schema: IJsonSchema;\n value: unknown;\n};\n\nconst ROOT_PATH = 'root';\n\nexport const isRootPath = (path: string) => path === ROOT_PATH;\n\n// Recursively validate value against JSON Schema\nconst validateValue = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n // Handle $ref references (temporarily skip as no reference resolution mechanism is provided)\n if (schema.$ref) {\n return { result: true }; // Temporarily skip reference validation\n }\n\n // Check enum values\n if (schema.enum && schema.enum.length > 0) {\n if (!schema.enum.includes(value as string | number)) {\n return {\n result: false,\n errorMessage: `Value at ${path} must be one of: ${schema.enum.join(\n ', '\n )}, but got: ${JSON.stringify(value)}`,\n };\n }\n }\n\n // Validate based on type\n switch (schema.type) {\n case 'boolean':\n return validateBoolean(value, path);\n\n case 'string':\n return validateString(value, path);\n\n case 'integer':\n return validateInteger(value, path);\n\n case 'number':\n return validateNumber(value, path);\n\n case 'object':\n return validateObject(value, schema, path);\n\n case 'array':\n return validateArray(value, schema, path);\n\n case 'map':\n return validateMap(value, schema, path);\n\n default:\n return {\n result: false,\n errorMessage: `Unknown type \"${schema.type}\" at ${path}`,\n };\n }\n};\n\n// Validate boolean value\nconst validateBoolean = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'boolean') {\n return {\n result: false,\n errorMessage: `Expected boolean at ${path}, but got: ${typeof value}`,\n };\n }\n return { result: true };\n};\n\n// Validate string value\nconst validateString = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'string') {\n return {\n result: false,\n errorMessage: `Expected string at ${path}, but got: ${typeof value}`,\n };\n }\n return { result: true };\n};\n\n// Validate integer value\nconst validateInteger = (value: unknown, path: string): ValidationResult => {\n if (!Number.isInteger(value)) {\n return {\n result: false,\n errorMessage: `Expected integer at ${path}, but got: ${JSON.stringify(value)}`,\n };\n }\n return { result: true };\n};\n\n// Validate number value\nconst validateNumber = (value: unknown, path: string): ValidationResult => {\n if (typeof value !== 'number' || isNaN(value)) {\n return {\n result: false,\n errorMessage: `Expected number at ${path}, but got: ${JSON.stringify(value)}`,\n };\n }\n return { result: true };\n};\n\n// Validate object value\nconst validateObject = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (value === null || value === undefined) {\n return {\n result: false,\n errorMessage: `Expected object at ${path}, but got: ${value}`,\n };\n }\n\n if (typeof value !== 'object' || Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected object at ${path}, but got: ${\n Array.isArray(value) ? 'array' : typeof value\n }`,\n };\n }\n\n const objectValue = value as Record<string, unknown>;\n\n // Check required properties\n if (schema.required && schema.required.length > 0) {\n for (const requiredProperty of schema.required) {\n if (!(requiredProperty in objectValue)) {\n return {\n result: false,\n errorMessage: `Missing required property \"${requiredProperty}\" at ${path}`,\n };\n }\n }\n }\n\n // Check is field required\n if (schema.properties) {\n for (const [propertyName] of Object.entries(schema.properties)) {\n const isRequired = schema.required?.includes(propertyName) ?? false;\n if (isRequired && !(propertyName in objectValue)) {\n return {\n result: false,\n errorMessage: `Missing required property \"${propertyName}\" at ${path}`,\n };\n }\n }\n }\n\n // Validate properties\n if (schema.properties) {\n for (const [propertyName, propertySchema] of Object.entries(schema.properties)) {\n if (propertyName in objectValue) {\n const propertyPath = isRootPath(path) ? propertyName : `${path}.${propertyName}`;\n const propertyResult = validateValue(\n objectValue[propertyName],\n propertySchema,\n propertyPath\n );\n if (!propertyResult.result) {\n return propertyResult;\n }\n }\n }\n }\n\n // Validate additional properties\n if (schema.additionalProperties) {\n const definedProperties = new Set(Object.keys(schema.properties || {}));\n for (const [propertyName, propertyValue] of Object.entries(objectValue)) {\n if (!definedProperties.has(propertyName)) {\n const propertyPath = isRootPath(path) ? propertyName : `${path}.${propertyName}`;\n const propertyResult = validateValue(\n propertyValue,\n schema.additionalProperties,\n propertyPath\n );\n if (!propertyResult.result) {\n return propertyResult;\n }\n }\n }\n }\n\n return { result: true };\n};\n\n// Validate array value\nconst validateArray = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (!Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected array at ${path}, but got: ${typeof value}`,\n };\n }\n\n // Validate array items\n if (schema.items) {\n for (const [index, item] of value.entries()) {\n const itemPath = `${path}[${index}]`;\n const itemResult = validateValue(item, schema.items, itemPath);\n if (!itemResult.result) {\n return itemResult;\n }\n }\n }\n\n return { result: true };\n};\n\n// Validate map value (similar to object, but all values must conform to the same schema)\nconst validateMap = (value: unknown, schema: IJsonSchema, path: string): ValidationResult => {\n if (value === null || value === undefined) {\n return {\n result: false,\n errorMessage: `Expected map at ${path}, but got: ${value}`,\n };\n }\n\n if (typeof value !== 'object' || Array.isArray(value)) {\n return {\n result: false,\n errorMessage: `Expected map at ${path}, but got: ${\n Array.isArray(value) ? 'array' : typeof value\n }`,\n };\n }\n\n const mapValue = value as Record<string, unknown>;\n\n // If additionalProperties exists, validate all values\n if (schema.additionalProperties) {\n for (const [key, mapItemValue] of Object.entries(mapValue)) {\n const keyPath = isRootPath(path) ? key : `${path}.${key}`;\n const keyResult = validateValue(mapItemValue, schema.additionalProperties, keyPath);\n if (!keyResult.result) {\n return keyResult;\n }\n }\n }\n\n return { result: true };\n};\n\n// Main JSON Schema validator function\nexport const JSONSchemaValidator = (params: JSONSchemaValidatorParams): ValidationResult => {\n const { schema, value } = params;\n\n try {\n const validationResult = validateValue(value, schema, ROOT_PATH);\n return validationResult;\n } catch (error) {\n return {\n result: false,\n errorMessage: `Validation error: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ChatOpenAI } from '@langchain/openai';\nimport { SystemMessage, HumanMessage, BaseMessageLike } from '@langchain/core/messages';\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface LLMExecutorInputs {\n modelName: string;\n apiKey: string;\n apiHost: string;\n temperature: number;\n systemPrompt?: string;\n prompt: string;\n}\n\nexport class LLMExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.LLM;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = context.inputs as LLMExecutorInputs;\n this.checkInputs(inputs);\n\n const { modelName, temperature, apiKey, apiHost, systemPrompt, prompt } = inputs;\n\n const model = new ChatOpenAI({\n modelName,\n temperature,\n apiKey,\n configuration: {\n baseURL: apiHost,\n },\n maxRetries: 3,\n });\n\n const messages: BaseMessageLike[] = [];\n\n if (systemPrompt) {\n messages.push(new SystemMessage(systemPrompt));\n }\n messages.push(new HumanMessage(prompt));\n\n let apiMessage;\n try {\n apiMessage = await model.invoke(messages);\n } catch (error) {\n // 调用 LLM API 失败\n const errorMessage = (error as Error)?.message;\n if (errorMessage === 'Connection error.') {\n throw new Error(`Network error: unreachable api \"${apiHost}\"`);\n }\n throw error;\n }\n\n const result = apiMessage.content;\n return {\n outputs: {\n result,\n },\n };\n }\n\n protected checkInputs(inputs: LLMExecutorInputs) {\n const { modelName, temperature, apiKey, apiHost, prompt } = inputs;\n const missingInputs = [];\n\n if (!modelName) missingInputs.push('modelName');\n if (isNil(temperature)) missingInputs.push('temperature');\n if (!apiKey) missingInputs.push('apiKey');\n if (!apiHost) missingInputs.push('apiHost');\n if (!prompt) missingInputs.push('prompt');\n\n if (missingInputs.length > 0) {\n throw new Error(`LLM node missing required inputs: \"${missingInputs.join('\", \"')}\"`);\n }\n\n this.checkApiHost(apiHost);\n }\n\n private checkApiHost(apiHost: string): void {\n if (!apiHost || typeof apiHost !== 'string') {\n throw new Error(`Invalid API host format - ${apiHost}`);\n }\n\n const url = new URL(apiHost);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') {\n throw new Error(`Invalid API host protocol - ${url.protocol}`);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n HTTPBodyType,\n HTTPMethod,\n HTTPNodeSchema,\n INode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface HTTPExecutorInputs {\n method: HTTPMethod;\n url: string;\n headers: Record<string, string>;\n params: Record<string, string>;\n bodyType: HTTPBodyType;\n body: string;\n retryTimes: number;\n timeout: number;\n}\n\nexport class HTTPExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.HTTP;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = this.parseInputs(context);\n const response = await this.request(inputs);\n\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n const responseBody = await response.text();\n\n return {\n outputs: {\n headers: responseHeaders,\n statusCode: response.status,\n body: responseBody,\n },\n };\n }\n\n private async request(inputs: HTTPExecutorInputs): Promise<Response> {\n const { method, url, headers, params, bodyType, body, retryTimes, timeout } = inputs;\n\n // Build URL with query parameters\n const urlWithParams = this.buildUrlWithParams(url, params);\n\n // Prepare request options\n const requestOptions: RequestInit = {\n method,\n headers: this.prepareHeaders(headers, bodyType),\n signal: AbortSignal.timeout(timeout),\n };\n\n // Add body if method supports it\n if (method !== 'GET' && method !== 'HEAD' && body) {\n requestOptions.body = this.prepareBody(body, bodyType);\n }\n\n // Implement retry logic\n let lastError: Error | null = null;\n for (let attempt = 0; attempt <= retryTimes; attempt++) {\n try {\n const response = await fetch(urlWithParams, requestOptions);\n return response;\n } catch (error) {\n lastError = error as Error;\n if (attempt < retryTimes) {\n // Wait before retry (exponential backoff)\n await new Promise((resolve) => setTimeout(resolve, Math.pow(2, attempt) * 1000));\n }\n }\n }\n\n throw lastError || new Error('HTTP request failed after all retry attempts');\n }\n\n private parseInputs(context: ExecutionContext): HTTPExecutorInputs {\n const httpNode = context.node as INode<HTTPNodeSchema['data']>;\n const method = httpNode.data.api.method;\n const urlVariable = context.runtime.state.parseTemplate(httpNode.data.api.url);\n if (!urlVariable) {\n throw new Error('HTTP url is required');\n }\n const url = urlVariable.value;\n const headers = context.runtime.state.parseInputs({\n values: httpNode.data.headersValues,\n declare: httpNode.data.headers,\n });\n const params = context.runtime.state.parseInputs({\n values: httpNode.data.paramsValues,\n declare: httpNode.data.params,\n });\n const body = this.parseBody(context);\n const retryTimes = httpNode.data.timeout.retryTimes;\n const timeout = httpNode.data.timeout.timeout;\n const inputs = {\n method,\n url,\n headers,\n params,\n bodyType: body.bodyType,\n body: body.body,\n retryTimes,\n timeout,\n };\n context.snapshot.update({\n inputs: JSON.parse(JSON.stringify(inputs)),\n });\n return inputs;\n }\n\n private parseBody(context: ExecutionContext): {\n bodyType: HTTPBodyType;\n body: string;\n } {\n const httpNode = context.node as INode<HTTPNodeSchema['data']>;\n const bodyType = httpNode.data.body.bodyType;\n if (bodyType === HTTPBodyType.None) {\n return {\n bodyType,\n body: '',\n };\n }\n if (bodyType === HTTPBodyType.JSON) {\n if (!httpNode.data.body.json) {\n throw new Error('HTTP json body is required');\n }\n const jsonVariable = context.runtime.state.parseTemplate(httpNode.data.body.json);\n if (!jsonVariable) {\n throw new Error('HTTP json body is required');\n }\n return {\n bodyType,\n body: jsonVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.FormData) {\n if (!httpNode.data.body.formData || !httpNode.data.body.formDataValues) {\n throw new Error('HTTP form-data body is required');\n }\n\n const formData = context.runtime.state.parseInputs({\n values: httpNode.data.body.formDataValues,\n declare: httpNode.data.body.formData,\n });\n return {\n bodyType,\n body: JSON.stringify(formData),\n };\n }\n if (bodyType === HTTPBodyType.RawText) {\n if (!httpNode.data.body.json) {\n throw new Error('HTTP json body is required');\n }\n const jsonVariable = context.runtime.state.parseTemplate(httpNode.data.body.json);\n if (!jsonVariable) {\n throw new Error('HTTP json body is required');\n }\n return {\n bodyType,\n body: jsonVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.Binary) {\n if (!httpNode.data.body.binary) {\n throw new Error('HTTP binary body is required');\n }\n const binaryVariable = context.runtime.state.parseTemplate(httpNode.data.body.binary);\n if (!binaryVariable) {\n throw new Error('HTTP binary body is required');\n }\n return {\n bodyType,\n body: binaryVariable.value,\n };\n }\n if (bodyType === HTTPBodyType.XWwwFormUrlencoded) {\n if (!httpNode.data.body.xWwwFormUrlencoded || !httpNode.data.body.xWwwFormUrlencodedValues) {\n throw new Error('HTTP x-www-form-urlencoded body is required');\n }\n const xWwwFormUrlencoded = context.runtime.state.parseInputs({\n values: httpNode.data.body.xWwwFormUrlencodedValues,\n declare: httpNode.data.body.xWwwFormUrlencoded,\n });\n return {\n bodyType,\n body: JSON.stringify(xWwwFormUrlencoded),\n };\n }\n throw new Error(`HTTP invalid body type \"${bodyType}\"`);\n }\n\n private buildUrlWithParams(url: string, params: Record<string, string>): string {\n const urlObj = new URL(url);\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null && value !== '') {\n urlObj.searchParams.set(key, value);\n }\n });\n return urlObj.toString();\n }\n\n private prepareHeaders(\n headers: Record<string, string>,\n bodyType: HTTPBodyType\n ): Record<string, string> {\n const preparedHeaders = { ...headers };\n\n // Set Content-Type based on body type if not already set\n if (!preparedHeaders['Content-Type'] && !preparedHeaders['content-type']) {\n switch (bodyType) {\n case HTTPBodyType.JSON:\n preparedHeaders['Content-Type'] = 'application/json';\n break;\n case HTTPBodyType.FormData:\n // Don't set Content-Type for FormData, let browser set it with boundary\n break;\n case HTTPBodyType.XWwwFormUrlencoded:\n preparedHeaders['Content-Type'] = 'application/x-www-form-urlencoded';\n break;\n case HTTPBodyType.RawText:\n preparedHeaders['Content-Type'] = 'text/plain';\n break;\n case HTTPBodyType.Binary:\n preparedHeaders['Content-Type'] = 'application/octet-stream';\n break;\n }\n }\n\n return preparedHeaders;\n }\n\n private prepareBody(body: string, bodyType: HTTPBodyType): string | FormData {\n switch (bodyType) {\n case HTTPBodyType.JSON:\n return body;\n case HTTPBodyType.FormData:\n const formData = new FormData();\n try {\n const data = JSON.parse(body);\n Object.entries(data).forEach(([key, value]) => {\n formData.append(key, String(value));\n });\n } catch (error) {\n throw new Error('Invalid FormData body format');\n }\n return formData;\n case HTTPBodyType.XWwwFormUrlencoded:\n try {\n const data = JSON.parse(body);\n const params = new URLSearchParams();\n Object.entries(data).forEach(([key, value]) => {\n params.append(key, String(value));\n });\n return params.toString();\n } catch (error) {\n throw new Error('Invalid x-www-form-urlencoded body format');\n }\n case HTTPBodyType.RawText:\n case HTTPBodyType.Binary:\n default:\n return body;\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class EndExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.End;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.ioCenter.setOutputs(context.inputs);\n return {\n outputs: context.inputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class BlockStartExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.BlockStart;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: {},\n };\n }\n}\n\nexport class BlockEndExecutor implements INodeExecutor {\n public type = FlowGramNode.BlockEnd;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class ContinueExecutor implements INodeExecutor {\n public type = FlowGramNode.Continue;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.cache.set('loop-continue', true);\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n ConditionItem,\n ConditionOperator,\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n WorkflowVariableType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeType } from '@infra/index';\nimport { ConditionValue, Conditions } from './type';\nimport { conditionRules } from './rules';\nimport { conditionHandlers } from './handlers';\n\nexport class ConditionExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Condition;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const conditions: Conditions = context.node.data?.conditions;\n if (!conditions) {\n return {\n outputs: {},\n };\n }\n const parsedConditions = conditions\n .map((item) => this.parseCondition(item, context))\n .filter((item) => this.checkCondition(item));\n const activatedCondition = parsedConditions.find((item) => this.handleCondition(item));\n if (!activatedCondition) {\n return {\n outputs: {},\n branch: 'else',\n };\n }\n return {\n outputs: {},\n branch: activatedCondition.key,\n };\n }\n\n private parseCondition(item: ConditionItem, context: ExecutionContext): ConditionValue {\n const { key, value } = item;\n const { left, operator, right } = value;\n const parsedLeft = context.runtime.state.parseRef(left);\n const leftValue = parsedLeft?.value ?? null;\n const leftType = parsedLeft?.type ?? WorkflowVariableType.Null;\n const expectedRightType = this.getRuleType({ leftType, operator });\n const parsedRight = Boolean(right)\n ? context.runtime.state.parseFlowValue({\n flowValue: right,\n declareType: expectedRightType,\n })\n : null;\n const rightValue = parsedRight?.value ?? null;\n const rightType = parsedRight?.type ?? WorkflowVariableType.Null;\n return {\n key,\n leftValue,\n leftType,\n rightValue,\n rightType,\n operator,\n };\n }\n\n private checkCondition(condition: ConditionValue): boolean {\n const rule = conditionRules[condition.leftType];\n if (isNil(rule)) {\n throw new Error(`Condition left type \"${condition.leftType}\" is not supported`);\n }\n const ruleType = rule[condition.operator];\n if (isNil(ruleType)) {\n throw new Error(\n `Condition left type \"${condition.leftType}\" has no operator \"${condition.operator}\"`\n );\n }\n if (!WorkflowRuntimeType.isTypeEqual(ruleType, condition.rightType)) {\n return false;\n }\n return true;\n }\n\n private handleCondition(condition: ConditionValue): boolean {\n const handler = conditionHandlers[condition.leftType];\n if (!handler) {\n throw new Error(`Condition left type ${condition.leftType} is not supported`);\n }\n const isActive = handler(condition);\n return isActive;\n }\n\n private getRuleType(params: {\n leftType: WorkflowVariableType;\n operator: ConditionOperator;\n }): WorkflowVariableType {\n const { leftType, operator } = params;\n const rule = conditionRules[leftType];\n if (isNil(rule)) {\n return WorkflowVariableType.Null;\n }\n const ruleType = rule[operator];\n if (isNil(ruleType)) {\n return WorkflowVariableType.Null;\n }\n return ruleType;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ConditionOperator, WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionRules } from './type';\n\nexport const conditionRules: ConditionRules = {\n [WorkflowVariableType.String]: {\n [ConditionOperator.EQ]: WorkflowVariableType.String,\n [ConditionOperator.NEQ]: WorkflowVariableType.String,\n [ConditionOperator.CONTAINS]: WorkflowVariableType.String,\n [ConditionOperator.NOT_CONTAINS]: WorkflowVariableType.String,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.String,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.String,\n },\n [WorkflowVariableType.Number]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Number,\n [ConditionOperator.NEQ]: WorkflowVariableType.Number,\n [ConditionOperator.GT]: WorkflowVariableType.Number,\n [ConditionOperator.GTE]: WorkflowVariableType.Number,\n [ConditionOperator.LT]: WorkflowVariableType.Number,\n [ConditionOperator.LTE]: WorkflowVariableType.Number,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Integer]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Integer,\n [ConditionOperator.NEQ]: WorkflowVariableType.Integer,\n [ConditionOperator.GT]: WorkflowVariableType.Integer,\n [ConditionOperator.GTE]: WorkflowVariableType.Integer,\n [ConditionOperator.LT]: WorkflowVariableType.Integer,\n [ConditionOperator.LTE]: WorkflowVariableType.Integer,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Boolean]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Boolean,\n [ConditionOperator.NEQ]: WorkflowVariableType.Boolean,\n [ConditionOperator.IS_TRUE]: WorkflowVariableType.Null,\n [ConditionOperator.IS_FALSE]: WorkflowVariableType.Null,\n [ConditionOperator.IN]: WorkflowVariableType.Array,\n [ConditionOperator.NIN]: WorkflowVariableType.Array,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Object]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Map]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.DateTime]: {\n [ConditionOperator.EQ]: WorkflowVariableType.DateTime,\n [ConditionOperator.NEQ]: WorkflowVariableType.DateTime,\n [ConditionOperator.GT]: WorkflowVariableType.DateTime,\n [ConditionOperator.GTE]: WorkflowVariableType.DateTime,\n [ConditionOperator.LT]: WorkflowVariableType.DateTime,\n [ConditionOperator.LTE]: WorkflowVariableType.DateTime,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Array]: {\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n [WorkflowVariableType.Null]: {\n [ConditionOperator.EQ]: WorkflowVariableType.Null,\n [ConditionOperator.IS_EMPTY]: WorkflowVariableType.Null,\n [ConditionOperator.IS_NOT_EMPTY]: WorkflowVariableType.Null,\n },\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionStringHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as string;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as string;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as string;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.CONTAINS) {\n const rightValue = condition.rightValue as string;\n return leftValue.includes(rightValue);\n }\n if (operator === ConditionOperator.NOT_CONTAINS) {\n const rightValue = condition.rightValue as string;\n return !leftValue.includes(rightValue);\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as string[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as string[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionObjectHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionNumberHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as number;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as number;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as number;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.GT) {\n const rightValue = condition.rightValue as number;\n return leftValue > rightValue;\n }\n if (operator === ConditionOperator.GTE) {\n const rightValue = condition.rightValue as number;\n return leftValue >= rightValue;\n }\n if (operator === ConditionOperator.LT) {\n const rightValue = condition.rightValue as number;\n return leftValue < rightValue;\n }\n if (operator === ConditionOperator.LTE) {\n const rightValue = condition.rightValue as number;\n return leftValue <= rightValue;\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as number[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as number[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionNullHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as unknown | null;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n return isNil(leftValue) && isNil(condition.rightValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionMapHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\n// Convert ISO string to Date object for comparison\nconst parseDateTime = (value: string | Date): Date => {\n if (value instanceof Date) {\n return value;\n }\n return new Date(value);\n};\n\nexport const conditionDateTimeHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as string;\n\n // Handle empty checks first\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n\n // For comparison operations, parse both datetime values\n const leftTime = parseDateTime(leftValue).getTime();\n const rightValue = condition.rightValue as string;\n const rightTime = parseDateTime(rightValue).getTime();\n\n if (operator === ConditionOperator.EQ) {\n return leftTime === rightTime;\n }\n if (operator === ConditionOperator.NEQ) {\n return leftTime !== rightTime;\n }\n if (operator === ConditionOperator.GT) {\n return leftTime > rightTime;\n }\n if (operator === ConditionOperator.GTE) {\n return leftTime >= rightTime;\n }\n if (operator === ConditionOperator.LT) {\n return leftTime < rightTime;\n }\n if (operator === ConditionOperator.LTE) {\n return leftTime <= rightTime;\n }\n\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionBooleanHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as boolean;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.EQ) {\n const rightValue = condition.rightValue as boolean;\n return leftValue === rightValue;\n }\n if (operator === ConditionOperator.NEQ) {\n const rightValue = condition.rightValue as boolean;\n return leftValue !== rightValue;\n }\n if (operator === ConditionOperator.IS_TRUE) {\n return leftValue === true;\n }\n if (operator === ConditionOperator.IS_FALSE) {\n return leftValue === false;\n }\n if (operator === ConditionOperator.IN) {\n const rightValue = condition.rightValue as boolean[];\n return rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.NIN) {\n const rightValue = condition.rightValue as boolean[];\n return !rightValue.includes(leftValue);\n }\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport { ConditionOperator } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandler } from '../type';\n\nexport const conditionArrayHandler: ConditionHandler = (condition) => {\n const { operator } = condition;\n const leftValue = condition.leftValue as object;\n // Switch case share scope, so we need to use if else here\n if (operator === ConditionOperator.IS_EMPTY) {\n return isNil(leftValue);\n }\n if (operator === ConditionOperator.IS_NOT_EMPTY) {\n return !isNil(leftValue);\n }\n return false;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowVariableType } from '@flowgram.ai/runtime-interface';\n\nimport { ConditionHandlers } from '../type';\nimport { conditionStringHandler } from './string';\nimport { conditionObjectHandler } from './object';\nimport { conditionNumberHandler } from './number';\nimport { conditionNullHandler } from './null';\nimport { conditionMapHandler } from './map';\nimport { conditionDateTimeHandler } from './datetime';\nimport { conditionBooleanHandler } from './boolean';\nimport { conditionArrayHandler } from './array';\n\nexport const conditionHandlers: ConditionHandlers = {\n [WorkflowVariableType.String]: conditionStringHandler,\n [WorkflowVariableType.Number]: conditionNumberHandler,\n [WorkflowVariableType.Integer]: conditionNumberHandler,\n [WorkflowVariableType.Boolean]: conditionBooleanHandler,\n [WorkflowVariableType.Object]: conditionObjectHandler,\n [WorkflowVariableType.Map]: conditionMapHandler,\n [WorkflowVariableType.Array]: conditionArrayHandler,\n [WorkflowVariableType.DateTime]: conditionDateTimeHandler,\n [WorkflowVariableType.Null]: conditionNullHandler,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n CodeNodeSchema,\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport interface CodeExecutorInputs {\n params: Record<string, any>;\n script: {\n language: 'javascript';\n content: string;\n };\n}\n\nexport class CodeExecutor implements INodeExecutor {\n public readonly type = FlowGramNode.Code;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const inputs = this.parseInputs(context);\n if (inputs.script.language === 'javascript') {\n return this.javascript(inputs);\n }\n throw new Error(`Unsupported code language \"${inputs.script.language}\"`);\n }\n\n private parseInputs(context: ExecutionContext): CodeExecutorInputs {\n const codeNode = context.node as INode<CodeNodeSchema['data']>;\n const params = context.inputs;\n const { language, content } = codeNode.data.script;\n if (!content) {\n throw new Error('Code content is required');\n }\n return {\n params,\n script: {\n language,\n content,\n },\n };\n }\n\n private async javascript(inputs: CodeExecutorInputs): Promise<ExecutionResult> {\n // Extract script content and inputs\n const { params = {}, script } = inputs;\n\n try {\n // Create a safe execution environment with basic restrictions\n const executeCode = new Function(\n 'params',\n `\n 'use strict';\n\n ${script.content}\n\n // Ensure main function exists\n if (typeof main !== 'function') {\n throw new Error('main function is required in the script');\n }\n\n // Execute main function with params\n return main({ params });\n `\n );\n\n // Execute with timeout protection (1 minute)\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => {\n reject(new Error('Code execution timeout: exceeded 1 minute'));\n }, 1000 * 60);\n });\n\n // Execute the code with input parameters and timeout\n const result = await Promise.race([executeCode(params), timeoutPromise]);\n\n // Ensure result is an object\n const outputs =\n result && typeof result === 'object' && !Array.isArray(result) ? result : { result };\n\n return {\n outputs,\n };\n } catch (error: any) {\n throw new Error(`Code execution failed: ${error.message}`);\n }\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ExecutionContext,\n ExecutionResult,\n FlowGramNode,\n INodeExecutor,\n} from '@flowgram.ai/runtime-interface';\n\nexport class BreakExecutor implements INodeExecutor {\n public type = FlowGramNode.Break;\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n context.runtime.cache.set('loop-break', true);\n return {\n outputs: {},\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { INodeExecutorFactory } from '@flowgram.ai/runtime-interface';\n\nimport { StartExecutor } from './start';\nimport { LoopExecutor } from './loop';\nimport { LLMExecutor } from './llm';\nimport { HTTPExecutor } from './http';\nimport { EndExecutor } from './end';\nimport { BlockEndExecutor, BlockStartExecutor } from './empty';\nimport { ContinueExecutor } from './continue';\nimport { ConditionExecutor } from './condition';\nimport { CodeExecutor } from './code';\nimport { BreakExecutor } from './break';\n\nexport const WorkflowRuntimeNodeExecutors: INodeExecutorFactory[] = [\n StartExecutor,\n EndExecutor,\n LLMExecutor,\n ConditionExecutor,\n LoopExecutor,\n BlockStartExecutor,\n BlockEndExecutor,\n HTTPExecutor,\n CodeExecutor,\n BreakExecutor,\n ContinueExecutor,\n];\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\nexport const cycleDetection = (schema: WorkflowSchema) => {\n const { nodes, edges } = schema;\n\n // Build adjacency list for the graph\n const adjacencyList = new Map<string, string[]>();\n const nodeIds = new Set(nodes.map((node) => node.id));\n\n // Initialize adjacency list\n nodeIds.forEach((nodeId) => {\n adjacencyList.set(nodeId, []);\n });\n\n // Populate adjacency list with edges\n edges.forEach((edge) => {\n const sourceList = adjacencyList.get(edge.sourceNodeID);\n if (sourceList) {\n sourceList.push(edge.targetNodeID);\n }\n });\n\n enum NodeStatus {\n Unvisited,\n Visiting,\n Visited,\n }\n\n const nodeStatusMap = new Map<string, NodeStatus>();\n\n // Initialize all nodes as WHITE\n nodeIds.forEach((nodeId) => {\n nodeStatusMap.set(nodeId, NodeStatus.Unvisited);\n });\n\n const detectCycleFromNode = (nodeId: string): boolean => {\n nodeStatusMap.set(nodeId, NodeStatus.Visiting);\n\n const neighbors = adjacencyList.get(nodeId) || [];\n for (const neighbor of neighbors) {\n const neighborColor = nodeStatusMap.get(neighbor);\n\n if (neighborColor === NodeStatus.Visiting) {\n // Back edge found - cycle detected\n return true;\n }\n\n if (neighborColor === NodeStatus.Unvisited && detectCycleFromNode(neighbor)) {\n return true;\n }\n }\n\n nodeStatusMap.set(nodeId, NodeStatus.Visited);\n return false;\n };\n\n // Check for cycles starting from each unvisited node\n for (const nodeId of nodeIds) {\n if (nodeStatusMap.get(nodeId) === NodeStatus.Unvisited) {\n if (detectCycleFromNode(nodeId)) {\n throw new Error('Workflow schema contains a cycle, which is not allowed');\n }\n }\n }\n\n // Recursively check cycles in nested blocks\n nodes.forEach((node) => {\n if (node.blocks) {\n cycleDetection({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema, FlowGramNode } from '@flowgram.ai/runtime-interface';\n\nconst blockStartEndNode = (schema: WorkflowSchema) => {\n // Optimize performance by using single traversal instead of two separate filter operations\n const { blockStartNodes, blockEndNodes } = schema.nodes.reduce(\n (acc, node) => {\n if (node.type === FlowGramNode.BlockStart) {\n acc.blockStartNodes.push(node);\n } else if (node.type === FlowGramNode.BlockEnd) {\n acc.blockEndNodes.push(node);\n }\n return acc;\n },\n { blockStartNodes: [] as typeof schema.nodes, blockEndNodes: [] as typeof schema.nodes }\n );\n if (!blockStartNodes.length && !blockEndNodes.length) {\n throw new Error('Workflow block schema must have a block-start node and a block-end node');\n }\n if (!blockStartNodes.length) {\n throw new Error('Workflow block schema must have a block-start node');\n }\n if (!blockEndNodes.length) {\n throw new Error('Workflow block schema must have an block-end node');\n }\n if (blockStartNodes.length > 1) {\n throw new Error('Workflow block schema must have only one block-start node');\n }\n if (blockEndNodes.length > 1) {\n throw new Error('Workflow block schema must have only one block-end node');\n }\n schema.nodes.forEach((node) => {\n if (node.blocks) {\n blockStartEndNode({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n\nexport const startEndNode = (schema: WorkflowSchema) => {\n // Optimize performance by using single traversal instead of two separate filter operations\n const { startNodes, endNodes } = schema.nodes.reduce(\n (acc, node) => {\n if (node.type === FlowGramNode.Start) {\n acc.startNodes.push(node);\n } else if (node.type === FlowGramNode.End) {\n acc.endNodes.push(node);\n }\n return acc;\n },\n { startNodes: [] as typeof schema.nodes, endNodes: [] as typeof schema.nodes }\n );\n if (!startNodes.length && !endNodes.length) {\n throw new Error('Workflow schema must have a start node and an end node');\n }\n if (!startNodes.length) {\n throw new Error('Workflow schema must have a start node');\n }\n if (!endNodes.length) {\n throw new Error('Workflow schema must have an end node');\n }\n if (startNodes.length > 1) {\n throw new Error('Workflow schema must have only one start node');\n }\n if (endNodes.length > 1) {\n throw new Error('Workflow schema must have only one end node');\n }\n schema.nodes.forEach((node) => {\n if (node.blocks) {\n blockStartEndNode({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\nexport const edgeSourceTargetExist = (schema: WorkflowSchema) => {\n const { nodes, edges } = schema;\n const nodeSet = new Set(nodes.map((node) => node.id));\n edges.forEach((edge) => {\n if (!nodeSet.has(edge.sourceNodeID)) {\n throw new Error(`Workflow schema edge source node \"${edge.sourceNodeID}\" not exist`);\n }\n if (!nodeSet.has(edge.targetNodeID)) {\n throw new Error(`Workflow schema edge target node \"${edge.targetNodeID}\" not exist`);\n }\n });\n nodes.forEach((node) => {\n if (node.blocks) {\n edgeSourceTargetExist({\n nodes: node.blocks,\n edges: node.edges ?? [],\n });\n }\n });\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowSchema } from '@flowgram.ai/runtime-interface';\n\n/**\n * Validates the basic format and structure of a workflow schema\n * Ensures all required fields are present and have correct types\n */\nexport const schemaFormat = (schema: WorkflowSchema): void => {\n // Check if schema is a valid object\n if (!schema || typeof schema !== 'object') {\n throw new Error('Workflow schema must be a valid object');\n }\n\n // Check if nodes array exists and is valid\n if (!Array.isArray(schema.nodes)) {\n throw new Error('Workflow schema must have a valid nodes array');\n }\n\n // Check if edges array exists and is valid\n if (!Array.isArray(schema.edges)) {\n throw new Error('Workflow schema must have a valid edges array');\n }\n\n // Validate each node structure\n schema.nodes.forEach((node, index) => {\n validateNodeFormat(node, `nodes[${index}]`);\n });\n\n // Validate each edge structure\n schema.edges.forEach((edge, index) => {\n validateEdgeFormat(edge, `edges[${index}]`);\n });\n\n // Recursively validate nested blocks\n schema.nodes.forEach((node, nodeIndex) => {\n if (node.blocks) {\n if (!Array.isArray(node.blocks)) {\n throw new Error(`Node nodes[${nodeIndex}].blocks must be an array`);\n }\n\n const nestedSchema = {\n nodes: node.blocks,\n edges: node.edges || [],\n };\n\n schemaFormat(nestedSchema);\n }\n });\n};\n\n/**\n * Validates the format of a single node\n */\nconst validateNodeFormat = (node: any, path: string): void => {\n if (!node || typeof node !== 'object') {\n throw new Error(`${path} must be a valid object`);\n }\n\n // Check required fields\n if (typeof node.id !== 'string' || !node.id.trim()) {\n throw new Error(`${path}.id must be a non-empty string`);\n }\n\n if (typeof node.type !== 'string' || !node.type.trim()) {\n throw new Error(`${path}.type must be a non-empty string`);\n }\n\n if (!node.meta || typeof node.meta !== 'object') {\n throw new Error(`${path}.meta must be a valid object`);\n }\n\n if (!node.data || typeof node.data !== 'object') {\n throw new Error(`${path}.data must be a valid object`);\n }\n\n // Validate optional fields if present\n if (node.blocks !== undefined && !Array.isArray(node.blocks)) {\n throw new Error(`${path}.blocks must be an array if present`);\n }\n\n if (node.edges !== undefined && !Array.isArray(node.edges)) {\n throw new Error(`${path}.edges must be an array if present`);\n }\n\n // Validate data.inputs and data.outputs if present\n if (\n node.data.inputs !== undefined &&\n (typeof node.data.inputs !== 'object' || node.data.inputs === null)\n ) {\n throw new Error(`${path}.data.inputs must be a valid object if present`);\n }\n\n if (\n node.data.outputs !== undefined &&\n (typeof node.data.outputs !== 'object' || node.data.outputs === null)\n ) {\n throw new Error(`${path}.data.outputs must be a valid object if present`);\n }\n\n if (\n node.data.inputsValues !== undefined &&\n (typeof node.data.inputsValues !== 'object' || node.data.inputsValues === null)\n ) {\n throw new Error(`${path}.data.inputsValues must be a valid object if present`);\n }\n\n if (node.data.title !== undefined && typeof node.data.title !== 'string') {\n throw new Error(`${path}.data.title must be a string if present`);\n }\n};\n\n/**\n * Validates the format of a single edge\n */\nconst validateEdgeFormat = (edge: any, path: string): void => {\n if (!edge || typeof edge !== 'object') {\n throw new Error(`${path} must be a valid object`);\n }\n\n // Check required fields\n if (typeof edge.sourceNodeID !== 'string' || !edge.sourceNodeID.trim()) {\n throw new Error(`${path}.sourceNodeID must be a non-empty string`);\n }\n\n if (typeof edge.targetNodeID !== 'string' || !edge.targetNodeID.trim()) {\n throw new Error(`${path}.targetNodeID must be a non-empty string`);\n }\n\n // Validate optional fields if present\n if (edge.sourcePortID !== undefined && typeof edge.sourcePortID !== 'string') {\n throw new Error(`${path}.sourcePortID must be a string if present`);\n }\n\n if (edge.targetPortID !== undefined && typeof edge.targetPortID !== 'string') {\n throw new Error(`${path}.targetPortID must be a string if present`);\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowSchema,\n IValidation,\n ValidationResult,\n InvokeParams,\n IJsonSchema,\n FlowGramNode,\n} from '@flowgram.ai/runtime-interface';\n\nimport { JSONSchemaValidator } from '@infra/index';\nimport { cycleDetection, edgeSourceTargetExist, startEndNode, schemaFormat } from './validators';\n\nexport class WorkflowRuntimeValidation implements IValidation {\n public invoke(params: InvokeParams): ValidationResult {\n const { schema, inputs } = params;\n const schemaValidationResult = this.schema(schema);\n if (!schemaValidationResult.valid) {\n return schemaValidationResult;\n }\n const inputsValidationResult = this.inputs(this.getWorkflowInputsDeclare(schema), inputs);\n if (!inputsValidationResult.valid) {\n return inputsValidationResult;\n }\n return {\n valid: true,\n };\n }\n\n private schema(schema: WorkflowSchema): ValidationResult {\n const errors: string[] = [];\n\n // Run all validations concurrently and collect errors\n const validations = [\n () => schemaFormat(schema),\n () => cycleDetection(schema),\n () => edgeSourceTargetExist(schema),\n () => startEndNode(schema),\n ];\n\n // Execute all validations and collect any errors\n validations.forEach((validation) => {\n try {\n validation();\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n });\n\n return {\n valid: errors.length === 0,\n errors: errors.length > 0 ? errors : undefined,\n };\n }\n\n private inputs(inputsSchema: IJsonSchema, inputs: Record<string, unknown>): ValidationResult {\n const { result, errorMessage } = JSONSchemaValidator({\n schema: inputsSchema,\n value: inputs,\n });\n if (!result) {\n const error = `JSON Schema validation failed: ${errorMessage}`;\n return {\n valid: false,\n errors: [error],\n };\n }\n return {\n valid: true,\n };\n }\n\n private getWorkflowInputsDeclare(schema: WorkflowSchema): IJsonSchema {\n const startNode = schema.nodes.find((node) => node.type === FlowGramNode.Start)!;\n if (!startNode) {\n throw new Error('Workflow schema must have a start node');\n }\n return startNode.data.outputs;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramNode } from '@flowgram.ai/runtime-interface';\nimport {\n ExecutionContext,\n ExecutionResult,\n IExecutor,\n INodeExecutor,\n INodeExecutorFactory,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeExecutor implements IExecutor {\n private nodeExecutors: Map<FlowGramNode, INodeExecutor> = new Map();\n\n constructor(nodeExecutors: INodeExecutorFactory[]) {\n // register node executors\n nodeExecutors.forEach((executor) => {\n this.register(new executor());\n });\n }\n\n public register(executor: INodeExecutor): void {\n this.nodeExecutors.set(executor.type, executor);\n }\n\n public async execute(context: ExecutionContext): Promise<ExecutionResult> {\n const nodeType = context.node.type;\n const nodeExecutor = this.nodeExecutors.get(nodeType);\n if (!nodeExecutor) {\n throw new Error(`No executor found for node type ${nodeType}`);\n }\n const output = await nodeExecutor.execute(context);\n return output;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n IContext,\n ITask,\n TaskParams,\n WorkflowOutputs,\n WorkflowStatus,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeTask implements ITask {\n public readonly id: string;\n\n public readonly processing: Promise<WorkflowOutputs>;\n\n public readonly context: IContext;\n\n constructor(params: TaskParams) {\n this.id = uuid();\n this.context = params.context;\n this.processing = params.processing;\n }\n\n public cancel(): void {\n this.context.statusCenter.workflow.cancel();\n const cancelNodeIDs = this.context.statusCenter.getStatusNodeIDs(WorkflowStatus.Processing);\n cancelNodeIDs.forEach((nodeID) => {\n this.context.statusCenter.nodeStatus(nodeID).cancel();\n });\n }\n\n public static create(params: TaskParams): WorkflowRuntimeTask {\n return new WorkflowRuntimeTask(params);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IMessage, MessageData, WorkflowMessageType } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeMessage {\n export const create = (\n params: MessageData & {\n type: WorkflowMessageType;\n }\n ): IMessage => {\n const message = {\n id: uuid(),\n ...params,\n };\n if (!params.timestamp) {\n message.timestamp = Date.now();\n }\n return message as IMessage;\n };\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n IMessage,\n IMessageCenter,\n MessageData,\n WorkflowMessages,\n WorkflowMessageType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeMessage } from '../message-value-object';\n\nexport class WorkflowRuntimeMessageCenter implements IMessageCenter {\n private messages: WorkflowMessages;\n\n public init(): void {\n this.messages = {\n [WorkflowMessageType.Log]: [],\n [WorkflowMessageType.Info]: [],\n [WorkflowMessageType.Debug]: [],\n [WorkflowMessageType.Error]: [],\n [WorkflowMessageType.Warn]: [],\n };\n }\n\n public dispose(): void {}\n\n public log(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Log,\n ...data,\n });\n this.messages[WorkflowMessageType.Log].push(message);\n return message;\n }\n\n public info(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Info,\n ...data,\n });\n this.messages[WorkflowMessageType.Info].push(message);\n return message;\n }\n\n public debug(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Debug,\n ...data,\n });\n this.messages[WorkflowMessageType.Debug].push(message);\n return message;\n }\n\n public error(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Error,\n ...data,\n });\n this.messages[WorkflowMessageType.Error].push(message);\n return message;\n }\n\n public warn(data: MessageData): IMessage {\n const message = WorkflowRuntimeMessage.create({\n type: WorkflowMessageType.Warn,\n ...data,\n });\n this.messages[WorkflowMessageType.Warn].push(message);\n return message;\n }\n\n public export(): WorkflowMessages {\n return {\n [WorkflowMessageType.Log]: this.messages[WorkflowMessageType.Log].slice(),\n [WorkflowMessageType.Info]: this.messages[WorkflowMessageType.Info].slice(),\n [WorkflowMessageType.Debug]: this.messages[WorkflowMessageType.Debug].slice(),\n [WorkflowMessageType.Error]: this.messages[WorkflowMessageType.Error].slice(),\n [WorkflowMessageType.Warn]: this.messages[WorkflowMessageType.Warn].slice(),\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ICache } from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeCache implements ICache {\n private map: Map<string, any>;\n\n public init(): void {\n this.map = new Map();\n }\n\n public dispose(): void {\n this.map.clear();\n }\n\n public get(key: string): any {\n return this.map.get(key);\n }\n\n public set(key: string, value: any): this {\n this.map.set(key, value);\n return this;\n }\n\n public delete(key: string): boolean {\n return this.map.delete(key);\n }\n\n public has(key: string): boolean {\n return this.map.has(key);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { get, set } from 'lodash-es';\nimport {\n WorkflowVariableType,\n IVariableStore,\n IVariable,\n IVariableParseResult,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid, WorkflowRuntimeType } from '@infra/utils';\nimport { WorkflowRuntimeVariable } from '../variable-value-object';\n\nexport class WorkflowRuntimeVariableStore implements IVariableStore {\n public readonly id: string;\n\n private parent?: WorkflowRuntimeVariableStore;\n\n constructor() {\n this.id = uuid();\n }\n\n public store: Map<string, Map<string, IVariable>>;\n\n public init(): void {\n this.store = new Map();\n }\n\n public dispose(): void {\n this.store.clear();\n }\n\n public setParent(parent: IVariableStore): void {\n this.parent = parent as WorkflowRuntimeVariableStore;\n }\n\n public globalGet(nodeID: string): Map<string, IVariable> | undefined {\n const store = this.store.get(nodeID);\n if (!store && this.parent) {\n return this.parent.globalGet(nodeID);\n }\n return store;\n }\n\n public setVariable(params: {\n nodeID: string;\n key: string;\n value: Object;\n type: WorkflowVariableType;\n itemsType?: WorkflowVariableType;\n }): void {\n const { nodeID, key, value, type, itemsType } = params;\n if (!this.store.has(nodeID)) {\n // create node store\n this.store.set(nodeID, new Map());\n }\n const nodeStore = this.store.get(nodeID)!;\n // create variable store\n const variable = WorkflowRuntimeVariable.create({\n nodeID,\n key,\n value,\n type, // TODO check type\n itemsType, // TODO check is array\n });\n nodeStore.set(key, variable);\n }\n\n public setValue(params: {\n nodeID: string;\n variableKey: string;\n variablePath?: string[];\n value: Object;\n }): void {\n const { nodeID, variableKey, variablePath, value } = params;\n if (!this.store.has(nodeID)) {\n // create node store\n this.store.set(nodeID, new Map());\n }\n const nodeStore = this.store.get(nodeID)!;\n if (!nodeStore.has(variableKey)) {\n // create variable store\n const variable = WorkflowRuntimeVariable.create({\n nodeID,\n key: variableKey,\n value: {},\n type: WorkflowVariableType.Object,\n });\n nodeStore.set(variableKey, variable);\n }\n const variable = nodeStore.get(variableKey)!;\n if (!variablePath) {\n variable.value = value;\n return;\n }\n set(variable.value, variablePath, value);\n }\n\n public getValue<T = unknown>(params: {\n nodeID: string;\n variableKey: string;\n variablePath?: string[];\n }): IVariableParseResult<T> | null {\n const { nodeID, variableKey, variablePath } = params;\n const variable = this.globalGet(nodeID)?.get(variableKey);\n if (!variable) {\n return null;\n }\n if (!variablePath || variablePath.length === 0) {\n return {\n value: variable.value as T,\n type: variable.type,\n itemsType: variable.itemsType,\n };\n }\n const value = get(variable.value, variablePath) as T;\n const type = WorkflowRuntimeType.getWorkflowType(value);\n if (!type) {\n return null;\n }\n if (type === WorkflowVariableType.Array && Array.isArray(value)) {\n const itemsType = WorkflowRuntimeType.getWorkflowType(value[0]);\n if (!itemsType) {\n return null;\n }\n return {\n value,\n type,\n itemsType,\n };\n }\n return {\n value,\n type,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IVariable, VOData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeVariable {\n export const create = (params: VOData<IVariable>): IVariable => ({\n id: uuid(),\n ...params,\n });\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IStatus, StatusData, WorkflowStatus } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeStatus implements IStatus {\n public readonly id: string;\n\n private _status: WorkflowStatus;\n\n private _startTime: number;\n\n private _endTime?: number;\n\n constructor() {\n this.id = uuid();\n this._status = WorkflowStatus.Pending;\n }\n\n public get status(): WorkflowStatus {\n return this._status;\n }\n\n public get terminated(): boolean {\n return [WorkflowStatus.Succeeded, WorkflowStatus.Failed, WorkflowStatus.Cancelled].includes(\n this.status\n );\n }\n\n public get startTime(): number {\n return this._startTime;\n }\n\n public get endTime(): number | undefined {\n return this._endTime;\n }\n\n public get timeCost(): number {\n if (!this.startTime) {\n return 0;\n }\n if (this.endTime) {\n return this.endTime - this.startTime;\n }\n return Date.now() - this.startTime;\n }\n\n public process(): void {\n this._status = WorkflowStatus.Processing;\n this._startTime = Date.now();\n this._endTime = undefined;\n }\n\n public success(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Succeeded;\n this._endTime = Date.now();\n }\n\n public fail(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Failed;\n this._endTime = Date.now();\n }\n\n public cancel(): void {\n if (this.terminated) {\n return;\n }\n this._status = WorkflowStatus.Cancelled;\n this._endTime = Date.now();\n }\n\n public export(): StatusData {\n return {\n status: this.status,\n terminated: this.terminated,\n startTime: this.startTime,\n endTime: this.endTime,\n timeCost: this.timeCost,\n };\n }\n\n public static create(): WorkflowRuntimeStatus {\n const status = new WorkflowRuntimeStatus();\n return status;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IStatus, IStatusCenter, StatusData, WorkflowStatus } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeStatus } from '../status-entity';\n\nexport class WorkflowRuntimeStatusCenter implements IStatusCenter {\n private _workflowStatus: IStatus;\n\n private _nodeStatus: Map<string, IStatus>;\n\n public startTime: number;\n\n public endTime?: number;\n\n public init(): void {\n this._workflowStatus = WorkflowRuntimeStatus.create();\n this._nodeStatus = new Map();\n }\n\n public dispose(): void {\n // because the data is not persisted, do not clear the execution result\n }\n\n public get workflow(): IStatus {\n return this._workflowStatus;\n }\n\n public get workflowStatus(): IStatus {\n return this._workflowStatus;\n }\n\n public nodeStatus(nodeID: string): IStatus {\n if (!this._nodeStatus.has(nodeID)) {\n this._nodeStatus.set(nodeID, WorkflowRuntimeStatus.create());\n }\n const status = this._nodeStatus.get(nodeID)!;\n return status;\n }\n\n public getStatusNodeIDs(status: WorkflowStatus): string[] {\n return Array.from(this._nodeStatus.entries())\n .filter(([, nodeStatus]) => nodeStatus.status === status)\n .map(([nodeID]) => nodeID);\n }\n\n public exportNodeStatus(): Record<string, StatusData> {\n return Object.fromEntries(\n Array.from(this._nodeStatus.entries()).map(([nodeID, status]) => [nodeID, status.export()])\n );\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { isNil } from 'lodash-es';\nimport {\n IState,\n IFlowValue,\n IFlowRefValue,\n IVariableParseResult,\n INode,\n WorkflowInputs,\n WorkflowOutputs,\n IVariableStore,\n WorkflowVariableType,\n IFlowTemplateValue,\n IJsonSchema,\n WorkflowSchema,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid, WorkflowRuntimeType } from '@infra/utils';\n\nexport class WorkflowRuntimeState implements IState {\n public readonly id: string;\n\n private executedNodes: Set<string>;\n\n constructor(public readonly variableStore: IVariableStore) {\n this.id = uuid();\n }\n\n public init(schema?: WorkflowSchema): void {\n this.setGlobalVariable(schema?.globalVariable);\n this.executedNodes = new Set();\n }\n\n public dispose(): void {\n this.executedNodes.clear();\n }\n\n public getNodeInputs(node: INode): WorkflowInputs {\n const inputsDeclare = node.declare.inputs;\n const inputsValues = node.declare.inputsValues;\n return this.parseInputs({\n values: inputsValues,\n declare: inputsDeclare,\n });\n }\n\n public setNodeOutputs(params: { node: INode; outputs: WorkflowOutputs }): void {\n const { node, outputs } = params;\n const outputsDeclare = node.declare.outputs as IJsonSchema<'object'>;\n if (outputsDeclare?.type !== 'object' || !outputsDeclare.properties) {\n return;\n }\n Object.entries(outputsDeclare.properties).forEach(([key, typeInfo]) => {\n if (!key || !typeInfo) {\n return;\n }\n const type = typeInfo.type as WorkflowVariableType;\n const itemsType = typeInfo.items?.type as WorkflowVariableType;\n const defaultValue = this.parseJSONContent(typeInfo.default, type);\n const value = outputs[key] ?? defaultValue;\n // create variable\n this.variableStore.setVariable({\n nodeID: node.id,\n key,\n value,\n type,\n itemsType,\n });\n });\n }\n\n public parseInputs(params: {\n values?: Record<string, IFlowValue>;\n declare?: IJsonSchema;\n }): WorkflowInputs {\n const { values, declare } = params;\n if (!declare || !values) {\n return {};\n }\n return Object.entries(values).reduce((prev, [key, flowValue]) => {\n const typeInfo = declare.properties?.[key];\n if (!typeInfo) {\n return prev;\n }\n const declareType = typeInfo.type as WorkflowVariableType;\n // get value\n const result = this.parseFlowValue({ flowValue, declareType });\n if (!result) {\n return prev;\n }\n const { value, type } = result;\n if (!WorkflowRuntimeType.isTypeEqual(type, declareType)) {\n return prev;\n }\n prev[key] = value;\n return prev;\n }, {} as WorkflowInputs);\n }\n\n public parseRef<T = unknown>(ref: IFlowRefValue): IVariableParseResult<T> | null {\n if (ref?.type !== 'ref') {\n throw new Error(`Invalid ref value: ${ref}`);\n }\n if (!ref.content || ref.content.length < 2) {\n return null;\n }\n const [nodeID, variableKey, ...variablePath] = ref.content;\n const result = this.variableStore.getValue<T>({\n nodeID,\n variableKey,\n variablePath,\n });\n if (!result) {\n return null;\n }\n return result;\n }\n\n public parseTemplate(template: IFlowTemplateValue): IVariableParseResult<string> | null {\n if (template?.type !== 'template') {\n throw new Error(`Invalid template value: ${template}`);\n }\n if (!template.content) {\n return null;\n }\n const parsedValue = template.content.replace(\n /\\{\\{([^\\}]+)\\}\\}/g,\n (match: string, pattern: string): string => {\n // 将路径分割成数组,如 'start_0.work.role' => ['start_0', 'work', 'role']\n const ref = pattern.trim().split('.');\n\n const variable = this.parseRef<string>({\n type: 'ref',\n content: ref,\n });\n\n if (!variable) {\n return '';\n }\n\n return variable.value;\n }\n );\n return {\n type: WorkflowVariableType.String,\n value: parsedValue,\n };\n }\n\n public parseFlowValue<T = unknown>(params: {\n flowValue: IFlowValue;\n declareType: WorkflowVariableType;\n }): IVariableParseResult<T> | null {\n const { flowValue, declareType } = params;\n if (!flowValue?.type) {\n throw new Error(`Invalid flow value type: ${(flowValue as any).type}`);\n }\n // constant\n if (flowValue.type === 'constant') {\n const value = this.parseJSONContent<T>(flowValue.content, declareType);\n const type = declareType ?? WorkflowRuntimeType.getWorkflowType(value);\n if (isNil(value) || !type) {\n return null;\n }\n return {\n value,\n type,\n };\n }\n // ref\n if (flowValue.type === 'ref') {\n return this.parseRef<T>(flowValue);\n }\n // template\n if (flowValue.type === 'template') {\n return this.parseTemplate(flowValue) as IVariableParseResult<T> | null;\n }\n // unknown type\n throw new Error(`Unknown flow value type: ${(flowValue as any).type}`);\n }\n\n public isExecutedNode(node: INode): boolean {\n return this.executedNodes.has(node.id);\n }\n\n public addExecutedNode(node: INode): void {\n this.executedNodes.add(node.id);\n }\n\n private parseJSONContent<T = unknown>(\n jsonContent: string | unknown,\n declareType: WorkflowVariableType\n ): T {\n const JSONTypes = [\n WorkflowVariableType.Object,\n WorkflowVariableType.Array,\n WorkflowVariableType.Map,\n ];\n if (declareType && JSONTypes.includes(declareType) && typeof jsonContent === 'string') {\n try {\n return JSON.parse(jsonContent) as T;\n } catch (e) {\n return jsonContent as T;\n }\n }\n return jsonContent as T;\n }\n\n private setGlobalVariable(globalVariableDeclare: IJsonSchema | undefined): void {\n if (globalVariableDeclare?.type !== 'object' || !globalVariableDeclare.properties) {\n return;\n }\n Object.entries(globalVariableDeclare.properties).forEach(([key, typeInfo]) => {\n if (!key || !typeInfo) {\n return;\n }\n const type = typeInfo.type as WorkflowVariableType;\n const itemsType = typeInfo.items?.type as WorkflowVariableType;\n const defaultValue = this.parseJSONContent(typeInfo.default, type);\n // create variable\n this.variableStore.setVariable({\n nodeID: 'global',\n key,\n value: defaultValue,\n type,\n itemsType,\n });\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { ISnapshot, Snapshot, SnapshotData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport class WorkflowRuntimeSnapshot implements ISnapshot {\n public readonly id: string;\n\n public readonly data: Partial<SnapshotData>;\n\n public constructor(data: Partial<SnapshotData>) {\n this.id = uuid();\n this.data = data;\n }\n\n public update(data: Partial<SnapshotData>): void {\n Object.assign(this.data, data);\n }\n\n public validate(): boolean {\n const required = ['nodeID', 'inputs', 'outputs', 'data'] as (keyof SnapshotData)[];\n return required.every((key) => this.data[key] !== undefined);\n }\n\n public export(): Snapshot {\n const snapshot: Snapshot = {\n id: this.id,\n ...this.data,\n } as Snapshot;\n return snapshot;\n }\n\n public static create(params: Partial<SnapshotData>): ISnapshot {\n return new WorkflowRuntimeSnapshot(params);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Snapshot, ISnapshotCenter, SnapshotData, ISnapshot } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\nimport { WorkflowRuntimeSnapshot } from '../snapshot-entity';\n\nexport class WorkflowRuntimeSnapshotCenter implements ISnapshotCenter {\n public readonly id: string;\n\n private snapshots: ISnapshot[];\n\n constructor() {\n this.id = uuid();\n }\n\n public create(snapshotData: Partial<SnapshotData>): ISnapshot {\n const snapshot = WorkflowRuntimeSnapshot.create(snapshotData);\n this.snapshots.push(snapshot);\n return snapshot;\n }\n\n public init(): void {\n this.snapshots = [];\n }\n\n public dispose(): void {\n // because the data is not persisted, do not clear the execution result\n }\n\n public exportAll(): Snapshot[] {\n return this.snapshots.slice().map((snapshot) => snapshot.export());\n }\n\n public export(): Record<string, Snapshot[]> {\n const result: Record<string, Snapshot[]> = {};\n this.exportAll().forEach((snapshot) => {\n if (result[snapshot.nodeID]) {\n result[snapshot.nodeID].push(snapshot);\n } else {\n result[snapshot.nodeID] = [snapshot];\n }\n });\n return result;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IReport, VOData } from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\n\nexport namespace WorkflowRuntimeReport {\n export const create = (params: VOData<IReport>): IReport => ({\n id: uuid(),\n ...params,\n });\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ISnapshotCenter,\n IReporter,\n IStatusCenter,\n IIOCenter,\n IReport,\n NodeReport,\n WorkflowReports,\n IMessageCenter,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeReport } from '../report-value-object';\n\nexport class WorkflowRuntimeReporter implements IReporter {\n constructor(\n public readonly ioCenter: IIOCenter,\n public readonly snapshotCenter: ISnapshotCenter,\n public readonly statusCenter: IStatusCenter,\n public readonly messageCenter: IMessageCenter\n ) {}\n\n public init(): void {}\n\n public dispose(): void {}\n\n public export(): IReport {\n const report = WorkflowRuntimeReport.create({\n inputs: this.ioCenter.inputs,\n outputs: this.ioCenter.outputs,\n workflowStatus: this.statusCenter.workflow.export(),\n reports: this.nodeReports(),\n messages: this.messageCenter.export(),\n });\n return report;\n }\n\n private nodeReports(): WorkflowReports {\n const reports: WorkflowReports = {};\n const statuses = this.statusCenter.exportNodeStatus();\n const snapshots = this.snapshotCenter.export();\n Object.keys(statuses).forEach((nodeID) => {\n const status = statuses[nodeID];\n const nodeSnapshots = snapshots[nodeID] || [];\n const nodeReport: NodeReport = {\n id: nodeID,\n ...status,\n snapshots: nodeSnapshots,\n };\n reports[nodeID] = nodeReport;\n });\n return reports;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IIOCenter, IOData, WorkflowInputs, WorkflowOutputs } from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeIOCenter implements IIOCenter {\n private _inputs: WorkflowInputs;\n\n private _outputs: WorkflowOutputs;\n\n public init(inputs: WorkflowInputs): void {\n this.setInputs(inputs);\n }\n\n public dispose(): void {}\n\n public get inputs(): WorkflowInputs {\n return this._inputs ?? {};\n }\n\n public get outputs(): WorkflowOutputs {\n return this._outputs ?? {};\n }\n\n public setInputs(inputs: WorkflowInputs): void {\n this._inputs = inputs;\n }\n\n public setOutputs(outputs: WorkflowOutputs): void {\n this._outputs = outputs;\n }\n\n public export(): IOData {\n return {\n inputs: this._inputs,\n outputs: this._outputs,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowEdgeSchema,\n CreateEdgeParams,\n IEdge,\n INode,\n IPort,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimeEdge implements IEdge {\n public readonly id: string;\n\n public readonly from: INode;\n\n public readonly to: INode;\n\n private _fromPort: IPort;\n\n private _toPort: IPort;\n\n constructor(params: CreateEdgeParams) {\n const { id, from, to } = params;\n this.id = id;\n this.from = from;\n this.to = to;\n }\n\n public get fromPort() {\n return this._fromPort;\n }\n\n public set fromPort(port: IPort) {\n this._fromPort = port;\n }\n\n public get toPort() {\n return this._toPort;\n }\n\n public set toPort(port: IPort) {\n this._toPort = port;\n }\n\n public static createID(schema: WorkflowEdgeSchema): string {\n const { sourceNodeID, sourcePortID, targetNodeID, targetPortID } = schema;\n const sourcePart = sourcePortID ? `${sourceNodeID}:${sourcePortID}` : sourceNodeID;\n const targetPart = targetPortID ? `${targetNodeID}:${targetPortID}` : targetNodeID;\n return `${sourcePart}-${targetPart}`;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n FlowGramNode,\n PositionSchema,\n CreateNodeParams,\n IEdge,\n INode,\n IPort,\n NodeVariable,\n WorkflowPortType,\n} from '@flowgram.ai/runtime-interface';\n\nimport { traverseNodes } from '@infra/index';\n\nexport class WorkflowRuntimeNode<T = any> implements INode {\n public readonly id: string;\n\n public readonly type: FlowGramNode;\n\n public readonly name: string;\n\n public readonly position: PositionSchema;\n\n public readonly declare: NodeVariable;\n\n public readonly data: T;\n\n private _parent: INode | null;\n\n private readonly _children: INode[];\n\n private readonly _ports: IPort[];\n\n private readonly _inputEdges: IEdge[];\n\n private readonly _outputEdges: IEdge[];\n\n private readonly _prev: INode[];\n\n private readonly _next: INode[];\n\n constructor(params: CreateNodeParams) {\n const { id, type, name, position, variable, data } = params;\n this.id = id;\n this.type = type;\n this.name = name;\n this.position = position;\n this.declare = variable ?? {};\n this.data = data ?? {};\n this._parent = null;\n this._children = [];\n this._ports = [];\n this._inputEdges = [];\n this._outputEdges = [];\n this._prev = [];\n this._next = [];\n }\n\n public get ports() {\n const inputs = this._ports.filter((port) => port.type === WorkflowPortType.Input);\n const outputs = this._ports.filter((port) => port.type === WorkflowPortType.Output);\n return {\n inputs,\n outputs,\n };\n }\n\n public get edges() {\n return {\n inputs: this._inputEdges,\n outputs: this._outputEdges,\n };\n }\n\n public get parent() {\n return this._parent;\n }\n\n public set parent(parent: INode | null) {\n this._parent = parent;\n }\n\n public get children() {\n return this._children;\n }\n\n public addChild(child: INode) {\n this._children.push(child);\n }\n\n public addPort(port: IPort) {\n this._ports.push(port);\n }\n\n public addInputEdge(edge: IEdge) {\n this._inputEdges.push(edge);\n this._prev.push(edge.from);\n }\n\n public addOutputEdge(edge: IEdge) {\n this._outputEdges.push(edge);\n this._next.push(edge.to);\n }\n\n public get prev() {\n return this._prev;\n }\n\n public get next() {\n return this._next;\n }\n\n public get successors(): INode[] {\n return traverseNodes(this, (node) => node.next);\n }\n\n public get predecessors(): INode[] {\n return traverseNodes(this, (node) => node.prev);\n }\n\n public get isBranch() {\n return this.ports.outputs.length > 1;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n WorkflowPortType,\n CreatePortParams,\n IEdge,\n INode,\n IPort,\n} from '@flowgram.ai/runtime-interface';\n\nexport class WorkflowRuntimePort implements IPort {\n public readonly id: string;\n\n public readonly node: INode;\n\n public readonly type: WorkflowPortType;\n\n private readonly _edges: IEdge[];\n\n constructor(params: CreatePortParams) {\n const { id, node } = params;\n this.id = id;\n this.node = node;\n this.type = params.type;\n this._edges = [];\n }\n\n public get edges() {\n return this._edges;\n }\n\n public addEdge(edge: IEdge) {\n this._edges.push(edge);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeSchema, WorkflowSchema, FlowGramNode } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeEdge } from '../entity';\n\nexport interface FlattenData {\n flattenSchema: WorkflowSchema;\n nodeBlocks: Map<string, string[]>;\n nodeEdges: Map<string, string[]>;\n}\n\ntype FlatSchema = (json: Partial<WorkflowSchema>) => FlattenData;\n\nconst flatLayer = (data: FlattenData, nodeSchema: WorkflowNodeSchema) => {\n const { blocks, edges } = nodeSchema;\n if (blocks) {\n data.flattenSchema.nodes.push(...blocks);\n const blockIDs: string[] = [];\n blocks.forEach((block) => {\n blockIDs.push(block.id);\n // 递归处理子节点的 blocks 和 edges\n if (block.blocks) {\n flatLayer(data, block);\n }\n });\n data.nodeBlocks.set(nodeSchema.id, blockIDs);\n delete nodeSchema.blocks;\n }\n if (edges) {\n data.flattenSchema.edges.push(...edges);\n const edgeIDs: string[] = [];\n edges.forEach((edge) => {\n const edgeID = WorkflowRuntimeEdge.createID(edge);\n edgeIDs.push(edgeID);\n });\n data.nodeEdges.set(nodeSchema.id, edgeIDs);\n delete nodeSchema.edges;\n }\n};\n\n/**\n * flat the tree json structure, extract the structure information to map\n */\nexport const flatSchema: FlatSchema = (schema = { nodes: [], edges: [] }) => {\n const rootNodes = schema.nodes ?? [];\n const rootEdges = schema.edges ?? [];\n\n const data: FlattenData = {\n flattenSchema: {\n nodes: [],\n edges: [],\n },\n nodeBlocks: new Map(),\n nodeEdges: new Map(),\n };\n\n const root: WorkflowNodeSchema = {\n id: FlowGramNode.Root,\n type: FlowGramNode.Root,\n blocks: rootNodes,\n edges: rootEdges,\n meta: {\n position: {\n x: 0,\n y: 0,\n },\n },\n data: {},\n };\n\n flatLayer(data, root);\n\n return data;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n FlowGramNode,\n WorkflowPortType,\n type CreateEdgeParams,\n type CreateNodeParams,\n type CreatePortParams,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeEdge, WorkflowRuntimeNode, WorkflowRuntimePort } from '../entity';\nimport { FlattenData } from './flat-schema';\n\nexport interface DocumentStore {\n nodes: Map<string, WorkflowRuntimeNode>;\n edges: Map<string, WorkflowRuntimeEdge>;\n ports: Map<string, WorkflowRuntimePort>;\n}\n\nconst createNode = (store: DocumentStore, params: CreateNodeParams): WorkflowRuntimeNode => {\n const node = new WorkflowRuntimeNode(params);\n store.nodes.set(node.id, node);\n return node;\n};\n\nconst createEdge = (store: DocumentStore, params: CreateEdgeParams): WorkflowRuntimeEdge => {\n const edge = new WorkflowRuntimeEdge(params);\n store.edges.set(edge.id, edge);\n return edge;\n};\n\nconst getOrCreatePort = (store: DocumentStore, params: CreatePortParams): WorkflowRuntimePort => {\n const createdPort = store.ports.get(params.id);\n if (createdPort) {\n return createdPort as WorkflowRuntimePort;\n }\n const port = new WorkflowRuntimePort(params);\n store.ports.set(port.id, port);\n return port;\n};\n\nexport const createStore = (params: FlattenData): DocumentStore => {\n const { flattenSchema, nodeBlocks } = params;\n const { nodes, edges } = flattenSchema;\n const store: DocumentStore = {\n nodes: new Map(),\n edges: new Map(),\n ports: new Map(),\n };\n // create root node\n createNode(store, {\n id: FlowGramNode.Root,\n type: FlowGramNode.Root,\n name: FlowGramNode.Root,\n position: { x: 0, y: 0 },\n });\n // create nodes\n nodes.forEach((nodeSchema) => {\n const id = nodeSchema.id;\n const type = nodeSchema.type as FlowGramNode;\n const {\n title = `${type}-${id}-untitled`,\n inputsValues,\n inputs,\n outputs,\n ...data\n } = nodeSchema.data ?? {};\n createNode(store, {\n id,\n type,\n name: title,\n position: nodeSchema.meta.position,\n variable: { inputsValues, inputs, outputs },\n data,\n });\n });\n // create node relations\n nodeBlocks.forEach((blockIDs, parentID) => {\n const parent = store.nodes.get(parentID) as WorkflowRuntimeNode;\n const children = blockIDs\n .map((id) => store.nodes.get(id))\n .filter(Boolean) as WorkflowRuntimeNode[];\n children.forEach((child) => {\n child.parent = parent;\n parent.addChild(child);\n });\n });\n // create edges & ports\n edges.forEach((edgeSchema) => {\n const id = WorkflowRuntimeEdge.createID(edgeSchema);\n const {\n sourceNodeID,\n targetNodeID,\n sourcePortID = 'defaultOutput',\n targetPortID = 'defaultInput',\n } = edgeSchema;\n const from = store.nodes.get(sourceNodeID);\n const to = store.nodes.get(targetNodeID);\n if (!from || !to) {\n throw new Error(`Invalid edge schema ID: ${id}, from: ${sourceNodeID}, to: ${targetNodeID}`);\n }\n const edge = createEdge(store, {\n id,\n from,\n to,\n });\n\n // create from port\n const fromPort = getOrCreatePort(store, {\n node: from,\n id: sourcePortID,\n type: WorkflowPortType.Output,\n });\n\n // build relation\n fromPort.addEdge(edge);\n edge.fromPort = fromPort;\n from.addPort(fromPort);\n from.addOutputEdge(edge);\n\n // create to port\n const toPort = getOrCreatePort(store, {\n node: to,\n id: targetPortID,\n type: WorkflowPortType.Input,\n });\n\n // build relation\n toPort.addEdge(edge);\n edge.toPort = toPort;\n to.addPort(toPort);\n to.addInputEdge(edge);\n });\n return store;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n type WorkflowSchema,\n FlowGramNode,\n type IDocument,\n type IEdge,\n type INode,\n} from '@flowgram.ai/runtime-interface';\n\nimport { uuid } from '@infra/utils';\nimport { flatSchema } from './flat-schema';\nimport { createStore, DocumentStore } from './create-store';\n\nexport class WorkflowRuntimeDocument implements IDocument {\n public readonly id: string;\n\n private store: DocumentStore;\n\n constructor() {\n this.id = uuid();\n }\n\n public get root(): INode {\n const rootNode = this.getNode(FlowGramNode.Root);\n if (!rootNode) {\n throw new Error('Root node not found');\n }\n return rootNode;\n }\n\n public get start(): INode {\n const startNode = this.nodes.find((n) => n.type === FlowGramNode.Start);\n if (!startNode) {\n throw new Error('Start node not found');\n }\n return startNode;\n }\n\n public get end(): INode {\n const endNode = this.nodes.find((n) => n.type === FlowGramNode.End);\n if (!endNode) {\n throw new Error('End node not found');\n }\n return endNode;\n }\n\n public getNode(id: string): INode | null {\n return this.store.nodes.get(id) ?? null;\n }\n\n public getEdge(id: string): IEdge | null {\n return this.store.edges.get(id) ?? null;\n }\n\n public get nodes(): INode[] {\n return Array.from(this.store.nodes.values());\n }\n\n public get edges(): IEdge[] {\n return Array.from(this.store.edges.values());\n }\n\n public init(schema: WorkflowSchema): void {\n const flattenSchema = flatSchema(schema);\n this.store = createStore(flattenSchema);\n }\n\n public dispose(): void {\n this.store.edges.clear();\n this.store.nodes.clear();\n this.store.ports.clear();\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n InvokeParams,\n IContext,\n IDocument,\n IState,\n ISnapshotCenter,\n IVariableStore,\n IStatusCenter,\n IReporter,\n IIOCenter,\n ContextData,\n IMessageCenter,\n ICache,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeMessageCenter } from '@workflow/message';\nimport { WorkflowRuntimeCache } from '@workflow/cache';\nimport { uuid } from '@infra/utils';\nimport { WorkflowRuntimeVariableStore } from '../variable';\nimport { WorkflowRuntimeStatusCenter } from '../status';\nimport { WorkflowRuntimeState } from '../state';\nimport { WorkflowRuntimeSnapshotCenter } from '../snapshot';\nimport { WorkflowRuntimeReporter } from '../report';\nimport { WorkflowRuntimeIOCenter } from '../io-center';\nimport { WorkflowRuntimeDocument } from '../document';\n\nexport class WorkflowRuntimeContext implements IContext {\n public readonly id: string;\n\n public readonly cache: ICache;\n\n public readonly document: IDocument;\n\n public readonly variableStore: IVariableStore;\n\n public readonly state: IState;\n\n public readonly ioCenter: IIOCenter;\n\n public readonly snapshotCenter: ISnapshotCenter;\n\n public readonly statusCenter: IStatusCenter;\n\n public readonly messageCenter: IMessageCenter;\n\n public readonly reporter: IReporter;\n\n private subContexts: IContext[] = [];\n\n constructor(data: ContextData) {\n this.id = uuid();\n this.cache = data.cache;\n this.document = data.document;\n this.variableStore = data.variableStore;\n this.state = data.state;\n this.ioCenter = data.ioCenter;\n this.snapshotCenter = data.snapshotCenter;\n this.statusCenter = data.statusCenter;\n this.messageCenter = data.messageCenter;\n this.reporter = data.reporter;\n }\n\n public init(params: InvokeParams): void {\n const { schema, inputs } = params;\n this.cache.init();\n this.document.init(schema);\n this.variableStore.init();\n this.state.init(schema);\n this.ioCenter.init(inputs);\n this.snapshotCenter.init();\n this.statusCenter.init();\n this.messageCenter.init();\n this.reporter.init();\n }\n\n public dispose(): void {\n this.subContexts.forEach((subContext) => {\n subContext.dispose();\n });\n this.subContexts = [];\n this.cache.dispose();\n this.document.dispose();\n this.variableStore.dispose();\n this.state.dispose();\n this.ioCenter.dispose();\n this.snapshotCenter.dispose();\n this.statusCenter.dispose();\n this.messageCenter.dispose();\n this.reporter.dispose();\n }\n\n public sub(): IContext {\n const cache = new WorkflowRuntimeCache();\n const variableStore = new WorkflowRuntimeVariableStore();\n variableStore.setParent(this.variableStore);\n const state = new WorkflowRuntimeState(variableStore);\n const contextData: ContextData = {\n cache,\n document: this.document,\n ioCenter: this.ioCenter,\n snapshotCenter: this.snapshotCenter,\n statusCenter: this.statusCenter,\n messageCenter: this.messageCenter,\n reporter: this.reporter,\n variableStore,\n state,\n };\n const subContext = new WorkflowRuntimeContext(contextData);\n this.subContexts.push(subContext);\n subContext.cache.init();\n subContext.variableStore.init();\n subContext.state.init();\n return subContext;\n }\n\n public static create(): IContext {\n const cache = new WorkflowRuntimeCache();\n const document = new WorkflowRuntimeDocument();\n const variableStore = new WorkflowRuntimeVariableStore();\n const state = new WorkflowRuntimeState(variableStore);\n const ioCenter = new WorkflowRuntimeIOCenter();\n const snapshotCenter = new WorkflowRuntimeSnapshotCenter();\n const statusCenter = new WorkflowRuntimeStatusCenter();\n const messageCenter = new WorkflowRuntimeMessageCenter();\n const reporter = new WorkflowRuntimeReporter(\n ioCenter,\n snapshotCenter,\n statusCenter,\n messageCenter\n );\n return new WorkflowRuntimeContext({\n cache,\n document,\n variableStore,\n state,\n ioCenter,\n snapshotCenter,\n statusCenter,\n messageCenter,\n reporter,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n EngineServices,\n IEngine,\n IExecutor,\n INode,\n WorkflowOutputs,\n IContext,\n InvokeParams,\n ITask,\n FlowGramNode,\n IValidation,\n} from '@flowgram.ai/runtime-interface';\n\nimport { compareNodeGroups } from '@infra/utils';\nimport { WorkflowRuntimeTask } from '../task';\nimport { WorkflowRuntimeContext } from '../context';\nimport { WorkflowRuntimeContainer } from '../container';\n\nexport class WorkflowRuntimeEngine implements IEngine {\n private readonly validation: IValidation;\n\n private readonly executor: IExecutor;\n\n constructor(service: EngineServices) {\n this.validation = service.Validation;\n this.executor = service.Executor;\n }\n\n public invoke(params: InvokeParams): ITask {\n const context = WorkflowRuntimeContext.create();\n context.init(params);\n const valid = this.validate(params, context);\n if (!valid) {\n return WorkflowRuntimeTask.create({\n processing: Promise.resolve({}),\n context,\n });\n }\n const processing = this.process(context);\n processing.then(() => {\n context.dispose();\n });\n return WorkflowRuntimeTask.create({\n processing,\n context,\n });\n }\n\n public async executeNode(params: { context: IContext; node: INode }) {\n const { node, context } = params;\n if (!this.canExecuteNode({ node, context })) {\n return;\n }\n context.statusCenter.nodeStatus(node.id).process();\n const snapshot = context.snapshotCenter.create({\n nodeID: node.id,\n data: node.data,\n });\n let nextNodes: INode[] = [];\n try {\n const inputs = context.state.getNodeInputs(node);\n snapshot.update({\n inputs,\n });\n const result = await this.executor.execute({\n node,\n inputs,\n runtime: context,\n container: WorkflowRuntimeContainer.instance,\n snapshot,\n });\n if (context.statusCenter.workflow.terminated) {\n return;\n }\n const { outputs, branch } = result;\n snapshot.update({ outputs, branch });\n context.state.setNodeOutputs({ node, outputs });\n context.state.addExecutedNode(node);\n context.statusCenter.nodeStatus(node.id).success();\n nextNodes = this.getNextNodes({ node, branch, context });\n } catch (e) {\n const errorMessage = e instanceof Error ? e.message : 'An unknown error occurred';\n snapshot.update({ error: errorMessage });\n context.messageCenter.error({\n nodeID: node.id,\n message: errorMessage,\n });\n context.statusCenter.nodeStatus(node.id).fail();\n console.error(e);\n throw e;\n }\n await this.executeNext({ node, nextNodes, context });\n }\n\n private async process(context: IContext): Promise<WorkflowOutputs> {\n const startNode = context.document.start;\n context.statusCenter.workflow.process();\n try {\n await this.executeNode({ node: startNode, context });\n const outputs = context.ioCenter.outputs;\n context.statusCenter.workflow.success();\n return outputs;\n } catch (e) {\n context.statusCenter.workflow.fail();\n return {};\n }\n }\n\n private validate(params: InvokeParams, context: IContext): boolean {\n const { valid, errors } = this.validation.invoke(params);\n if (valid) {\n return true;\n }\n errors?.forEach((message) => {\n context.messageCenter.error({\n message,\n });\n });\n context.statusCenter.workflow.fail();\n return false;\n }\n\n private canExecuteNode(params: { context: IContext; node: INode }) {\n const { node, context } = params;\n const prevNodes = node.prev;\n if (prevNodes.length === 0) {\n return true;\n }\n return prevNodes.every((prevNode) => context.state.isExecutedNode(prevNode));\n }\n\n private getNextNodes(params: { context: IContext; node: INode; branch?: string }) {\n const { node, branch, context } = params;\n const allNextNodes = node.next;\n if (!branch) {\n return allNextNodes;\n }\n const targetPort = node.ports.outputs.find((port) => port.id === branch);\n if (!targetPort) {\n throw new Error(`Branch \"${branch}\" not found`);\n }\n const nextNodeIDs: Set<string> = new Set(targetPort.edges.map((edge) => edge.to.id));\n const nextNodes = allNextNodes.filter((nextNode) => nextNodeIDs.has(nextNode.id));\n const skipNodes = allNextNodes.filter((nextNode) => !nextNodeIDs.has(nextNode.id));\n const nextGroups = nextNodes.map((nextNode) => [nextNode, ...nextNode.successors]);\n const skipGroups = skipNodes.map((skipNode) => [skipNode, ...skipNode.successors]);\n const { uniqueToB: skippedNodes } = compareNodeGroups(nextGroups, skipGroups);\n skippedNodes.forEach((node) => {\n context.state.addExecutedNode(node);\n });\n return nextNodes;\n }\n\n private async executeNext(params: { context: IContext; node: INode; nextNodes: INode[] }) {\n const { context, node, nextNodes } = params;\n const terminatingNodeTypes = [\n FlowGramNode.End,\n FlowGramNode.BlockEnd,\n FlowGramNode.Break,\n FlowGramNode.Continue,\n ];\n if (terminatingNodeTypes.includes(node.type)) {\n return;\n }\n if (nextNodes.length === 0) {\n throw new Error(`Node \"${node.id}\" has no next nodes`); // inside loop node may have no next nodes\n }\n await Promise.all(\n nextNodes.map((nextNode) =>\n this.executeNode({\n node: nextNode,\n context,\n })\n )\n );\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport {\n ContainerService,\n IContainer,\n IEngine,\n IExecutor,\n IValidation,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeNodeExecutors } from '@nodes/index';\nimport { WorkflowRuntimeValidation } from '../validation';\nimport { WorkflowRuntimeExecutor } from '../executor';\nimport { WorkflowRuntimeEngine } from '../engine';\n\nexport class WorkflowRuntimeContainer implements IContainer {\n constructor(private readonly services: Record<string, ContainerService>) {}\n\n public get<T = ContainerService>(key: any): T {\n return this.services[key] as T;\n }\n\n private static _instance: IContainer;\n\n public static get instance(): IContainer {\n if (this._instance) {\n return this._instance;\n }\n const services = this.create();\n this._instance = new WorkflowRuntimeContainer(services);\n return this._instance;\n }\n\n private static create(): Record<symbol, ContainerService> {\n // services\n const Validation = new WorkflowRuntimeValidation();\n const Executor = new WorkflowRuntimeExecutor(WorkflowRuntimeNodeExecutors);\n const Engine = new WorkflowRuntimeEngine({\n Validation,\n Executor,\n });\n\n return {\n [IValidation]: Validation,\n [IExecutor]: Executor,\n [IEngine]: Engine,\n };\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable no-console */\nimport {\n InvokeParams,\n IContainer,\n IEngine,\n ITask,\n IReport,\n WorkflowOutputs,\n IValidation,\n ValidationResult,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowRuntimeContainer } from '@workflow/container';\n\nexport class WorkflowApplication {\n private container: IContainer;\n\n public tasks: Map<string, ITask>;\n\n constructor() {\n this.container = WorkflowRuntimeContainer.instance;\n this.tasks = new Map();\n }\n\n public run(params: InvokeParams): string {\n const engine = this.container.get<IEngine>(IEngine);\n const task = engine.invoke(params);\n this.tasks.set(task.id, task);\n console.log('> POST TaskRun - taskID: ', task.id);\n console.log(params.inputs);\n task.processing.then((output) => {\n console.log('> LOG Task finished: ', task.id);\n console.log(output);\n });\n return task.id;\n }\n\n public cancel(taskID: string): boolean {\n console.log('> PUT TaskCancel - taskID: ', taskID);\n const task = this.tasks.get(taskID);\n if (!task) {\n return false;\n }\n task.cancel();\n return true;\n }\n\n public report(taskID: string): IReport | undefined {\n const task = this.tasks.get(taskID);\n console.log('> GET TaskReport - taskID: ', taskID);\n if (!task) {\n return;\n }\n return task.context.reporter.export();\n }\n\n public result(taskID: string): WorkflowOutputs | undefined {\n console.log('> GET TaskResult - taskID: ', taskID);\n const task = this.tasks.get(taskID);\n if (!task) {\n return;\n }\n if (!task.context.statusCenter.workflow.terminated) {\n return;\n }\n return task.context.ioCenter.outputs;\n }\n\n public validate(params: InvokeParams): ValidationResult {\n const validation = this.container.get<IValidation>(IValidation);\n const result = validation.invoke(params);\n console.log('> POST TaskValidate - valid: ', result.valid);\n return result;\n }\n\n private static _instance: WorkflowApplication;\n\n public static get instance(): WorkflowApplication {\n if (this._instance) {\n return this._instance;\n }\n this._instance = new WorkflowApplication();\n return this._instance;\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskValidateInput, TaskValidateOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskValidateAPI = async (input: TaskValidateInput): Promise<TaskValidateOutput> => {\n const app = WorkflowApplication.instance;\n const { schema: stringSchema, inputs } = input;\n const schema = JSON.parse(stringSchema);\n const result = app.validate({\n schema,\n inputs,\n });\n const output: TaskValidateOutput = result;\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskRunInput, TaskRunOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskRunAPI = async (input: TaskRunInput): Promise<TaskRunOutput> => {\n const app = WorkflowApplication.instance;\n const { schema: stringSchema, inputs } = input;\n const schema = JSON.parse(stringSchema);\n const taskID = app.run({\n schema,\n inputs,\n });\n const output: TaskRunOutput = {\n taskID,\n };\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskResultInput, TaskResultOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskResultAPI = async (input: TaskResultInput): Promise<TaskResultOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const output: TaskResultOutput = app.result(taskID);\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable no-console */\nimport {\n TaskReportInput,\n TaskReportOutput,\n TaskReportDefine,\n} from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskReportAPI = async (input: TaskReportInput): Promise<TaskReportOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const output: TaskReportOutput = app.report(taskID);\n try {\n TaskReportDefine.schema.output.parse(output);\n } catch (e) {\n console.log('> TaskReportAPI - output: ', JSON.stringify(output));\n console.error(e);\n }\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { TaskCancelInput, TaskCancelOutput } from '@flowgram.ai/runtime-interface';\n\nimport { WorkflowApplication } from '@application/workflow';\n\nexport const TaskCancelAPI = async (input: TaskCancelInput): Promise<TaskCancelOutput> => {\n const app = WorkflowApplication.instance;\n const { taskID } = input;\n const success = app.cancel(taskID);\n const output: TaskCancelOutput = {\n success,\n };\n return output;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { FlowGramAPIName } from '@flowgram.ai/runtime-interface';\n\nimport { TaskValidateAPI } from './task-validate';\nimport { TaskRunAPI } from './task-run';\nimport { TaskResultAPI } from './task-result';\nimport { TaskReportAPI } from './task-report';\nimport { TaskCancelAPI } from './task-cancel';\n\nexport { TaskRunAPI, TaskResultAPI, TaskReportAPI, TaskCancelAPI, TaskValidateAPI };\n\nexport const WorkflowRuntimeAPIs: Record<FlowGramAPIName, (i: any) => any> = {\n [FlowGramAPIName.ServerInfo]: () => {}, // TODO\n [FlowGramAPIName.TaskRun]: TaskRunAPI,\n [FlowGramAPIName.TaskReport]: TaskReportAPI,\n [FlowGramAPIName.TaskResult]: TaskResultAPI,\n [FlowGramAPIName.TaskCancel]: TaskCancelAPI,\n [FlowGramAPIName.TaskValidate]: TaskValidateAPI,\n};\n"],"mappings":";AAKA,OAAOA,QAAO;ACAd,OAAO,OAAO;AEAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ACAd,OAAOA,QAAO;ANEd,IAAM,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,CAAC;AAExD,IAAM,4BAA4B,EAAE,OAAO;EACzC,IAAI,EAAE,OAAO;EACb,QAAQ,EAAE,OAAO;EACjB,QAAQ;EACR,SAAS,oBAAoB,SAAS;EACtC,MAAM;EACN,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;AAED,IA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AQ,cAAc,OAAO,IAAI;AACzC,QAAM,SAAS,KAAK,MAAM,YAAY;AACtC,QAAM,SAAS,IAAI,IAAI;AAAA,IACrB;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,SAAwB;AAAA,IAC5B;AAAA,EACF;AACA,SAAO;AACT;;;ACZO,IAAM,gBAAgB,OAAO,UAAsD;AACxF,QAAM,MAAM,oBAAoB;AAChC,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,SAA2B,IAAI,OAAO,MAAM;AAClD,SAAO;AACT;;;ACAO,IAAM,gBAAgB,OAAO,UAAsD;AACxF,QAAM,MAAM,oBAAoB;AAChC,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,SAA2B,IAAI,OAAO,MAAM;AAClD,MAAI;AACF,qBAAiB,OAAO,OAAO,MAAM,MAAM;AAAA,EAC7C,SAAS,GAAG;AACV,YAAQ,IAAI,8BAA8B,KAAK,UAAU,MAAM,CAAC;AAChE,YAAQ,MAAM,CAAC;AAAA,EACjB;AACA,SAAO;AACT;;;AChBO,IAAM,gBAAgB,OAAO,UAAsD;AACxF,QAAM,MAAM,oBAAoB;AAChC,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,UAAU,IAAI,OAAO,MAAM;AACjC,QAAM,SAA2B;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;;;ACFO,IAAM,sBAAgE;AAAA,EAC3E,CAAC,gBAAgB,UAAU,GAAG,MAAM;AAAA,EAAC;AAAA;AAAA,EACrC,CAAC,gBAAgB,OAAO,GAAG;AAAA,EAC3B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,UAAU,GAAG;AAAA,EAC9B,CAAC,gBAAgB,YAAY,GAAG;AAClC;","names":["z","FlowGramAPIName","z","WorkflowPortType","WorkflowVariableType","FlowGramNode","ConditionOperator","HTTPBodyType","WorkflowStatus","WorkflowMessageType","WorkflowRuntimeType","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","isNil","NodeStatus","WorkflowRuntimeMessage","WorkflowRuntimeVariable","variable","isNil","isNil","WorkflowRuntimeReport","node"]}