graphai 1.0.13 → 2.0.0

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,"file":"bundle.esm.js","sources":["../src/type.ts","../src/utils/GraphAILogger.ts","../src/utils/utils.ts","../src/utils/nodeUtils.ts","../src/transaction_log.ts","../src/utils/prop_function.ts","../src/utils/data_source.ts","../src/utils/result.ts","../src/node.ts","../src/validators/common.ts","../src/validators/graph_data_validator.ts","../src/validators/nodeValidator.ts","../src/validators/static_node_validator.ts","../src/validators/computed_node_validator.ts","../src/validators/relation_validator.ts","../src/validators/agent_validator.ts","../src/validator.ts","../src/task_manager.ts","../src/graphai.ts"],"sourcesContent":["import type { TransactionLog } from \"./transaction_log\";\nimport type { TaskManager } from \"./task_manager\";\nimport type { GraphAI } from \"./graphai\";\n\nexport enum NodeState {\n Waiting = \"waiting\",\n Queued = \"queued\",\n Executing = \"executing\",\n ExecutingServer = \"executing-server\",\n Failed = \"failed\",\n TimedOut = \"timed-out\",\n Abort = \"abort\",\n Completed = \"completed\",\n Injected = \"injected\",\n Skipped = \"skipped\",\n}\n\nexport type DefaultResultData = Record<string, any> | string | number | boolean | Array<DefaultResultData>;\nexport type DefaultInputData = Record<string, any>;\nexport type DefaultConfigData = Record<string, any>;\nexport type ResultData<ResultType = DefaultResultData> = ResultType | undefined;\nexport type ResultDataDictionary<ResultType = DefaultResultData> = Record<string, ResultData<ResultType>>;\n\nexport type ConfigData<ConfigType = DefaultConfigData> = ConfigType;\nexport type ConfigDataDictionary<ConfigType = DefaultConfigData> = Record<string, ConfigType>;\nexport type DefaultParamsType = Record<string, any>;\nexport type NodeDataParams<ParamsType = DefaultParamsType> = ParamsType; // Agent-specific parameters\n\nexport type PassThrough = Record<string, any>;\n\nexport type DataSource = {\n nodeId?: string;\n value?: any;\n propIds?: string[];\n};\n\ntype ConsoleAttribute = boolean | string | Record<string, any>;\nexport type ConsoleElement = boolean | { before?: ConsoleAttribute; after?: ConsoleAttribute };\n\nexport type StaticNodeData = {\n value?: ResultData; // initial value for static node.\n update?: string; // nodeId (+.propId) to get value after a loop\n isResult?: boolean;\n console?: ConsoleElement;\n};\nexport type AgentAnonymousFunction = (...params: any[]) => unknown;\n\nexport type AgentFilterParams = Record<string, any>;\n\nexport type GraphDataLoaderOption = { fileName: string; option?: any };\n\nexport type ComputedNodeData = {\n agent: string | AgentAnonymousFunction;\n inputs?: Record<string, any>;\n output?: Record<string, any>;\n anyInput?: boolean; // any input makes this node ready\n params?: NodeDataParams;\n filterParams?: AgentFilterParams; // agent filter\n retry?: number;\n timeout?: number; // msec\n if?: string; // conditional execution\n unless?: string; // conditional execution\n defaultValue?: ResultData;\n graph?: GraphData | string;\n graphLoader?: GraphDataLoaderOption;\n isResult?: boolean;\n priority?: number; // The default is 0.\n passThrough?: PassThrough; // data that pass trough to result\n console?: ConsoleElement;\n};\n\nexport type NodeData = StaticNodeData | ComputedNodeData;\n\nexport type LoopData = {\n count?: number;\n while?: string | boolean;\n};\n\nexport type GraphData = {\n version?: number; // major version, 0.1, 0.2, ...\n nodes: Record<string, NodeData>;\n concurrency?: number;\n loop?: LoopData;\n verbose?: boolean;\n retry?: number;\n metadata?: any; // Stores information about GraphData. GraphAI itself is not used this data.\n};\n\nexport type GraphDataLoader = (loaderOption: GraphDataLoaderOption) => GraphData;\n\nexport type GraphOptions = {\n agentFilters?: AgentFilterInfo[] | undefined;\n taskManager?: TaskManager | undefined;\n bypassAgentIds?: string[] | undefined;\n config?: ConfigDataDictionary;\n graphLoader?: GraphDataLoader;\n forceLoop?: boolean;\n};\n\nexport type CacheTypes = \"pureAgent\" | \"impureAgent\";\n\nexport type AgentFunctionContextDebugInfo = {\n verbose: boolean;\n nodeId: string;\n state: string;\n subGraphs: Map<string, GraphAI>;\n retry: number;\n agentId?: string;\n version?: number;\n isResult?: boolean;\n};\n\nexport type AgentFunctionContext<ParamsType = DefaultParamsType, NamedInputDataType = DefaultInputData, ConfigType = DefaultConfigData> = {\n params: NodeDataParams<ParamsType>;\n inputSchema?: any;\n namedInputs: NamedInputDataType;\n debugInfo: AgentFunctionContextDebugInfo;\n forNestedGraph?: {\n graphData?: GraphData; // nested graph\n agents: AgentFunctionInfoDictionary; // for nested graph\n graphOptions: GraphOptions;\n onLogCallback?: (log: TransactionLog, isUpdate: boolean) => void;\n callbacks?: CallbackFunction[];\n };\n cacheType?: CacheTypes;\n filterParams: AgentFilterParams; // agent filter\n log?: TransactionLog[];\n config?: ConfigType;\n};\n\nexport type AgentFunction<\n ParamsType = DefaultParamsType,\n ResultType = DefaultResultData,\n NamedInputDataType = DefaultInputData,\n ConfigType = DefaultConfigData,\n> = (context: AgentFunctionContext<ParamsType, NamedInputDataType, ConfigType>) => Promise<ResultData<ResultType>>;\n\nexport type AgentFilterFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, NamedInputDataType = DefaultInputData> = (\n context: AgentFunctionContext<ParamsType, NamedInputDataType>,\n agent: AgentFunction,\n) => Promise<ResultData<ResultType>>;\n\nexport type AgentFilterInfo = {\n name: string;\n agent: AgentFilterFunction;\n agentIds?: string[];\n nodeIds?: string[];\n filterParams?: AgentFilterParams;\n};\n\nexport type AgentFunctionInfoSample = {\n inputs: any;\n params: DefaultParamsType;\n result: any;\n graph?: GraphData;\n};\n\nexport type AgentFunctionInfo = {\n name: string;\n agent: AgentFunction<any, any, any, any>;\n mock: AgentFunction<any, any, any, any>;\n inputs?: any; // inputs data schema\n output?: any; // output data schema\n params?: any; // params data schema\n config?: any; // config data schema\n outputFormat?: any;\n tools?: Record<string, any>[]; // function calling(tools) schema.\n samples: AgentFunctionInfoSample[]; // sample data. This is for document and unit test.\n description: string;\n category: string[];\n author: string;\n repository: string;\n source?: string;\n package?: string;\n license: string;\n cacheType?: CacheTypes;\n environmentVariables?: string[]; // Environment variables required for execution\n hasGraphData?: boolean; // The agent that executes graph data using nestedAgentGenerator is true\n stream?: boolean; // is stream support?\n apiKeys?: string[];\n npms?: string[];\n};\n\nexport type AgentFunctionInfoDictionary = Record<string, AgentFunctionInfo>;\n\nexport type PropFunction = (result: ResultData, propId: string) => ResultData;\n\nexport type CallbackFunction = (log: TransactionLog, isUpdate: boolean) => void;\n","type LogLevel = \"debug\" | \"info\" | \"log\" | \"warn\" | \"error\";\ntype LoggerFunction = (level: LogLevel, ...args: any[]) => void;\n\nconst enabledLevels: Record<LogLevel, boolean> = {\n debug: true,\n info: true,\n log: true,\n warn: true,\n error: true,\n};\n\nlet customLogger: LoggerFunction | null = null;\n\nfunction setLevelEnabled(level: LogLevel, enabled: boolean) {\n enabledLevels[level] = enabled;\n}\n\nfunction setLogger(logger: LoggerFunction) {\n customLogger = logger;\n}\n\nfunction output(level: LogLevel, ...args: any[]) {\n if (!enabledLevels[level]) return;\n if (customLogger) {\n customLogger(level, ...args);\n } else {\n (console[level] || console.log)(...args);\n }\n}\n\nfunction debug(...args: any[]) {\n output(\"debug\", ...args);\n}\nfunction info(...args: any[]) {\n output(\"info\", ...args);\n}\nfunction log(...args: any[]) {\n output(\"log\", ...args);\n}\nfunction warn(...args: any[]) {\n output(\"warn\", ...args);\n}\nfunction error(...args: any[]) {\n output(\"error\", ...args);\n}\n\nexport const GraphAILogger = {\n setLevelEnabled,\n setLogger,\n debug,\n info,\n log,\n warn,\n error,\n};\n","import { DataSource, AgentFunction, AgentFunctionInfo, NodeData, StaticNodeData, ComputedNodeData, NodeState } from \"../type\";\nimport { GraphAILogger } from \"./GraphAILogger\";\n\nexport const sleep = async (milliseconds: number) => {\n return await new Promise((resolve) => setTimeout(resolve, milliseconds));\n};\n\nexport const parseNodeName = (inputNodeId: any, isSelfNode: boolean = false): DataSource => {\n if (isSelfNode) {\n if (typeof inputNodeId === \"string\" && inputNodeId[0] === \".\") {\n const parts = inputNodeId.split(\".\");\n return { nodeId: \"self\", propIds: parts.slice(1) };\n }\n return { value: inputNodeId };\n }\n if (typeof inputNodeId === \"string\") {\n const regex = /^:(.*)$/;\n const match = inputNodeId.match(regex);\n if (!match) {\n return { value: inputNodeId }; // string literal\n }\n const parts = match[1].split(/(?<!\\()\\.(?!\\))/);\n if (parts.length == 1) {\n return { nodeId: parts[0] };\n }\n return { nodeId: parts[0], propIds: parts.slice(1) };\n }\n return { value: inputNodeId }; // non-string literal\n};\n\nexport function assert(condition: boolean, message: string, isWarn: boolean = false): asserts condition {\n if (!condition) {\n if (!isWarn) {\n throw new Error(message);\n }\n GraphAILogger.warn(\"warn: \" + message);\n }\n}\n\nexport const isObject = <Values = unknown>(x: unknown): x is Record<string, Values> => {\n return x !== null && typeof x === \"object\";\n};\n\nexport const isNull = (data: unknown) => {\n return data === null || data === undefined;\n};\n\nexport const strIntentionalError = \"Intentional Error for Debugging\";\n\nexport const defaultAgentInfo = {\n name: \"defaultAgentInfo\",\n samples: [\n {\n inputs: [],\n params: {},\n result: {},\n },\n ],\n description: \"\",\n category: [],\n author: \"\",\n repository: \"\",\n license: \"\",\n};\n\nexport const agentInfoWrapper = (agent: AgentFunction<any, any, any, any>): AgentFunctionInfo => {\n return {\n agent,\n mock: agent,\n ...defaultAgentInfo,\n };\n};\n\nconst objectToKeyArray = (innerData: any) => {\n const ret: string[][] = [];\n Object.keys(innerData).forEach((key: string) => {\n ret.push([key]);\n if (Object.keys(innerData[key]).length > 0) {\n objectToKeyArray(innerData[key]).forEach((tmp: string[]) => {\n ret.push([key, ...tmp]);\n });\n }\n });\n return ret;\n};\n\nexport const debugResultKey = (agentId: string, result: any) => {\n return objectToKeyArray({ [agentId]: debugResultKeyInner(result) }).map((objectKeys: string[]) => {\n return \":\" + objectKeys.join(\".\");\n });\n};\n\nconst debugResultKeyInner = (result: any) => {\n if (result === null || result === undefined) {\n return {};\n }\n if (typeof result === \"string\") {\n return {};\n }\n if (Array.isArray(result)) {\n return Array.from(result.keys()).reduce((tmp: Record<string, any>, index: number) => {\n tmp[\"$\" + String(index)] = debugResultKeyInner(result[index]);\n return tmp;\n }, {});\n }\n return Object.keys(result).reduce((tmp: Record<string, any>, key: string) => {\n tmp[key] = debugResultKeyInner(result[key]);\n return tmp;\n }, {});\n};\n\nexport const isLogicallyTrue = (value: any) => {\n // Notice that empty aray is not true under GraphAI\n if (Array.isArray(value) ? value.length === 0 : !value) {\n return false;\n }\n return true;\n};\n\nexport const defaultTestContext = {\n debugInfo: {\n nodeId: \"test\",\n retry: 0,\n verbose: true,\n state: NodeState.Executing,\n subGraphs: new Map(),\n },\n params: {},\n filterParams: {},\n agents: {},\n log: [],\n};\n\nexport const isNamedInputs = <Values = unknown>(namedInputs: unknown): namedInputs is Record<string, Values> => {\n return isObject(namedInputs) && !Array.isArray(namedInputs) && Object.keys(namedInputs || {}).length > 0;\n};\n\nexport const isComputedNodeData = (node: NodeData): node is ComputedNodeData => {\n return \"agent\" in node;\n};\n\nexport const isStaticNodeData = (node: NodeData): node is StaticNodeData => {\n return !(\"agent\" in node);\n};\n\nexport const loopCounterKey: string = \"__loopIndex\";\n","import { parseNodeName, isObject } from \"./utils\";\nimport { DataSource } from \"../type\";\n\n// for dataSource\nexport const inputs2dataSources = (inputs: any): DataSource[] => {\n if (Array.isArray(inputs)) {\n return inputs.map((inp) => inputs2dataSources(inp)).flat();\n }\n if (isObject(inputs)) {\n return Object.values(inputs)\n .map((input) => inputs2dataSources(input))\n .flat();\n }\n if (typeof inputs === \"string\") {\n const templateMatch = [...inputs.matchAll(/\\${(:[^}]+)}/g)].map((m) => m[1]);\n if (templateMatch.length > 0) {\n return inputs2dataSources(templateMatch);\n }\n }\n\n return parseNodeName(inputs) as any;\n};\n\n// TODO: Maybe it's a remnant of old array inputs. Check and delete.\nexport const dataSourceNodeIds = (sources: DataSource[]): string[] => {\n if (!Array.isArray(sources)) {\n throw new Error(\"sources must be array!! maybe inputs is invalid\");\n }\n return sources.filter((source: DataSource) => source.nodeId).map((source) => source.nodeId!);\n};\n","import { ResultData, NodeDataParams, NodeState } from \"./type\";\nimport type { GraphAI } from \"./graphai\";\nimport type { ComputedNode, StaticNode } from \"./node\";\nimport { debugResultKey } from \"./utils/utils\";\nimport { dataSourceNodeIds } from \"./utils/nodeUtils\";\n\nexport class TransactionLog {\n public nodeId: string;\n public state: NodeState;\n public startTime?: number;\n public endTime?: number;\n public retryCount?: number;\n public agentId?: string;\n public params?: NodeDataParams;\n public inputs?: string[];\n public inputsData?: Array<ResultData>;\n public injectFrom?: string;\n public errorMessage?: string;\n public result?: ResultData;\n public resultKeys?: string[];\n public mapIndex?: number;\n public isLoop?: boolean;\n public repeatCount?: number;\n public log?: TransactionLog[];\n constructor(nodeId: string) {\n this.nodeId = nodeId;\n this.state = NodeState.Waiting;\n }\n\n public initForComputedNode(node: ComputedNode, graph: GraphAI) {\n this.agentId = node.getAgentId();\n this.params = node.params;\n graph.appendLog(this);\n }\n\n public onInjected(node: StaticNode, graph: GraphAI, injectFrom?: string) {\n const isUpdating = \"endTime\" in this;\n this.result = node.result;\n this.state = node.state;\n this.endTime = Date.now();\n this.injectFrom = injectFrom;\n graph.setLoopLog(this);\n // console.log(this)\n if (isUpdating) {\n graph.updateLog(this);\n } else {\n graph.appendLog(this);\n }\n }\n\n public onComplete(node: ComputedNode, graph: GraphAI, localLog: TransactionLog[]) {\n this.result = node.result;\n this.resultKeys = debugResultKey(this.agentId || \"\", node.result);\n this.state = node.state;\n this.endTime = Date.now();\n graph.setLoopLog(this);\n if (localLog.length > 0) {\n this.log = localLog;\n }\n graph.updateLog(this);\n }\n\n public beforeExecute(node: ComputedNode, graph: GraphAI, transactionId: number, inputs: ResultData[]) {\n this.state = node.state;\n this.retryCount = node.retryCount > 0 ? node.retryCount : undefined;\n this.startTime = transactionId;\n this.inputs = dataSourceNodeIds(node.dataSources);\n this.inputsData = inputs.length > 0 ? inputs : undefined;\n graph.setLoopLog(this);\n graph.appendLog(this);\n }\n\n public beforeAddTask(node: ComputedNode, graph: GraphAI) {\n this.state = node.state;\n graph.setLoopLog(this);\n graph.appendLog(this);\n }\n\n public onError(node: ComputedNode, graph: GraphAI, errorMessage: string) {\n this.state = node.state;\n this.errorMessage = errorMessage;\n this.endTime = Date.now();\n graph.setLoopLog(this);\n graph.updateLog(this);\n }\n\n public onSkipped(node: ComputedNode, graph: GraphAI) {\n this.state = node.state;\n graph.setLoopLog(this);\n graph.updateLog(this);\n }\n}\n","import { PropFunction } from \"../type\";\nimport { isObject, loopCounterKey } from \"./utils\";\nimport { GraphNodes } from \"../node\";\nimport { GraphAILogger } from \"./GraphAILogger\";\n\nexport const propFunctionRegex = /^[a-zA-Z]+\\([^)]*\\)$/;\n\nconst propArrayFunction: PropFunction = (result, propId) => {\n if (Array.isArray(result)) {\n if (propId === \"length()\") {\n return result.length;\n }\n if (propId === \"flat()\") {\n return result.flat();\n }\n if (propId === \"toJSON()\") {\n return JSON.stringify(result, null, 2);\n }\n if (propId === \"isEmpty()\") {\n return result.length === 0;\n }\n // array join\n const matchJoin = propId.match(/^join\\(([,-\\s]?)\\)$/);\n if (matchJoin && Array.isArray(matchJoin)) {\n return result.join(matchJoin[1] ?? \"\");\n }\n }\n return undefined;\n};\n\nconst propObjectFunction: PropFunction = (result, propId) => {\n if (isObject(result)) {\n if (propId === \"keys()\") {\n return Object.keys(result);\n }\n if (propId === \"values()\") {\n return Object.values(result);\n }\n if (propId === \"toJSON()\") {\n return JSON.stringify(result, null, 2);\n }\n }\n return undefined;\n};\n\nconst propStringFunction: PropFunction = (result, propId) => {\n if (typeof result === \"string\") {\n if (propId === \"codeBlock()\") {\n const match = (\"\\n\" + result).match(/\\n```[a-zA-z]*([\\s\\S]*?)\\n```/);\n if (match) {\n return match[1];\n }\n }\n if (propId === \"jsonParse()\") {\n return JSON.parse(result);\n }\n if (propId === \"toNumber()\") {\n const ret = Number(result);\n if (!isNaN(ret)) {\n return ret;\n }\n }\n if (propId === \"trim()\") {\n return result.trim();\n }\n if (propId === \"toLowerCase()\") {\n return result.toLowerCase();\n }\n if (propId === \"toUpperCase()\") {\n return result.toUpperCase();\n }\n const sliceMatch = propId.match(/^slice\\((-?\\d+)(?:,\\s*(-?\\d+))?\\)/);\n if (sliceMatch) {\n if (sliceMatch[2] !== undefined) {\n return result.slice(Number(sliceMatch[1]), Number(sliceMatch[2]));\n }\n if (sliceMatch[1] !== undefined) {\n return result.slice(Number(sliceMatch[1]));\n }\n GraphAILogger.warn(\"slice is not valid format: \" + sliceMatch);\n }\n\n const splitMatch = propId.match(/^split\\(([-_:;.,\\s\\n]+)\\)$/);\n if (splitMatch) {\n return result.split(splitMatch[1]);\n }\n }\n return undefined;\n};\nconst propNumberFunction: PropFunction = (result, propId) => {\n if (result !== undefined && Number.isFinite(result)) {\n if (propId === \"toString()\") {\n return String(result);\n }\n const regex = /^add\\((-?\\d+)\\)$/;\n const match = propId.match(regex);\n if (match) {\n return Number(result) + Number(match[1]);\n }\n }\n return undefined;\n};\nconst propBooleanFunction: PropFunction = (result, propId) => {\n if (typeof result === \"boolean\") {\n if (propId === \"not()\") {\n return !result;\n }\n }\n return undefined;\n};\n\nexport const propFunctions = [propArrayFunction, propObjectFunction, propStringFunction, propNumberFunction, propBooleanFunction];\n\nexport const utilsFunctions = (input: string, nodes: GraphNodes) => {\n if (input === \"@now\" || input === \"@now_ms\") {\n return Date.now();\n }\n if (input === \"@now_s\") {\n return Math.floor(Date.now() / 1000);\n }\n if (input === \"@loop\") {\n return nodes[loopCounterKey].result as string;\n }\n // If a placeholder does not match any key, replace it with an empty string.\n GraphAILogger.warn(\"not match template utility function: ${\" + input + \"}\");\n return \"\";\n};\n","import { ResultData, DataSource, PropFunction } from \"../type\";\nimport { isObject, isNull } from \"./utils\";\nimport { propFunctionRegex } from \"./prop_function\";\nimport { GraphAILogger } from \"./GraphAILogger\";\n\nconst getNestedData = (result: ResultData, propId: string, propFunctions: PropFunction[]) => {\n const match = propId.match(propFunctionRegex);\n if (match) {\n for (const propFunction of propFunctions) {\n const ret = propFunction(result, propId);\n if (!isNull(ret)) {\n return ret;\n }\n }\n }\n\n // for array.\n if (Array.isArray(result)) {\n // $0, $1. array value.\n const regex = /^\\$(\\d+)$/;\n const match = propId.match(regex);\n if (match) {\n const index = parseInt(match[1], 10);\n return result[index];\n }\n if (propId === \"$last\") {\n return result[result.length - 1];\n }\n } else if (isObject(result)) {\n if (propId in result) {\n return result[propId];\n }\n }\n return undefined;\n};\n\nconst innerGetDataFromSource = (result: ResultData, propIds: string[] | undefined, propFunctions: PropFunction[]): ResultData | undefined => {\n if (!isNull(result) && propIds && propIds.length > 0) {\n const propId = propIds[0];\n const ret = getNestedData(result, propId, propFunctions);\n if (ret === undefined) {\n GraphAILogger.error(`prop: ${propIds.join(\".\")} is not hit`);\n }\n if (propIds.length > 1) {\n return innerGetDataFromSource(ret, propIds.slice(1), propFunctions);\n }\n return ret;\n }\n return result;\n};\n\nexport const getDataFromSource = (result: ResultData | undefined, source: DataSource, propFunctions: PropFunction[] = []): ResultData | undefined => {\n if (!source.nodeId) {\n return source.value;\n }\n return innerGetDataFromSource(result, source.propIds, propFunctions);\n};\n","import { DataSource, ResultData, PropFunction } from \"../type\";\n\nimport { GraphNodes } from \"../node\";\n\nimport { parseNodeName, isNamedInputs, isObject, isNull } from \"./utils\";\nimport { getDataFromSource } from \"./data_source\";\nimport { utilsFunctions } from \"./prop_function\";\n\nconst replaceTemplatePlaceholders = (input: string, templateMatch: string[], nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean) => {\n // GOD format ${:node.prop1.prop2}\n const godResults = resultsOfInner(\n templateMatch.filter((text) => text.startsWith(\":\")),\n nodes,\n propFunctions,\n isSelfNode,\n );\n // utilsFunctions ${@now}\n const utilsFuncResult = templateMatch\n .filter((text) => text.startsWith(\"@\"))\n .reduce((tmp: Record<string, string | number>, key: string) => {\n tmp[key] = utilsFunctions(key, nodes);\n return tmp;\n }, {});\n return Array.from(templateMatch.keys()).reduce((tmp, key) => {\n if (templateMatch[key].startsWith(\":\")) {\n return tmp.replaceAll(\"${\" + templateMatch[key] + \"}\", (godResults as any)[key]);\n }\n return tmp.replaceAll(\"${\" + templateMatch[key] + \"}\", (utilsFuncResult as any)[templateMatch[key]]);\n }, input);\n};\n\nconst resultsOfInner = (input: any, nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean = false): ResultData => {\n if (Array.isArray(input)) {\n return input.map((inp) => resultsOfInner(inp, nodes, propFunctions, isSelfNode));\n }\n if (isNamedInputs(input)) {\n return resultsOf(input, nodes, propFunctions, isSelfNode);\n }\n if (typeof input === \"string\") {\n const templateMatch = [...input.matchAll(/\\${([:@][^}]+)}/g)].map((m) => m[1]);\n if (templateMatch.length > 0) {\n return replaceTemplatePlaceholders(input, templateMatch, nodes, propFunctions, isSelfNode);\n }\n }\n return resultOf(parseNodeName(input, isSelfNode), nodes, propFunctions);\n};\n\nexport const resultsOf = (inputs: Record<string, any>, nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean = false) => {\n return Object.keys(inputs).reduce((tmp: Record<string, ResultData>, key) => {\n const input = inputs[key];\n tmp[key] = isNamedInputs(input) ? resultsOf(input, nodes, propFunctions, isSelfNode) : resultsOfInner(input, nodes, propFunctions, isSelfNode);\n return tmp;\n }, {});\n};\n\nexport const resultOf = (source: DataSource, nodes: GraphNodes, propFunctions: PropFunction[]) => {\n const { result } = source.nodeId ? nodes[source.nodeId] : { result: undefined };\n return getDataFromSource(result, source, propFunctions);\n};\n\n// clean up object for anyInput\nexport const cleanResultInner = (results: ResultData): ResultData | null => {\n if (Array.isArray(results)) {\n return results.map((result: ResultData) => cleanResultInner(result)).filter((result) => !isNull(result));\n }\n\n if (isObject<ResultData>(results)) {\n return Object.keys(results).reduce((tmp: Record<string, ResultData>, key: string) => {\n const value = cleanResultInner(results[key]);\n if (!isNull(value)) {\n tmp[key] = value;\n }\n return tmp;\n }, {});\n }\n\n return results;\n};\n\nexport const cleanResult = (results: Record<string, ResultData | undefined>) => {\n return Object.keys(results).reduce((tmp: Record<string, ResultData | undefined>, key: string) => {\n const value = cleanResultInner(results[key]);\n if (!isNull(value)) {\n tmp[key] = value;\n }\n return tmp;\n }, {});\n};\n","import type { GraphAI, GraphData } from \"./index\";\nimport { strIntentionalError } from \"./utils/utils\";\nimport { inputs2dataSources, dataSourceNodeIds } from \"./utils/nodeUtils\";\n\nimport {\n NodeDataParams,\n ResultData,\n DataSource,\n ComputedNodeData,\n StaticNodeData,\n NodeState,\n AgentFunctionContext,\n AgentFunction,\n AgentFilterInfo,\n AgentFilterParams,\n AgentFunctionContextDebugInfo,\n DefaultParamsType,\n DefaultInputData,\n PassThrough,\n ConsoleElement,\n ConfigData,\n} from \"./type\";\nimport { parseNodeName, assert, isLogicallyTrue, isObject } from \"./utils/utils\";\nimport { TransactionLog } from \"./transaction_log\";\nimport { resultsOf } from \"./utils/result\";\nimport { GraphAILogger } from \"./utils/GraphAILogger\";\n\nexport class Node {\n public readonly nodeId: string;\n public readonly waitlist = new Set<string>(); // List of nodes which need data from this node.\n public state = NodeState.Waiting;\n public result: ResultData | undefined = undefined;\n\n protected graph: GraphAI;\n protected log: TransactionLog;\n protected console: ConsoleElement; // console output option (before and/or after)\n\n constructor(nodeId: string, graph: GraphAI) {\n this.nodeId = nodeId;\n this.graph = graph;\n this.log = new TransactionLog(nodeId);\n this.console = {};\n }\n\n public asString() {\n return `${this.nodeId}: ${this.state} ${[...this.waitlist]}`;\n }\n\n // This method is called either as the result of computation (computed node) or\n // injection (static node).\n protected onSetResult() {\n this.waitlist.forEach((waitingNodeId) => {\n const waitingNode = this.graph.nodes[waitingNodeId];\n if (waitingNode.isComputedNode) {\n waitingNode.removePending(this.nodeId);\n this.graph.pushQueueIfReadyAndRunning(waitingNode);\n }\n });\n }\n\n protected afterConsoleLog(result: ResultData) {\n if (this.console === false) {\n return;\n } else if (this.console === true || this.console.after === true) {\n GraphAILogger.log(typeof result === \"string\" ? result : JSON.stringify(result, null, 2));\n } else if (this.console.after) {\n if (isObject(this.console.after)) {\n GraphAILogger.log(\n JSON.stringify(resultsOf(this.console.after, { self: { result } as unknown as ComputedNode | StaticNode }, this.graph.propFunctions, true), null, 2),\n );\n } else {\n GraphAILogger.log(this.console.after);\n }\n }\n }\n}\n\nexport class ComputedNode extends Node {\n public readonly graphId: string;\n public readonly isResult: boolean;\n public readonly params: NodeDataParams; // Agent-specific parameters\n private readonly filterParams: AgentFilterParams;\n public readonly nestedGraph?: GraphData | DataSource;\n public readonly retryLimit: number;\n public retryCount: number = 0;\n private readonly agentId?: string;\n private agentFunction?: AgentFunction<any, any, any, any>;\n public readonly timeout?: number; // msec\n public readonly priority: number;\n public error?: Error;\n public transactionId: undefined | number; // To reject callbacks from timed-out transactions\n private readonly passThrough?: PassThrough;\n\n public readonly anyInput: boolean; // any input makes this node ready\n public dataSources: DataSource[] = []; // no longer needed. This is for transaction log.\n private inputs?: Record<string, any>;\n private output?: Record<string, any>;\n public pendings: Set<string>; // List of nodes this node is waiting data from.\n private ifSource?: DataSource; // conditional execution\n private unlessSource?: DataSource; // conditional execution\n private defaultValue?: ResultData;\n private isSkip: boolean = false;\n private debugInfo?: AgentFunctionContextDebugInfo;\n\n public readonly isStaticNode = false;\n public readonly isComputedNode = true;\n\n constructor(graphId: string, nodeId: string, data: ComputedNodeData, graph: GraphAI) {\n super(nodeId, graph);\n this.graphId = graphId;\n this.params = data.params ?? {};\n this.console = data.console ?? {};\n this.filterParams = data.filterParams ?? {};\n this.passThrough = data.passThrough;\n this.retryLimit = data.retry ?? graph.retryLimit ?? 0;\n this.timeout = data.timeout;\n this.isResult = data.isResult ?? false;\n this.priority = data.priority ?? 0;\n\n assert([\"function\", \"string\"].includes(typeof data.agent), \"agent must be either string or function\");\n if (typeof data.agent === \"string\") {\n this.agentId = data.agent;\n } else {\n const agent = data.agent;\n this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);\n }\n\n this.anyInput = data.anyInput ?? false;\n this.inputs = data.inputs;\n this.output = data.output;\n this.dataSources = [\n ...(data.inputs ? inputs2dataSources(data.inputs).flat(10) : []),\n ...(data.params ? inputs2dataSources(data.params).flat(10) : []),\n ...(this.agentId ? [parseNodeName(this.agentId)] : []),\n ...(data.passThrough ? inputs2dataSources(data.passThrough).flat(10) : []),\n ];\n if (data.inputs && Array.isArray(data.inputs)) {\n throw new Error(`array inputs have been deprecated. nodeId: ${nodeId}: see https://github.com/receptron/graphai/blob/main/docs/NamedInputs.md`);\n }\n\n this.pendings = new Set(dataSourceNodeIds(this.dataSources));\n if (data.graph) {\n this.nestedGraph = typeof data.graph === \"string\" ? this.addPendingNode(data.graph) : data.graph;\n }\n if (data.graphLoader && graph.graphLoader) {\n this.nestedGraph = graph.graphLoader(data.graphLoader);\n }\n if (data.if) {\n this.ifSource = this.addPendingNode(data.if);\n }\n if (data.unless) {\n this.unlessSource = this.addPendingNode(data.unless);\n }\n if (data.defaultValue) {\n this.defaultValue = data.defaultValue;\n }\n this.isSkip = false;\n this.log.initForComputedNode(this, graph);\n }\n\n public getAgentId() {\n return this.agentId ?? \"__custom__function\"; // only for display purpose in the log.\n }\n\n private getConfig(hasGraphData: boolean, agentId?: string) {\n if (agentId) {\n if (hasGraphData) {\n return this.graph.config;\n }\n const config = this.graph.config ?? {};\n return {\n ...(config[\"global\"] ?? {}),\n ...(config[agentId] ?? {}),\n };\n }\n return {};\n }\n\n private addPendingNode(nodeId: string) {\n const source = parseNodeName(nodeId);\n assert(!!source.nodeId, `Invalid data source ${nodeId}`);\n this.pendings.add(source.nodeId);\n return source;\n }\n\n private updateState(state: NodeState) {\n this.state = state;\n if (this.debugInfo) {\n this.debugInfo.state = state;\n }\n }\n\n public resetPending() {\n this.pendings.clear();\n if (this.state === NodeState.Executing) {\n this.updateState(NodeState.Abort);\n }\n if (this.debugInfo && this.debugInfo.subGraphs) {\n this.debugInfo.subGraphs.forEach((graph) => graph.abort());\n }\n }\n\n public isReadyNode() {\n if (this.state !== NodeState.Waiting || this.pendings.size !== 0) {\n return false;\n }\n this.isSkip = !!(\n (this.ifSource && !isLogicallyTrue(this.graph.resultOf(this.ifSource))) ||\n (this.unlessSource && isLogicallyTrue(this.graph.resultOf(this.unlessSource)))\n );\n\n if (this.isSkip && this.defaultValue === undefined) {\n this.updateState(NodeState.Skipped);\n this.log.onSkipped(this, this.graph);\n return false;\n }\n return true;\n }\n\n // This private method (only called while executing execute()) performs\n // the \"retry\" if specified. The transaction log must be updated before\n // callling this method.\n private retry(state: NodeState, error: Error) {\n this.updateState(state); // this.execute() will update to NodeState.Executing\n this.log.onError(this, this.graph, error.message);\n\n if (this.retryCount < this.retryLimit) {\n this.retryCount++;\n this.execute();\n } else {\n this.result = undefined;\n this.error = error;\n this.transactionId = undefined; // This is necessary for timeout case\n this.graph.onExecutionComplete(this);\n }\n }\n\n private checkDataAvailability() {\n return Object.values(this.graph.resultsOf(this.inputs))\n .flat()\n .some((result) => result !== undefined);\n }\n\n // This method is called right before the Graph add this node to the task manager.\n public beforeAddTask() {\n this.updateState(NodeState.Queued);\n this.log.beforeAddTask(this, this.graph);\n }\n\n // This method is called when the data became available on one of nodes,\n // which this node needs data from.\n public removePending(nodeId: string) {\n if (this.anyInput) {\n if (this.checkDataAvailability()) {\n this.pendings.clear();\n }\n } else {\n this.pendings.delete(nodeId);\n }\n }\n\n private isCurrentTransaction(transactionId: number) {\n return this.transactionId === transactionId;\n }\n\n // This private method (called only fro execute) checks if the callback from\n // the timer came before the completion of agent function call, record it\n // and attempt to retry (if specified).\n private executeTimeout(transactionId: number) {\n if (this.state === NodeState.Executing && this.isCurrentTransaction(transactionId)) {\n GraphAILogger.warn(`-- timeout ${this.timeout} with ${this.nodeId}`);\n this.retry(NodeState.TimedOut, Error(\"Timeout\"));\n }\n }\n\n // Check if we need to apply this filter to this node or not.\n private shouldApplyAgentFilter(agentFilter: AgentFilterInfo, agentId?: string) {\n if (agentFilter.agentIds && Array.isArray(agentFilter.agentIds) && agentFilter.agentIds.length > 0) {\n if (agentId && agentFilter.agentIds.includes(agentId)) {\n return true;\n }\n }\n if (agentFilter.nodeIds && Array.isArray(agentFilter.nodeIds) && agentFilter.nodeIds.length > 0) {\n if (agentFilter.nodeIds.includes(this.nodeId)) {\n return true;\n }\n }\n return !agentFilter.agentIds && !agentFilter.nodeIds;\n }\n\n private agentFilterHandler(context: AgentFunctionContext, agentFunction: AgentFunction, agentId?: string): Promise<ResultData> {\n let index = 0;\n\n const next = (innerContext: AgentFunctionContext): Promise<ResultData> => {\n const agentFilter = this.graph.agentFilters[index++];\n if (agentFilter) {\n if (this.shouldApplyAgentFilter(agentFilter, agentId)) {\n if (agentFilter.filterParams) {\n innerContext.filterParams = { ...agentFilter.filterParams, ...innerContext.filterParams };\n }\n return agentFilter.agent(innerContext, next);\n }\n return next(innerContext);\n }\n return agentFunction(innerContext);\n };\n\n return next(context);\n }\n\n // This method is called when this computed node became ready to run.\n // It asynchronously calls the associated with agent function and set the result,\n // then it removes itself from the \"running node\" list of the graph.\n // Notice that setting the result of this node may make other nodes ready to run.\n public async execute() {\n if (this.isSkip) {\n this.afterExecute(this.defaultValue, []);\n return;\n }\n const previousResults = this.graph.resultsOf(this.inputs, this.anyInput);\n const agentId = this.agentId ? (this.graph.resultOf(parseNodeName(this.agentId)) as string) : this.agentId;\n if (typeof agentId === \"function\") {\n this.agentFunction = agentId;\n }\n const hasNestedGraph = Boolean(this.nestedGraph) || Boolean(agentId && this.graph.getAgentFunctionInfo(agentId).hasGraphData);\n const config: ConfigData | undefined = this.getConfig(hasNestedGraph, agentId);\n\n const transactionId = Date.now();\n this.prepareExecute(transactionId, Object.values(previousResults));\n\n if (this.timeout && this.timeout > 0) {\n setTimeout(() => {\n this.executeTimeout(transactionId);\n }, this.timeout);\n }\n\n try {\n const agentFunction = this.agentFunction ?? this.graph.getAgentFunctionInfo(agentId).agent;\n const localLog: TransactionLog[] = [];\n const context = this.getContext(previousResults, localLog, agentId, config);\n\n // NOTE: We use the existence of graph object in the agent-specific params to determine\n // if this is a nested agent or not.\n if (hasNestedGraph) {\n this.graph.taskManager.prepareForNesting();\n context.forNestedGraph = {\n graphData: this.nestedGraph\n ? \"nodes\" in this.nestedGraph\n ? this.nestedGraph\n : (this.graph.resultOf(this.nestedGraph) as GraphData) // HACK: compiler work-around\n : { version: 0, nodes: {} },\n agents: this.graph.agentFunctionInfoDictionary,\n graphOptions: {\n agentFilters: this.graph.agentFilters,\n taskManager: this.graph.taskManager,\n bypassAgentIds: this.graph.bypassAgentIds,\n config,\n graphLoader: this.graph.graphLoader,\n },\n onLogCallback: this.graph.onLogCallback,\n callbacks: this.graph.callbacks,\n };\n }\n\n this.beforeConsoleLog(context);\n const result = await this.agentFilterHandler(context as AgentFunctionContext, agentFunction, agentId);\n this.afterConsoleLog(result);\n\n if (hasNestedGraph) {\n this.graph.taskManager.restoreAfterNesting();\n }\n\n if (!this.isCurrentTransaction(transactionId)) {\n // This condition happens when the agent function returns\n // after the timeout (either retried or not).\n GraphAILogger.log(`-- transactionId mismatch with ${this.nodeId} (probably timeout)`);\n return;\n }\n\n // after process\n this.afterExecute(result, localLog);\n } catch (error) {\n this.errorProcess(error, transactionId, previousResults);\n }\n }\n\n private afterExecute(result: ResultData, localLog: TransactionLog[]) {\n if (this.state == NodeState.Abort) {\n return;\n }\n this.updateState(NodeState.Completed);\n this.result = this.getResult(result);\n if (this.output) {\n this.result = resultsOf(this.output, { self: this }, this.graph.propFunctions, true);\n if (this.passThrough) {\n this.result = { ...this.result, ...this.graph.resultsOf(this.passThrough) };\n }\n }\n this.log.onComplete(this, this.graph, localLog);\n\n this.onSetResult();\n\n this.graph.onExecutionComplete(this);\n }\n\n // This private method (called only by execute()) prepares the ComputedNode object\n // for execution, and create a new transaction to record it.\n private prepareExecute(transactionId: number, inputs: Array<ResultData>) {\n this.updateState(NodeState.Executing);\n this.log.beforeExecute(this, this.graph, transactionId, inputs);\n this.transactionId = transactionId;\n }\n\n // This private method (called only by execute) processes an error received from\n // the agent function. It records the error in the transaction log and handles\n // the retry if specified.\n private errorProcess(error: unknown, transactionId: number, namedInputs: DefaultInputData) {\n if (error instanceof Error && error.message !== strIntentionalError) {\n GraphAILogger.error(`<-- NodeId: ${this.nodeId}, Agent: ${this.agentId}`);\n GraphAILogger.error({ namedInputs });\n GraphAILogger.error(error);\n GraphAILogger.error(\"-->\");\n }\n if (!this.isCurrentTransaction(transactionId)) {\n GraphAILogger.warn(`-- transactionId mismatch with ${this.nodeId} (not timeout)`);\n return;\n }\n\n if (error instanceof Error) {\n this.retry(NodeState.Failed, error);\n } else {\n GraphAILogger.error(`-- NodeId: ${this.nodeId}: Unknown error was caught`);\n this.retry(NodeState.Failed, Error(\"Unknown\"));\n }\n }\n\n private getContext(previousResults: Record<string, ResultData | undefined>, localLog: TransactionLog[], agentId?: string, config?: ConfigData) {\n // Pass debugInfo by reference, and the state of this node will be received by agent/agentFilter.\n // From graphAgent(nested, map), set the instance of graphai, and use abort on the child graphai.\n this.debugInfo = this.getDebugInfo(agentId);\n const context: AgentFunctionContext<DefaultParamsType, DefaultInputData | string | number | boolean | undefined> = {\n params: this.graph.resultsOf(this.params),\n namedInputs: previousResults,\n inputSchema: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.inputs,\n debugInfo: this.debugInfo,\n cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.cacheType,\n filterParams: this.filterParams,\n config,\n log: localLog,\n };\n return context;\n }\n\n private getResult(result: ResultData) {\n if (result && this.passThrough) {\n if (isObject(result) && !Array.isArray(result)) {\n return { ...result, ...this.graph.resultsOf(this.passThrough) };\n } else if (Array.isArray(result)) {\n return result.map((r) => (isObject(r) && !Array.isArray(r) ? { ...r, ...this.graph.resultsOf(this.passThrough) } : r));\n }\n }\n return result;\n }\n\n private getDebugInfo(agentId?: string) {\n return {\n nodeId: this.nodeId,\n agentId,\n retry: this.retryCount,\n state: this.state,\n subGraphs: new Map(),\n verbose: this.graph.verbose,\n version: this.graph.version,\n isResult: this.isResult,\n };\n }\n\n private beforeConsoleLog(context: AgentFunctionContext<DefaultParamsType, string | number | boolean | DefaultInputData | undefined>) {\n if (this.console === false) {\n return;\n } else if (this.console === true || this.console.before === true) {\n GraphAILogger.log(JSON.stringify(context.namedInputs, null, 2));\n } else if (this.console.before) {\n GraphAILogger.log(this.console.before);\n }\n }\n}\n\nexport class StaticNode extends Node {\n public value?: ResultData;\n public readonly update?: DataSource;\n public readonly isResult: boolean;\n public readonly isStaticNode = true;\n public readonly isComputedNode = false;\n\n constructor(nodeId: string, data: StaticNodeData, graph: GraphAI) {\n super(nodeId, graph);\n this.value = data.value;\n this.update = data.update ? parseNodeName(data.update) : undefined;\n this.isResult = data.isResult ?? false;\n this.console = data.console ?? {};\n }\n\n public injectValue(value: ResultData, injectFrom?: string) {\n this.state = NodeState.Injected;\n this.result = value;\n this.log.onInjected(this, this.graph, injectFrom);\n this.onSetResult();\n }\n\n public consoleLog() {\n this.afterConsoleLog(this.result);\n }\n}\n\nexport type GraphNodes = Record<string, ComputedNode | StaticNode>;\n","export const graphDataAttributeKeys = [\"nodes\", \"concurrency\", \"agentId\", \"loop\", \"verbose\", \"version\", \"metadata\"];\n\nexport const computedNodeAttributeKeys = [\n \"inputs\",\n \"output\",\n \"anyInput\",\n \"params\",\n \"retry\",\n \"timeout\",\n \"agent\",\n \"graph\",\n \"graphLoader\",\n \"isResult\",\n \"priority\",\n \"if\",\n \"unless\",\n \"defaultValue\",\n \"filterParams\",\n \"console\",\n \"passThrough\",\n];\nexport const staticNodeAttributeKeys = [\"value\", \"update\", \"isResult\", \"console\"];\n\nexport class ValidationError extends Error {\n constructor(message: string) {\n super(`\\x1b[41m${message}\\x1b[0m`); // Pass the message to the base Error class\n\n // Set the prototype explicitly to ensure correct prototype chain\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { GraphData } from \"../type\";\nimport { graphDataAttributeKeys, ValidationError } from \"./common\";\n\nexport const graphNodesValidator = (data: GraphData) => {\n if (data.nodes === undefined) {\n throw new ValidationError(\"Invalid Graph Data: no nodes\");\n }\n if (typeof data.nodes !== \"object\") {\n throw new ValidationError(\"Invalid Graph Data: invalid nodes\");\n }\n if (Array.isArray(data.nodes)) {\n throw new ValidationError(\"Invalid Graph Data: nodes must be object\");\n }\n if (Object.keys(data.nodes).length === 0) {\n throw new ValidationError(\"Invalid Graph Data: nodes is empty\");\n }\n Object.keys(data).forEach((key) => {\n if (!graphDataAttributeKeys.includes(key)) {\n throw new ValidationError(\"Graph Data does not allow \" + key);\n }\n });\n};\nexport const graphDataValidator = (data: GraphData) => {\n if (data.loop) {\n if (data.loop.count === undefined && data.loop.while === undefined) {\n throw new ValidationError(\"Loop: Either count or while is required in loop\");\n }\n if (data.loop.count !== undefined && data.loop.while !== undefined) {\n throw new ValidationError(\"Loop: Both count and while cannot be set\");\n }\n }\n if (data.concurrency !== undefined) {\n if (!Number.isInteger(data.concurrency)) {\n throw new ValidationError(\"Concurrency must be an integer\");\n }\n if (data.concurrency < 1) {\n throw new ValidationError(\"Concurrency must be a positive integer\");\n }\n }\n};\n","import { NodeData, StaticNodeData, ComputedNodeData } from \"../type\";\nimport { ValidationError } from \"./common\";\n\nexport const nodeValidator = (nodeData: NodeData) => {\n if ((nodeData as ComputedNodeData).agent && (nodeData as StaticNodeData).value) {\n throw new ValidationError(\"Cannot set both agent and value\");\n }\n // if (!(\"agent\" in nodeData) && !(\"value\" in nodeData)) {\n // throw new ValidationError(\"Either agent or value is required\");\n // }\n return true;\n};\n","import { StaticNodeData } from \"../type\";\nimport { staticNodeAttributeKeys, ValidationError } from \"./common\";\n\nexport const staticNodeValidator = (nodeData: StaticNodeData) => {\n Object.keys(nodeData).forEach((key) => {\n if (!staticNodeAttributeKeys.includes(key)) {\n throw new ValidationError(\"Static node does not allow \" + key);\n }\n });\n return true;\n};\n","import { ComputedNodeData } from \"../type\";\nimport { computedNodeAttributeKeys, ValidationError } from \"./common\";\n\nexport const computedNodeValidator = (nodeData: ComputedNodeData) => {\n Object.keys(nodeData).forEach((key) => {\n if (!computedNodeAttributeKeys.includes(key)) {\n throw new ValidationError(\"Computed node does not allow \" + key);\n }\n });\n return true;\n};\n","import { GraphData } from \"../type\";\nimport { parseNodeName, isComputedNodeData, isStaticNodeData } from \"../utils/utils\";\nimport { inputs2dataSources, dataSourceNodeIds } from \"../utils/nodeUtils\";\nimport { ValidationError } from \"./common\";\n\nexport const relationValidator = (graphData: GraphData, staticNodeIds: string[], computedNodeIds: string[]) => {\n const nodeIds = new Set<string>(Object.keys(graphData.nodes));\n\n const pendings: Record<string, Set<string>> = {};\n const waitlist: Record<string, Set<string>> = {};\n\n // validate input relation and set pendings and wait list\n computedNodeIds.forEach((computedNodeId) => {\n const nodeData = graphData.nodes[computedNodeId];\n pendings[computedNodeId] = new Set<string>();\n\n const dataSourceValidator = (sourceType: string, sourceNodeIds: string[]) => {\n sourceNodeIds.forEach((sourceNodeId) => {\n if (sourceNodeId) {\n if (!nodeIds.has(sourceNodeId)) {\n throw new ValidationError(`${sourceType} not match: NodeId ${computedNodeId}, Inputs: ${sourceNodeId}`);\n }\n waitlist[sourceNodeId] === undefined && (waitlist[sourceNodeId] = new Set<string>());\n pendings[computedNodeId].add(sourceNodeId);\n waitlist[sourceNodeId].add(computedNodeId);\n }\n });\n };\n if (nodeData && isComputedNodeData(nodeData)) {\n if (nodeData.inputs) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources(nodeData.inputs));\n dataSourceValidator(\"Inputs\", sourceNodeIds);\n }\n if (nodeData.params) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources(nodeData.params));\n dataSourceValidator(\"Params\", sourceNodeIds);\n }\n if (nodeData.if) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ if: nodeData.if }));\n dataSourceValidator(\"If\", sourceNodeIds);\n }\n if (nodeData.unless) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ unless: nodeData.unless }));\n dataSourceValidator(\"Unless\", sourceNodeIds);\n }\n if (nodeData.graph && typeof nodeData?.graph === \"string\") {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ graph: nodeData.graph }));\n dataSourceValidator(\"Graph\", sourceNodeIds);\n }\n if (typeof nodeData.agent === \"string\" && nodeData.agent[0] === \":\") {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ agent: nodeData.agent }));\n dataSourceValidator(\"Agent\", sourceNodeIds);\n }\n }\n });\n\n // TODO. validate update\n staticNodeIds.forEach((staticNodeId) => {\n const nodeData = graphData.nodes[staticNodeId];\n if (isStaticNodeData(nodeData) && nodeData.update) {\n const update = nodeData.update;\n const updateNodeId = parseNodeName(update).nodeId;\n if (!updateNodeId) {\n throw new ValidationError(\"Update it a literal\");\n }\n if (!nodeIds.has(updateNodeId)) {\n throw new ValidationError(`Update not match: NodeId ${staticNodeId}, update: ${update}`);\n }\n }\n });\n\n const cycle = (possibles: string[]) => {\n possibles.forEach((possobleNodeId) => {\n (waitlist[possobleNodeId] || []).forEach((waitingNodeId) => {\n pendings[waitingNodeId].delete(possobleNodeId);\n });\n });\n\n const running: string[] = [];\n Object.keys(pendings).forEach((pendingNodeId) => {\n if (pendings[pendingNodeId].size === 0) {\n running.push(pendingNodeId);\n delete pendings[pendingNodeId];\n }\n });\n return running;\n };\n\n let runningQueue = cycle(staticNodeIds);\n if (runningQueue.length === 0) {\n throw new ValidationError(\"No Initial Runnning Node\");\n }\n\n do {\n runningQueue = cycle(runningQueue);\n } while (runningQueue.length > 0);\n\n if (Object.keys(pendings).length > 0) {\n throw new ValidationError(\"Some nodes are not executed: \" + Object.keys(pendings).join(\", \"));\n }\n};\n","import { ValidationError } from \"./common\";\n\nexport const agentValidator = (graphAgentIds: Set<string>, agentIds: Set<string>) => {\n graphAgentIds.forEach((agentId) => {\n // agentId or dynamic agentId\n if (!agentIds.has(agentId) && agentId[0] !== \":\") {\n throw new ValidationError(\"Invalid Agent : \" + agentId + \" is not in AgentFunctionInfoDictionary.\");\n }\n });\n return true;\n};\n","import { GraphData, AgentFunctionInfoDictionary } from \"./type\";\nimport { isStaticNodeData } from \"./utils/utils\";\nimport { graphNodesValidator, graphDataValidator } from \"./validators/graph_data_validator\";\nimport { nodeValidator } from \"./validators/nodeValidator\";\nimport { staticNodeValidator } from \"./validators/static_node_validator\";\nimport { computedNodeValidator } from \"./validators/computed_node_validator\";\nimport { relationValidator } from \"./validators/relation_validator\";\nimport { agentValidator } from \"./validators/agent_validator\";\n\nimport { ValidationError } from \"./validators/common\";\n\nexport const validateGraphData = (data: GraphData, agentIds: string[]) => {\n graphNodesValidator(data);\n graphDataValidator(data);\n const computedNodeIds: string[] = [];\n const staticNodeIds: string[] = [];\n const graphAgentIds = new Set<string>();\n Object.keys(data.nodes).forEach((nodeId) => {\n const node = data.nodes[nodeId];\n const isStaticNode = isStaticNodeData(node);\n nodeValidator(node);\n const agentId = isStaticNode ? \"\" : node.agent;\n isStaticNode && staticNodeValidator(node) && staticNodeIds.push(nodeId);\n !isStaticNode && computedNodeValidator(node) && computedNodeIds.push(nodeId) && typeof agentId === \"string\" && graphAgentIds.add(agentId);\n });\n agentValidator(graphAgentIds, new Set<string>(agentIds));\n relationValidator(data, staticNodeIds, computedNodeIds);\n\n return true;\n};\n\nexport const validateAgent = (agentFunctionInfoDictionary: AgentFunctionInfoDictionary) => {\n Object.keys(agentFunctionInfoDictionary).forEach((agentId: string) => {\n if (agentId !== \"default\") {\n const agentInfo = agentFunctionInfoDictionary[agentId];\n if (!agentInfo || !agentInfo.agent) {\n throw new ValidationError(\"No Agent: \" + agentId + \" is not in AgentFunctionInfoDictionary.\");\n }\n }\n });\n};\n","import { ComputedNode } from \"./node\";\nimport { assert } from \"./utils/utils\";\n\ntype TaskEntry = {\n node: ComputedNode;\n graphId: string;\n callback: (node: ComputedNode) => void;\n};\n\n// TaskManage object controls the concurrency of ComputedNode execution.\n//\n// NOTE: A TaskManager instance will be shared between parent graph and its children\n// when nested agents are involved.\nexport class TaskManager {\n private concurrency: number;\n private taskQueue: Array<TaskEntry> = [];\n private runningNodes = new Set<ComputedNode>();\n\n constructor(concurrency: number) {\n this.concurrency = concurrency;\n }\n\n // This internal method dequeus a task from the task queue\n // and call the associated callback method, if the number of\n // running task is lower than the spcified limit.\n private dequeueTaskIfPossible() {\n if (this.runningNodes.size < this.concurrency) {\n const task = this.taskQueue.shift();\n if (task) {\n this.runningNodes.add(task.node);\n task.callback(task.node);\n }\n }\n }\n\n // Node will call this method to put itself in the execution queue.\n // We call the associated callback function when it is dequeued.\n public addTask(node: ComputedNode, graphId: string, callback: (node: ComputedNode) => void) {\n // Finder tasks in the queue, which has either the same or higher priority.\n const count = this.taskQueue.filter((task) => {\n return task.node.priority >= node.priority;\n }).length;\n assert(count <= this.taskQueue.length, \"TaskManager.addTask: Something is really wrong.\");\n this.taskQueue.splice(count, 0, { node, graphId, callback });\n this.dequeueTaskIfPossible();\n }\n\n public isRunning(graphId: string) {\n const count = [...this.runningNodes].filter((node) => {\n return node.graphId == graphId;\n }).length;\n return count > 0 || Array.from(this.taskQueue).filter((data) => data.graphId === graphId).length > 0;\n }\n\n // Node MUST call this method once the execution of agent function is completed\n // either successfully or not.\n public onComplete(node: ComputedNode) {\n assert(this.runningNodes.has(node), `TaskManager.onComplete node(${node.nodeId}) is not in list`);\n this.runningNodes.delete(node);\n this.dequeueTaskIfPossible();\n }\n\n // Node will call this method before it hands the task manager from the graph\n // to a nested agent. We need to make it sure that there is enough room to run\n // computed nodes inside the nested graph to avoid a deadlock.\n public prepareForNesting() {\n this.concurrency++;\n }\n\n public restoreAfterNesting() {\n this.concurrency--;\n }\n\n public getStatus(verbose: boolean = false) {\n const runningNodes = Array.from(this.runningNodes).map((node) => node.nodeId);\n const queuedNodes = this.taskQueue.map((task) => task.node.nodeId);\n const nodes = verbose ? { runningNodes, queuedNodes } : {};\n return {\n concurrency: this.concurrency,\n queue: this.taskQueue.length,\n running: this.runningNodes.size,\n ...nodes,\n };\n }\n}\n","import {\n AgentFunctionInfoDictionary,\n AgentFilterInfo,\n GraphData,\n DataSource,\n LoopData,\n ResultDataDictionary,\n ResultData,\n DefaultResultData,\n GraphOptions,\n PropFunction,\n GraphDataLoader,\n ConfigDataDictionary,\n CallbackFunction,\n} from \"./type\";\nimport { TransactionLog } from \"./transaction_log\";\n\nimport { ComputedNode, StaticNode, GraphNodes } from \"./node\";\n\nimport { resultsOf, resultOf, cleanResult } from \"./utils/result\";\nimport { propFunctions } from \"./utils/prop_function\";\nimport { parseNodeName, assert, isLogicallyTrue, isComputedNodeData, loopCounterKey } from \"./utils/utils\";\nimport { getDataFromSource } from \"./utils/data_source\";\n\nimport { validateGraphData, validateAgent } from \"./validator\";\nimport { TaskManager } from \"./task_manager\";\nimport { GraphAILogger } from \"./utils/GraphAILogger\";\n\nexport const defaultConcurrency = 8;\nexport const graphDataLatestVersion = 0.5;\n\nexport class GraphAI {\n public readonly version: number;\n public readonly graphId: string;\n private readonly graphData: GraphData;\n private readonly loop?: LoopData;\n private readonly forceLoop: boolean;\n private readonly logs: Array<TransactionLog> = [];\n public readonly bypassAgentIds: string[];\n public readonly config?: ConfigDataDictionary = {};\n public readonly agentFunctionInfoDictionary: AgentFunctionInfoDictionary;\n public readonly taskManager: TaskManager;\n public readonly agentFilters: AgentFilterInfo[];\n public readonly retryLimit?: number;\n public readonly propFunctions: PropFunction[];\n public readonly graphLoader?: GraphDataLoader;\n\n public nodes: GraphNodes;\n public onLogCallback: CallbackFunction = (__log: TransactionLog, __isUpdate: boolean) => {};\n public callbacks: CallbackFunction[] = [];\n public verbose: boolean; // REVIEW: Do we need this?\n\n private onComplete: (isAbort: boolean) => void;\n private repeatCount = 0;\n\n // This method is called when either the GraphAI obect was created,\n // or we are about to start n-th iteration (n>2).\n private createNodes(graphData: GraphData) {\n const nodes = Object.keys(graphData.nodes).reduce((_nodes: GraphNodes, nodeId: string) => {\n const nodeData = graphData.nodes[nodeId];\n if (isComputedNodeData(nodeData)) {\n _nodes[nodeId] = new ComputedNode(this.graphId, nodeId, nodeData, this);\n } else {\n _nodes[nodeId] = new StaticNode(nodeId, nodeData, this);\n }\n return _nodes;\n }, {});\n\n // Generate the waitlist for each node.\n Object.keys(nodes).forEach((nodeId) => {\n const node = nodes[nodeId];\n if (node.isComputedNode) {\n node.pendings.forEach((pending) => {\n if (nodes[pending]) {\n nodes[pending].waitlist.add(nodeId); // previousNode\n } else {\n throw new Error(`createNode: invalid input ${pending} for node, ${nodeId}`);\n }\n });\n }\n });\n return nodes;\n }\n\n private getValueFromResults(source: DataSource, results: ResultDataDictionary<DefaultResultData>) {\n return getDataFromSource(source.nodeId ? results[source.nodeId] : undefined, source, this.propFunctions);\n }\n\n // for static\n private initializeStaticNodes(enableConsoleLog: boolean = false) {\n // If the result property is specified, inject it.\n // If the previousResults exists (indicating we are in a loop),\n // process the update property (nodeId or nodeId.propId).\n Object.keys(this.graphData.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node?.isStaticNode) {\n const value = node?.value;\n if (value !== undefined) {\n this.injectValue(nodeId, value, nodeId);\n }\n if (enableConsoleLog) {\n node.consoleLog();\n }\n }\n });\n }\n\n private updateStaticNodes(previousResults?: ResultDataDictionary<DefaultResultData>, enableConsoleLog: boolean = false) {\n // If the result property is specified, inject it.\n // If the previousResults exists (indicating we are in a loop),\n // process the update property (nodeId or nodeId.propId).\n Object.keys(this.graphData.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node?.isStaticNode) {\n const update = node?.update;\n if (update && previousResults) {\n const result = this.getValueFromResults(update, previousResults);\n this.injectValue(nodeId, result, update.nodeId);\n }\n if (enableConsoleLog) {\n node.consoleLog();\n }\n }\n });\n }\n\n constructor(\n graphData: GraphData,\n agentFunctionInfoDictionary: AgentFunctionInfoDictionary,\n options: GraphOptions = {\n taskManager: undefined,\n agentFilters: [],\n bypassAgentIds: [],\n config: {},\n graphLoader: undefined,\n forceLoop: false,\n },\n ) {\n if (!graphData.version && !options.taskManager) {\n GraphAILogger.warn(\"------------ missing version number\");\n }\n this.version = graphData.version ?? graphDataLatestVersion;\n if (this.version < graphDataLatestVersion) {\n GraphAILogger.warn(`------------ upgrade to ${graphDataLatestVersion}!`);\n }\n this.retryLimit = graphData.retry; // optional\n this.graphId = `${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 9)}`; // URL.createObjectURL(new Blob()).slice(-36);\n this.agentFunctionInfoDictionary = agentFunctionInfoDictionary;\n this.propFunctions = propFunctions;\n this.taskManager = options.taskManager ?? new TaskManager(graphData.concurrency ?? defaultConcurrency);\n this.agentFilters = options.agentFilters ?? [];\n this.bypassAgentIds = options.bypassAgentIds ?? [];\n this.config = options.config;\n this.graphLoader = options.graphLoader;\n this.forceLoop = options.forceLoop ?? false;\n this.loop = graphData.loop;\n this.verbose = graphData.verbose === true;\n this.onComplete = (__isAbort: boolean) => {\n throw new Error(\"SOMETHING IS WRONG: onComplete is called without run()\");\n };\n\n validateGraphData(graphData, [...Object.keys(agentFunctionInfoDictionary), ...this.bypassAgentIds]);\n validateAgent(agentFunctionInfoDictionary);\n\n this.graphData = {\n ...graphData,\n nodes: {\n ...graphData.nodes,\n [loopCounterKey]: { value: 0, update: `:${loopCounterKey}.add(1)` },\n },\n };\n this.nodes = this.createNodes(this.graphData);\n this.initializeStaticNodes(true);\n }\n\n public getAgentFunctionInfo(agentId?: string) {\n if (agentId && this.agentFunctionInfoDictionary[agentId]) {\n return this.agentFunctionInfoDictionary[agentId];\n }\n if (agentId && this.bypassAgentIds.includes(agentId)) {\n return {\n agent: async () => {\n return null;\n },\n hasGraphData: false,\n inputs: null,\n cacheType: undefined, // for node.getContext\n };\n }\n // We are not supposed to hit this error because the validator will catch it.\n throw new Error(\"No agent: \" + agentId);\n }\n\n public asString() {\n return Object.values(this.nodes)\n .map((node) => node.asString())\n .join(\"\\n\");\n }\n\n // Public API\n public results<T = DefaultResultData>(all: boolean): ResultDataDictionary<T> {\n return Object.keys(this.nodes)\n .filter((nodeId) => (all && nodeId !== loopCounterKey) || this.nodes[nodeId].isResult)\n .reduce((results: ResultDataDictionary<T>, nodeId) => {\n const node = this.nodes[nodeId];\n if (node.result !== undefined) {\n results[nodeId] = node.result as T;\n }\n return results;\n }, {});\n }\n\n // Public API\n public errors(): Record<string, Error> {\n return Object.keys(this.nodes).reduce((errors: Record<string, Error>, nodeId) => {\n const node = this.nodes[nodeId];\n if (node.isComputedNode) {\n if (node.error !== undefined) {\n errors[nodeId] = node.error;\n }\n }\n return errors;\n }, {});\n }\n\n private pushReadyNodesIntoQueue() {\n // Nodes without pending data should run immediately.\n Object.keys(this.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node.isComputedNode) {\n this.pushQueueIfReady(node);\n }\n });\n }\n\n private pushQueueIfReady(node: ComputedNode) {\n if (node.isReadyNode()) {\n this.pushQueue(node);\n }\n }\n\n public pushQueueIfReadyAndRunning(node: ComputedNode) {\n if (this.isRunning()) {\n this.pushQueueIfReady(node);\n }\n }\n\n // for computed\n public pushQueue(node: ComputedNode) {\n node.beforeAddTask();\n\n this.taskManager.addTask(node, this.graphId, (_node) => {\n assert(node.nodeId === _node.nodeId, \"GraphAI.pushQueue node mismatch\");\n node.execute();\n });\n }\n\n // Public API\n public async run<T = DefaultResultData>(all: boolean = false): Promise<ResultDataDictionary<T>> {\n if (\n Object.values(this.nodes)\n .filter((node) => node.isStaticNode)\n .some((node) => node.result === undefined && node.update === undefined)\n ) {\n throw new Error(\"Static node must have value. Set value or injectValue or set update\");\n }\n if (this.isRunning()) {\n throw new Error(\"This GraphAI instance is already running\");\n }\n\n this.pushReadyNodesIntoQueue();\n\n if (!this.isRunning()) {\n GraphAILogger.warn(\"-- nothing to execute\");\n return {};\n }\n\n return new Promise((resolve, reject) => {\n this.onComplete = (isAbort: boolean = false) => {\n const errors = this.errors();\n const errorNodeIds = Object.keys(errors);\n if (errorNodeIds.length > 0 || isAbort) {\n reject(errors[errorNodeIds[0]]);\n } else {\n resolve(this.results(all));\n }\n };\n });\n }\n\n public abort() {\n if (this.isRunning()) {\n this.resetPending();\n }\n // For an agent like an event agent, where an external promise remains unresolved,\n // aborting and then retrying can cause nodes or the graph to execute again.\n // To prevent this, the transactionId is updated to ensure the retry fails.\n Object.values(this.nodes).forEach((node) => node.isComputedNode && (node.transactionId = undefined));\n this.onComplete(this.isRunning());\n }\n public resetPending() {\n Object.values(this.nodes).map((node) => {\n if (node.isComputedNode) {\n node.resetPending();\n }\n });\n }\n\n // Public only for testing\n public isRunning() {\n return this.taskManager.isRunning(this.graphId);\n }\n\n // callback from execute\n public onExecutionComplete(node: ComputedNode) {\n this.taskManager.onComplete(node);\n if (this.isRunning() || this.processLoopIfNecessary()) {\n return; // continue running\n }\n this.onComplete(false); // Nothing to run. Finish it.\n }\n\n // Must be called only from onExecutionComplete righ after removeRunning\n // Check if there is any running computed nodes.\n // In case of no running computed note, start the another iteration if ncessary (loop)\n private processLoopIfNecessary() {\n //\n if (!this.forceLoop && Object.keys(this.errors()).length > 0) {\n return false;\n }\n\n this.repeatCount++;\n const loop = this.loop;\n if (!loop) {\n return false;\n }\n\n // We need to update static nodes, before checking the condition\n const previousResults = this.results(true); // results from previous loop\n this.updateStaticNodes(previousResults);\n\n if (loop.count === undefined || this.repeatCount < loop.count) {\n if (loop.while) {\n const source = parseNodeName(loop.while);\n const value = this.getValueFromResults(source, this.results(true));\n // NOTE: We treat an empty array as false.\n if (!isLogicallyTrue(value)) {\n return false; // while condition is not met\n }\n }\n this.initializeGraphAI();\n this.updateStaticNodes(previousResults, true);\n this.pushReadyNodesIntoQueue();\n return true; // Indicating that we are going to continue.\n }\n return false;\n }\n\n public initializeGraphAI() {\n if (this.isRunning()) {\n throw new Error(\"This GraphAI instance is running\");\n }\n this.nodes = this.createNodes(this.graphData);\n this.initializeStaticNodes();\n }\n public setPreviousResults(previousResults: ResultDataDictionary<DefaultResultData>) {\n this.updateStaticNodes(previousResults);\n }\n public setLoopLog(log: TransactionLog) {\n log.isLoop = !!this.loop;\n log.repeatCount = this.repeatCount;\n }\n\n public appendLog(log: TransactionLog) {\n this.logs.push(log);\n this.onLogCallback(log, false);\n this.callbacks.forEach((callback) => callback(log, false));\n }\n\n public updateLog(log: TransactionLog) {\n this.onLogCallback(log, true);\n this.callbacks.forEach((callback) => callback(log, false));\n }\n\n public registerCallback(callback: CallbackFunction) {\n this.callbacks.push(callback);\n }\n\n public clearCallbacks() {\n this.callbacks = [];\n }\n\n // Public API\n public transactionLogs() {\n return this.logs;\n }\n\n // Public API\n public injectValue(nodeId: string, value: ResultData, injectFrom?: string): void {\n const node = this.nodes[nodeId];\n if (node && node.isStaticNode) {\n node.injectValue(value, injectFrom);\n } else {\n throw new Error(`injectValue with Invalid nodeId, ${nodeId}`);\n }\n }\n\n public resultsOf(inputs?: Record<string, any>, anyInput: boolean = false) {\n const results = resultsOf(inputs ?? {}, this.nodes, this.propFunctions);\n if (anyInput) {\n return cleanResult(results);\n }\n return results;\n }\n public resultOf(source: DataSource) {\n return resultOf(source, this.nodes, this.propFunctions);\n }\n}\n"],"names":[],"mappings":"IAIY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,SAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,SAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC;AACpC,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAXW,SAAS,KAAT,SAAS,GAWpB,EAAA,CAAA,CAAA;;ACZD,MAAM,aAAa,GAA8B;AAC/C,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE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B,CAAC,QAA0B,EAAA;AAChD,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;;IAGxB,cAAc,GAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,EAAE;;;IAId,eAAe,GAAA;QACpB,OAAO,IAAI,CAAC,IAAI;;;AAIX,IAAA,WAAW,CAAC,MAAc,EAAE,KAAiB,EAAE,UAAmB,EAAA;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;AAC/B,QAAA,IAAI,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE;AAC7B,YAAA,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC;;aAC9B;AACL,YAAA,MAAM,IAAI,KAAK,CAAC,oCAAoC,MAAM,CAAA,CAAE,CAAC;;;AAI1D,IAAA,SAAS,CAAC,MAA4B,EAAE,QAAA,GAAoB,KAAK,EAAA;AACtE,QAAA,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,IAAI,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;QACvE,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,WAAW,CAAC,OAAO,CAAC;;AAE7B,QAAA,OAAO,OAAO;;AAET,IAAA,QAAQ,CAAC,MAAkB,EAAA;AAChC,QAAA,OAAO,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;;AAE1D;;;;"}
1
+ {"version":3,"file":"bundle.esm.js","sources":["../src/type.ts","../src/utils/GraphAILogger.ts","../src/utils/prop_function.ts","../src/utils/utils.ts","../src/utils/nodeUtils.ts","../src/transaction_log.ts","../src/utils/data_source.ts","../src/utils/result.ts","../src/node.ts","../src/validators/common.ts","../src/validators/graph_data_validator.ts","../src/validators/nodeValidator.ts","../src/validators/static_node_validator.ts","../src/validators/computed_node_validator.ts","../src/validators/relation_validator.ts","../src/validators/agent_validator.ts","../src/validator.ts","../src/task_manager.ts","../src/graphai.ts"],"sourcesContent":["import type { TransactionLog } from \"./transaction_log\";\nimport type { TaskManager } from \"./task_manager\";\nimport type { GraphAI } from \"./graphai\";\n\nexport enum NodeState {\n Waiting = \"waiting\",\n Queued = \"queued\",\n Executing = \"executing\",\n ExecutingServer = \"executing-server\",\n Failed = \"failed\",\n TimedOut = \"timed-out\",\n Abort = \"abort\",\n Completed = \"completed\",\n Injected = \"injected\",\n Skipped = \"skipped\",\n}\n\nexport type DefaultResultData = Record<string, any> | string | number | boolean | Array<DefaultResultData>;\nexport type DefaultInputData = Record<string, any>;\nexport type DefaultConfigData = Record<string, any>;\nexport type ResultData<ResultType = DefaultResultData> = ResultType | undefined;\nexport type ResultDataDictionary<ResultType = DefaultResultData> = Record<string, ResultData<ResultType>>;\n\nexport type ConfigData<ConfigType = DefaultConfigData> = ConfigType;\nexport type ConfigDataDictionary<ConfigType = DefaultConfigData> = Record<string, ConfigType>;\nexport type DefaultParamsType = Record<string, any>;\nexport type NodeDataParams<ParamsType = DefaultParamsType> = ParamsType; // Agent-specific parameters\n\nexport type PassThrough = Record<string, any>;\n\nexport type DataSource = {\n nodeId?: string;\n value?: any;\n propIds?: string[];\n};\n\ntype ConsoleAttribute = boolean | string | Record<string, any>;\nexport type ConsoleElement = boolean | { before?: ConsoleAttribute; after?: ConsoleAttribute };\n\nexport type StaticNodeData = {\n value?: ResultData; // initial value for static node.\n update?: string; // nodeId (+.propId) to get value after a loop\n isResult?: boolean;\n console?: ConsoleElement;\n};\nexport type AgentAnonymousFunction = (...params: any[]) => unknown;\n\nexport type AgentFilterParams = Record<string, any>;\n\nexport type GraphDataLoaderOption = { fileName: string; option?: any };\n\nexport type ComputedNodeData = {\n agent: string | AgentAnonymousFunction;\n inputs?: Record<string, any>;\n output?: Record<string, any>;\n anyInput?: boolean; // any input makes this node ready\n params?: NodeDataParams;\n filterParams?: AgentFilterParams; // agent filter\n retry?: number;\n timeout?: number; // msec\n if?: string; // conditional execution\n unless?: string; // conditional execution\n defaultValue?: ResultData;\n graph?: GraphData | string;\n graphLoader?: GraphDataLoaderOption;\n isResult?: boolean;\n priority?: number; // The default is 0.\n passThrough?: PassThrough; // data that pass trough to result\n console?: ConsoleElement;\n};\n\nexport type NodeData = StaticNodeData | ComputedNodeData;\n\nexport type LoopData = {\n count?: number;\n while?: string | boolean;\n};\n\nexport type GraphData = {\n version?: number; // major version, 0.1, 0.2, ...\n nodes: Record<string, NodeData>;\n concurrency?: number;\n loop?: LoopData;\n verbose?: boolean;\n retry?: number;\n metadata?: any; // Stores information about GraphData. GraphAI itself is not used this data.\n};\n\nexport type GraphDataLoader = (loaderOption: GraphDataLoaderOption) => GraphData;\n\nexport type GraphOptions = {\n agentFilters?: AgentFilterInfo[] | undefined;\n taskManager?: TaskManager | undefined;\n bypassAgentIds?: string[] | undefined;\n config?: ConfigDataDictionary;\n graphLoader?: GraphDataLoader;\n forceLoop?: boolean;\n};\n\nexport type CacheTypes = \"pureAgent\" | \"impureAgent\";\n\nexport type AgentFunctionContextDebugInfo = {\n verbose: boolean;\n nodeId: string;\n state: string;\n subGraphs: Map<string, GraphAI>;\n retry: number;\n agentId?: string;\n version?: number;\n isResult?: boolean;\n};\n\nexport type AgentFunctionContext<ParamsType = DefaultParamsType, NamedInputDataType = DefaultInputData, ConfigType = DefaultConfigData> = {\n params: NodeDataParams<ParamsType>;\n inputSchema?: any;\n namedInputs: NamedInputDataType;\n debugInfo: AgentFunctionContextDebugInfo;\n forNestedGraph?: {\n graphData?: GraphData; // nested graph\n agents: AgentFunctionInfoDictionary; // for nested graph\n graphOptions: GraphOptions;\n onLogCallback?: (log: TransactionLog, isUpdate: boolean) => void;\n callbacks?: CallbackFunction[];\n };\n cacheType?: CacheTypes;\n filterParams: AgentFilterParams; // agent filter\n log?: TransactionLog[];\n config?: ConfigType;\n};\n\nexport type AgentFunction<\n ParamsType = DefaultParamsType,\n ResultType = DefaultResultData,\n NamedInputDataType = DefaultInputData,\n ConfigType = DefaultConfigData,\n> = (context: AgentFunctionContext<ParamsType, NamedInputDataType, ConfigType>) => Promise<ResultData<ResultType>>;\n\nexport type AgentFilterFunction<ParamsType = DefaultParamsType, ResultType = DefaultResultData, NamedInputDataType = DefaultInputData> = (\n context: AgentFunctionContext<ParamsType, NamedInputDataType>,\n agent: AgentFunction,\n) => Promise<ResultData<ResultType>>;\n\nexport type AgentFilterInfo = {\n name: string;\n agent: AgentFilterFunction;\n agentIds?: string[];\n nodeIds?: string[];\n filterParams?: AgentFilterParams;\n};\n\nexport type AgentFunctionInfoSample = {\n inputs: any;\n params: DefaultParamsType;\n result: any;\n graph?: GraphData;\n};\n\nexport type AgentFunctionInfo = {\n name: string;\n agent: AgentFunction<any, any, any, any>;\n mock: AgentFunction<any, any, any, any>;\n inputs?: any; // inputs data schema\n output?: any; // output data schema\n params?: any; // params data schema\n config?: any; // config data schema\n outputFormat?: any;\n tools?: Record<string, any>[]; // function calling(tools) schema.\n samples: AgentFunctionInfoSample[]; // sample data. This is for document and unit test.\n description: string;\n category: string[];\n author: string;\n repository: string;\n source?: string;\n package?: string;\n license: string;\n cacheType?: CacheTypes;\n environmentVariables?: string[]; // Environment variables required for execution\n hasGraphData?: boolean; // The agent that executes graph data using nestedAgentGenerator is true\n stream?: boolean; // is stream support?\n apiKeys?: string[];\n npms?: string[];\n};\n\nexport type AgentFunctionInfoDictionary = Record<string, AgentFunctionInfo>;\n\nexport type PropFunction = (result: ResultData, propId: string) => ResultData;\n\nexport type CallbackFunction = (log: TransactionLog, isUpdate: boolean) => void;\n","type LogLevel = \"debug\" | \"info\" | \"log\" | \"warn\" | \"error\";\ntype LoggerFunction = (level: LogLevel, ...args: any[]) => void;\n\nconst enabledLevels: Record<LogLevel, boolean> = {\n debug: true,\n info: true,\n log: true,\n warn: true,\n error: true,\n};\n\nlet customLogger: LoggerFunction | null = null;\n\nfunction setLevelEnabled(level: LogLevel, enabled: boolean) {\n enabledLevels[level] = enabled;\n}\n\nfunction setLogger(logger: LoggerFunction) {\n customLogger = logger;\n}\n\nfunction output(level: LogLevel, ...args: any[]) {\n if (!enabledLevels[level]) return;\n if (customLogger) {\n customLogger(level, ...args);\n } else {\n (console[level] || console.log)(...args);\n }\n}\n\nfunction debug(...args: any[]) {\n output(\"debug\", ...args);\n}\nfunction info(...args: any[]) {\n output(\"info\", ...args);\n}\nfunction log(...args: any[]) {\n output(\"log\", ...args);\n}\nfunction warn(...args: any[]) {\n output(\"warn\", ...args);\n}\nfunction error(...args: any[]) {\n output(\"error\", ...args);\n}\n\nexport const GraphAILogger = {\n setLevelEnabled,\n setLogger,\n debug,\n info,\n log,\n warn,\n error,\n};\n","import { PropFunction } from \"../type\";\nimport { isObject, loopCounterKey } from \"./utils\";\nimport { GraphNodes } from \"../node\";\nimport { GraphAILogger } from \"./GraphAILogger\";\n\nexport const propFunctionRegex = /^[a-zA-Z]+\\([^)]*\\)$/;\n\nconst propArrayFunction: PropFunction = (result, propId) => {\n if (Array.isArray(result)) {\n if (propId === \"length()\") {\n return result.length;\n }\n if (propId === \"flat()\") {\n return result.flat();\n }\n if (propId === \"toJSON()\") {\n return JSON.stringify(result, null, 2);\n }\n if (propId === \"isEmpty()\") {\n return result.length === 0;\n }\n // array join\n const matchJoin = propId.match(/^join\\(([,-\\s]?)\\)$/);\n if (matchJoin && Array.isArray(matchJoin)) {\n return result.join(matchJoin[1] ?? \"\");\n }\n }\n return undefined;\n};\n\nconst propObjectFunction: PropFunction = (result, propId) => {\n if (isObject(result)) {\n if (propId === \"keys()\") {\n return Object.keys(result);\n }\n if (propId === \"values()\") {\n return Object.values(result);\n }\n if (propId === \"toJSON()\") {\n return JSON.stringify(result, null, 2);\n }\n }\n return undefined;\n};\n\nconst propStringFunction: PropFunction = (result, propId) => {\n if (typeof result === \"string\") {\n if (propId === \"codeBlock()\") {\n const match = (\"\\n\" + result).match(/\\n```[a-zA-z]*([\\s\\S]*?)\\n```/);\n if (match) {\n return match[1];\n }\n }\n if (propId === \"jsonParse()\") {\n return JSON.parse(result);\n }\n if (propId === \"toNumber()\") {\n const ret = Number(result);\n if (!isNaN(ret)) {\n return ret;\n }\n }\n if (propId === \"trim()\") {\n return result.trim();\n }\n if (propId === \"toLowerCase()\") {\n return result.toLowerCase();\n }\n if (propId === \"toUpperCase()\") {\n return result.toUpperCase();\n }\n const sliceMatch = propId.match(/^slice\\((-?\\d+)(?:,\\s*(-?\\d+))?\\)/);\n if (sliceMatch) {\n if (sliceMatch[2] !== undefined) {\n return result.slice(Number(sliceMatch[1]), Number(sliceMatch[2]));\n }\n if (sliceMatch[1] !== undefined) {\n return result.slice(Number(sliceMatch[1]));\n }\n GraphAILogger.warn(\"slice is not valid format: \" + sliceMatch);\n }\n\n const splitMatch = propId.match(/^split\\(([-_:;.,\\s\\n]+)\\)$/);\n if (splitMatch) {\n return result.split(splitMatch[1]);\n }\n }\n return undefined;\n};\nconst propNumberFunction: PropFunction = (result, propId) => {\n if (result !== undefined && Number.isFinite(result)) {\n if (propId === \"toString()\") {\n return String(result);\n }\n const regex = /^add\\((-?\\d+)\\)$/;\n const match = propId.match(regex);\n if (match) {\n return Number(result) + Number(match[1]);\n }\n }\n return undefined;\n};\nconst propBooleanFunction: PropFunction = (result, propId) => {\n if (typeof result === \"boolean\") {\n if (propId === \"not()\") {\n return !result;\n }\n }\n return undefined;\n};\n\nexport const propFunctions = [propArrayFunction, propObjectFunction, propStringFunction, propNumberFunction, propBooleanFunction];\n\nexport const utilsFunctions = (input: string, nodes: GraphNodes) => {\n if (input === \"@now\" || input === \"@now_ms\") {\n return Date.now();\n }\n if (input === \"@now_s\") {\n return Math.floor(Date.now() / 1000);\n }\n if (input === \"@loop\") {\n return nodes[loopCounterKey].result as string;\n }\n // If a placeholder does not match any key, replace it with an empty string.\n GraphAILogger.warn(\"not match template utility function: ${\" + input + \"}\");\n return \"\";\n};\n","import { DataSource, AgentFunction, AgentFunctionInfo, NodeData, StaticNodeData, ComputedNodeData, NodeState } from \"../type\";\nimport type { GraphNodes } from \"../node\";\nimport { GraphAILogger } from \"./GraphAILogger\";\nimport { utilsFunctions } from \"./prop_function\";\n\nexport const sleep = async (milliseconds: number) => {\n return await new Promise((resolve) => setTimeout(resolve, milliseconds));\n};\n\nexport const parseNodeName = (inputNodeId: any, isSelfNode: boolean = false, nodes?: GraphNodes): DataSource => {\n if (isSelfNode) {\n if (typeof inputNodeId === \"string\" && inputNodeId[0] === \".\") {\n const parts = inputNodeId.split(\".\");\n return { nodeId: \"self\", propIds: parts.slice(1) };\n }\n return { value: inputNodeId };\n }\n if (typeof inputNodeId === \"string\") {\n const regex = /^:(.*)$/;\n const match = inputNodeId.match(regex);\n if (match) {\n const parts = match[1].split(/(?<!\\()\\.(?!\\))/);\n if (parts.length == 1) {\n return { nodeId: parts[0] };\n }\n return { nodeId: parts[0], propIds: parts.slice(1) };\n }\n const regexUtil = /^@(.*)$/;\n const matchUtil = inputNodeId.match(regexUtil);\n // Only when just called from resultsOfInner\n if (nodes && matchUtil) {\n return { value: utilsFunctions(inputNodeId, nodes) };\n }\n }\n return { value: inputNodeId }; // non-string literal\n};\n\nexport function assert(condition: boolean, message: string, isWarn: boolean = false): asserts condition {\n if (!condition) {\n if (!isWarn) {\n throw new Error(message);\n }\n GraphAILogger.warn(\"warn: \" + message);\n }\n}\n\nexport const isObject = <Values = unknown>(x: unknown): x is Record<string, Values> => {\n return x !== null && typeof x === \"object\";\n};\n\nexport const isNull = (data: unknown) => {\n return data === null || data === undefined;\n};\n\nexport const strIntentionalError = \"Intentional Error for Debugging\";\n\nexport const defaultAgentInfo = {\n name: \"defaultAgentInfo\",\n samples: [\n {\n inputs: [],\n params: {},\n result: {},\n },\n ],\n description: \"\",\n category: [],\n author: \"\",\n repository: \"\",\n license: \"\",\n};\n\nexport const agentInfoWrapper = (agent: AgentFunction<any, any, any, any>): AgentFunctionInfo => {\n return {\n agent,\n mock: agent,\n ...defaultAgentInfo,\n };\n};\n\nconst objectToKeyArray = (innerData: any) => {\n const ret: string[][] = [];\n Object.keys(innerData).forEach((key: string) => {\n ret.push([key]);\n if (Object.keys(innerData[key]).length > 0) {\n objectToKeyArray(innerData[key]).forEach((tmp: string[]) => {\n ret.push([key, ...tmp]);\n });\n }\n });\n return ret;\n};\n\nexport const debugResultKey = (agentId: string, result: any) => {\n return objectToKeyArray({ [agentId]: debugResultKeyInner(result) }).map((objectKeys: string[]) => {\n return \":\" + objectKeys.join(\".\");\n });\n};\n\nconst debugResultKeyInner = (result: any) => {\n if (result === null || result === undefined) {\n return {};\n }\n if (typeof result === \"string\") {\n return {};\n }\n if (Array.isArray(result)) {\n return Array.from(result.keys()).reduce((tmp: Record<string, any>, index: number) => {\n tmp[\"$\" + String(index)] = debugResultKeyInner(result[index]);\n return tmp;\n }, {});\n }\n return Object.keys(result).reduce((tmp: Record<string, any>, key: string) => {\n tmp[key] = debugResultKeyInner(result[key]);\n return tmp;\n }, {});\n};\n\nexport const isLogicallyTrue = (value: any) => {\n // Notice that empty aray is not true under GraphAI\n if (Array.isArray(value) ? value.length === 0 : !value) {\n return false;\n }\n return true;\n};\n\nexport const defaultTestContext = {\n debugInfo: {\n nodeId: \"test\",\n retry: 0,\n verbose: true,\n state: NodeState.Executing,\n subGraphs: new Map(),\n },\n params: {},\n filterParams: {},\n agents: {},\n log: [],\n};\n\nexport const isNamedInputs = <Values = unknown>(namedInputs: unknown): namedInputs is Record<string, Values> => {\n return isObject(namedInputs) && !Array.isArray(namedInputs) && Object.keys(namedInputs || {}).length > 0;\n};\n\nexport const isComputedNodeData = (node: NodeData): node is ComputedNodeData => {\n return \"agent\" in node;\n};\n\nexport const isStaticNodeData = (node: NodeData): node is StaticNodeData => {\n return !(\"agent\" in node);\n};\n\nexport const loopCounterKey: string = \"__loopIndex\";\n","import { parseNodeName, isObject } from \"./utils\";\nimport { DataSource } from \"../type\";\n\n// for dataSource\nexport const inputs2dataSources = (inputs: any): DataSource[] => {\n if (Array.isArray(inputs)) {\n return inputs.map((inp) => inputs2dataSources(inp)).flat();\n }\n if (isObject(inputs)) {\n return Object.values(inputs)\n .map((input) => inputs2dataSources(input))\n .flat();\n }\n if (typeof inputs === \"string\") {\n const templateMatch = [...inputs.matchAll(/\\${(:[^}]+)}/g)].map((m) => m[1]);\n if (templateMatch.length > 0) {\n return inputs2dataSources(templateMatch);\n }\n }\n\n return parseNodeName(inputs) as any;\n};\n\n// TODO: Maybe it's a remnant of old array inputs. Check and delete.\nexport const dataSourceNodeIds = (sources: DataSource[]): string[] => {\n if (!Array.isArray(sources)) {\n throw new Error(\"sources must be array!! maybe inputs is invalid\");\n }\n return sources.filter((source: DataSource) => source.nodeId).map((source) => source.nodeId!);\n};\n","import { ResultData, NodeDataParams, NodeState } from \"./type\";\nimport type { GraphAI } from \"./graphai\";\nimport type { ComputedNode, StaticNode } from \"./node\";\nimport { debugResultKey } from \"./utils/utils\";\nimport { dataSourceNodeIds } from \"./utils/nodeUtils\";\n\nexport class TransactionLog {\n public nodeId: string;\n public state: NodeState;\n public startTime?: number;\n public endTime?: number;\n public retryCount?: number;\n public agentId?: string;\n public params?: NodeDataParams;\n public inputs?: string[];\n public inputsData?: Array<ResultData>;\n public injectFrom?: string;\n public errorMessage?: string;\n public result?: ResultData;\n public resultKeys?: string[];\n public mapIndex?: number;\n public isLoop?: boolean;\n public repeatCount?: number;\n public log?: TransactionLog[];\n constructor(nodeId: string) {\n this.nodeId = nodeId;\n this.state = NodeState.Waiting;\n }\n\n public initForComputedNode(node: ComputedNode, graph: GraphAI) {\n this.agentId = node.getAgentId();\n this.params = node.params;\n graph.appendLog(this);\n }\n\n public onInjected(node: StaticNode, graph: GraphAI, injectFrom?: string) {\n const isUpdating = \"endTime\" in this;\n this.result = node.result;\n this.state = node.state;\n this.endTime = Date.now();\n this.injectFrom = injectFrom;\n graph.setLoopLog(this);\n // console.log(this)\n if (isUpdating) {\n graph.updateLog(this);\n } else {\n graph.appendLog(this);\n }\n }\n\n public onComplete(node: ComputedNode, graph: GraphAI, localLog: TransactionLog[]) {\n this.result = node.result;\n this.resultKeys = debugResultKey(this.agentId || \"\", node.result);\n this.state = node.state;\n this.endTime = Date.now();\n graph.setLoopLog(this);\n if (localLog.length > 0) {\n this.log = localLog;\n }\n graph.updateLog(this);\n }\n\n public beforeExecute(node: ComputedNode, graph: GraphAI, transactionId: number, inputs: ResultData[]) {\n this.state = node.state;\n this.retryCount = node.retryCount > 0 ? node.retryCount : undefined;\n this.startTime = transactionId;\n this.inputs = dataSourceNodeIds(node.dataSources);\n this.inputsData = inputs.length > 0 ? inputs : undefined;\n graph.setLoopLog(this);\n graph.appendLog(this);\n }\n\n public beforeAddTask(node: ComputedNode, graph: GraphAI) {\n this.state = node.state;\n graph.setLoopLog(this);\n graph.appendLog(this);\n }\n\n public onError(node: ComputedNode, graph: GraphAI, errorMessage: string) {\n this.state = node.state;\n this.errorMessage = errorMessage;\n this.endTime = Date.now();\n graph.setLoopLog(this);\n graph.updateLog(this);\n }\n\n public onSkipped(node: ComputedNode, graph: GraphAI) {\n this.state = node.state;\n graph.setLoopLog(this);\n graph.updateLog(this);\n }\n}\n","import { ResultData, DataSource, PropFunction } from \"../type\";\nimport { isObject, isNull } from \"./utils\";\nimport { propFunctionRegex } from \"./prop_function\";\nimport { GraphAILogger } from \"./GraphAILogger\";\n\nconst getNestedData = (result: ResultData, propId: string, propFunctions: PropFunction[]) => {\n const match = propId.match(propFunctionRegex);\n if (match) {\n for (const propFunction of propFunctions) {\n const ret = propFunction(result, propId);\n if (!isNull(ret)) {\n return ret;\n }\n }\n }\n\n // for array.\n if (Array.isArray(result)) {\n // $0, $1. array value.\n const regex = /^\\$(\\d+)$/;\n const match = propId.match(regex);\n if (match) {\n const index = parseInt(match[1], 10);\n return result[index];\n }\n if (propId === \"$last\") {\n return result[result.length - 1];\n }\n } else if (isObject(result)) {\n if (propId in result) {\n return result[propId];\n }\n }\n return undefined;\n};\n\nconst innerGetDataFromSource = (result: ResultData, propIds: string[] | undefined, propFunctions: PropFunction[]): ResultData | undefined => {\n if (!isNull(result) && propIds && propIds.length > 0) {\n const propId = propIds[0];\n const ret = getNestedData(result, propId, propFunctions);\n if (ret === undefined) {\n GraphAILogger.error(`prop: ${propIds.join(\".\")} is not hit`);\n }\n if (propIds.length > 1) {\n return innerGetDataFromSource(ret, propIds.slice(1), propFunctions);\n }\n return ret;\n }\n return result;\n};\n\nexport const getDataFromSource = (result: ResultData | undefined, source: DataSource, propFunctions: PropFunction[] = []): ResultData | undefined => {\n if (!source.nodeId) {\n return source.value;\n }\n return innerGetDataFromSource(result, source.propIds, propFunctions);\n};\n","import { DataSource, ResultData, PropFunction } from \"../type\";\n\nimport { GraphNodes } from \"../node\";\n\nimport { parseNodeName, isNamedInputs, isObject, isNull } from \"./utils\";\nimport { getDataFromSource } from \"./data_source\";\nimport { utilsFunctions } from \"./prop_function\";\n\nconst replaceTemplatePlaceholders = (input: string, templateMatch: string[], nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean) => {\n // GOD format ${:node.prop1.prop2}\n const godResults = resultsOfInner(\n templateMatch.filter((text) => text.startsWith(\":\")),\n nodes,\n propFunctions,\n isSelfNode,\n );\n // utilsFunctions ${@now}\n const utilsFuncResult = templateMatch\n .filter((text) => text.startsWith(\"@\"))\n .reduce((tmp: Record<string, string | number>, key: string) => {\n tmp[key] = utilsFunctions(key, nodes);\n return tmp;\n }, {});\n return Array.from(templateMatch.keys()).reduce((tmp, key) => {\n if (templateMatch[key].startsWith(\":\")) {\n return tmp.replaceAll(\"${\" + templateMatch[key] + \"}\", (godResults as any)[key]);\n }\n return tmp.replaceAll(\"${\" + templateMatch[key] + \"}\", (utilsFuncResult as any)[templateMatch[key]]);\n }, input);\n};\n\nconst resultsOfInner = (input: any, nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean = false): ResultData => {\n if (Array.isArray(input)) {\n return input.map((inp) => resultsOfInner(inp, nodes, propFunctions, isSelfNode));\n }\n if (isNamedInputs(input)) {\n return resultsOf(input, nodes, propFunctions, isSelfNode);\n }\n if (typeof input === \"string\") {\n const templateMatch = [...input.matchAll(/\\${([:@][^}]+)}/g)].map((m) => m[1]);\n if (templateMatch.length > 0) {\n return replaceTemplatePlaceholders(input, templateMatch, nodes, propFunctions, isSelfNode);\n }\n }\n // :node.prod\n return resultOf(parseNodeName(input, isSelfNode, nodes), nodes, propFunctions);\n};\n\nexport const resultsOf = (inputs: Record<string, any>, nodes: GraphNodes, propFunctions: PropFunction[], isSelfNode: boolean = false) => {\n return Object.keys(inputs).reduce((tmp: Record<string, ResultData>, key) => {\n const input = inputs[key];\n tmp[key] = isNamedInputs(input) ? resultsOf(input, nodes, propFunctions, isSelfNode) : resultsOfInner(input, nodes, propFunctions, isSelfNode);\n return tmp;\n }, {});\n};\n\nexport const resultOf = (source: DataSource, nodes: GraphNodes, propFunctions: PropFunction[]) => {\n const { result } = source.nodeId ? nodes[source.nodeId] : { result: undefined };\n return getDataFromSource(result, source, propFunctions);\n};\n\n// clean up object for anyInput\nexport const cleanResultInner = (results: ResultData): ResultData | null => {\n if (Array.isArray(results)) {\n return results.map((result: ResultData) => cleanResultInner(result)).filter((result) => !isNull(result));\n }\n\n if (isObject<ResultData>(results)) {\n return Object.keys(results).reduce((tmp: Record<string, ResultData>, key: string) => {\n const value = cleanResultInner(results[key]);\n if (!isNull(value)) {\n tmp[key] = value;\n }\n return tmp;\n }, {});\n }\n\n return results;\n};\n\nexport const cleanResult = (results: Record<string, ResultData | undefined>) => {\n return Object.keys(results).reduce((tmp: Record<string, ResultData | undefined>, key: string) => {\n const value = cleanResultInner(results[key]);\n if (!isNull(value)) {\n tmp[key] = value;\n }\n return tmp;\n }, {});\n};\n","import type { GraphAI, GraphData } from \"./index\";\nimport { strIntentionalError } from \"./utils/utils\";\nimport { inputs2dataSources, dataSourceNodeIds } from \"./utils/nodeUtils\";\n\nimport {\n NodeDataParams,\n ResultData,\n DataSource,\n ComputedNodeData,\n StaticNodeData,\n NodeState,\n AgentFunctionContext,\n AgentFunction,\n AgentFilterInfo,\n AgentFilterParams,\n AgentFunctionContextDebugInfo,\n DefaultParamsType,\n DefaultInputData,\n PassThrough,\n ConsoleElement,\n ConfigData,\n} from \"./type\";\nimport { parseNodeName, assert, isLogicallyTrue, isObject } from \"./utils/utils\";\nimport { TransactionLog } from \"./transaction_log\";\nimport { resultsOf } from \"./utils/result\";\nimport { GraphAILogger } from \"./utils/GraphAILogger\";\n\nexport class Node {\n public readonly nodeId: string;\n public readonly waitlist = new Set<string>(); // List of nodes which need data from this node.\n public state = NodeState.Waiting;\n public result: ResultData | undefined = undefined;\n\n protected graph: GraphAI;\n protected log: TransactionLog;\n protected console: ConsoleElement; // console output option (before and/or after)\n\n constructor(nodeId: string, graph: GraphAI) {\n this.nodeId = nodeId;\n this.graph = graph;\n this.log = new TransactionLog(nodeId);\n this.console = {};\n }\n\n public asString() {\n return `${this.nodeId}: ${this.state} ${[...this.waitlist]}`;\n }\n\n // This method is called either as the result of computation (computed node) or\n // injection (static node).\n protected onSetResult() {\n this.waitlist.forEach((waitingNodeId) => {\n const waitingNode = this.graph.nodes[waitingNodeId];\n if (waitingNode.isComputedNode) {\n waitingNode.removePending(this.nodeId);\n this.graph.pushQueueIfReadyAndRunning(waitingNode);\n }\n });\n }\n\n protected afterConsoleLog(result: ResultData) {\n if (this.console === false) {\n return;\n } else if (this.console === true || this.console.after === true) {\n GraphAILogger.log(typeof result === \"string\" ? result : JSON.stringify(result, null, 2));\n } else if (this.console.after) {\n if (isObject(this.console.after)) {\n GraphAILogger.log(\n JSON.stringify(resultsOf(this.console.after, { self: { result } as unknown as ComputedNode | StaticNode }, this.graph.propFunctions, true), null, 2),\n );\n } else {\n GraphAILogger.log(this.console.after);\n }\n }\n }\n}\n\nexport class ComputedNode extends Node {\n public readonly graphId: string;\n public readonly isResult: boolean;\n public readonly params: NodeDataParams; // Agent-specific parameters\n private readonly filterParams: AgentFilterParams;\n public readonly nestedGraph?: GraphData | DataSource;\n public readonly retryLimit: number;\n public retryCount: number = 0;\n private readonly agentId?: string;\n private agentFunction?: AgentFunction<any, any, any, any>;\n public readonly timeout?: number; // msec\n public readonly priority: number;\n public error?: Error;\n public transactionId: undefined | number; // To reject callbacks from timed-out transactions\n private readonly passThrough?: PassThrough;\n\n public readonly anyInput: boolean; // any input makes this node ready\n public dataSources: DataSource[] = []; // no longer needed. This is for transaction log.\n private inputs?: Record<string, any>;\n private output?: Record<string, any>;\n public pendings: Set<string>; // List of nodes this node is waiting data from.\n private ifSource?: DataSource; // conditional execution\n private unlessSource?: DataSource; // conditional execution\n private defaultValue?: ResultData;\n private isSkip: boolean = false;\n private debugInfo?: AgentFunctionContextDebugInfo;\n\n public readonly isStaticNode = false;\n public readonly isComputedNode = true;\n\n constructor(graphId: string, nodeId: string, data: ComputedNodeData, graph: GraphAI) {\n super(nodeId, graph);\n this.graphId = graphId;\n this.params = data.params ?? {};\n this.console = data.console ?? {};\n this.filterParams = data.filterParams ?? {};\n this.passThrough = data.passThrough;\n this.retryLimit = data.retry ?? graph.retryLimit ?? 0;\n this.timeout = data.timeout;\n this.isResult = data.isResult ?? false;\n this.priority = data.priority ?? 0;\n\n assert([\"function\", \"string\"].includes(typeof data.agent), \"agent must be either string or function\");\n if (typeof data.agent === \"string\") {\n this.agentId = data.agent;\n } else {\n const agent = data.agent;\n this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);\n }\n\n this.anyInput = data.anyInput ?? false;\n this.inputs = data.inputs;\n this.output = data.output;\n this.dataSources = [\n ...(data.inputs ? inputs2dataSources(data.inputs).flat(10) : []),\n // ...(data.params ? inputs2dataSources(data.params).flat(10) : []),\n ...(this.agentId ? [parseNodeName(this.agentId)] : []),\n ...(data.passThrough ? inputs2dataSources(data.passThrough).flat(10) : []),\n ];\n if (data.inputs && Array.isArray(data.inputs)) {\n throw new Error(`array inputs have been deprecated. nodeId: ${nodeId}: see https://github.com/receptron/graphai/blob/main/docs/NamedInputs.md`);\n }\n\n this.pendings = new Set(dataSourceNodeIds(this.dataSources));\n if (data.graph) {\n this.nestedGraph = typeof data.graph === \"string\" ? this.addPendingNode(data.graph) : data.graph;\n }\n if (data.graphLoader && graph.graphLoader) {\n this.nestedGraph = graph.graphLoader(data.graphLoader);\n }\n if (data.if) {\n this.ifSource = this.addPendingNode(data.if);\n }\n if (data.unless) {\n this.unlessSource = this.addPendingNode(data.unless);\n }\n if (data.defaultValue) {\n this.defaultValue = data.defaultValue;\n }\n this.isSkip = false;\n this.log.initForComputedNode(this, graph);\n }\n\n public getAgentId() {\n return this.agentId ?? \"__custom__function\"; // only for display purpose in the log.\n }\n\n private getConfig(hasGraphData: boolean, agentId?: string) {\n if (agentId) {\n if (hasGraphData) {\n return this.graph.config;\n }\n const config = this.graph.config ?? {};\n return {\n ...(config[\"global\"] ?? {}),\n ...(config[agentId] ?? {}),\n };\n }\n return {};\n }\n\n private addPendingNode(nodeId: string) {\n const source = parseNodeName(nodeId);\n assert(!!source.nodeId, `Invalid data source ${nodeId}`);\n this.pendings.add(source.nodeId);\n return source;\n }\n\n private updateState(state: NodeState) {\n this.state = state;\n if (this.debugInfo) {\n this.debugInfo.state = state;\n }\n }\n\n public resetPending() {\n this.pendings.clear();\n if (this.state === NodeState.Executing) {\n this.updateState(NodeState.Abort);\n }\n if (this.debugInfo && this.debugInfo.subGraphs) {\n this.debugInfo.subGraphs.forEach((graph) => graph.abort());\n }\n }\n\n public isReadyNode() {\n if (this.state !== NodeState.Waiting || this.pendings.size !== 0) {\n return false;\n }\n this.isSkip = !!(\n (this.ifSource && !isLogicallyTrue(this.graph.resultOf(this.ifSource))) ||\n (this.unlessSource && isLogicallyTrue(this.graph.resultOf(this.unlessSource)))\n );\n\n if (this.isSkip && this.defaultValue === undefined) {\n this.updateState(NodeState.Skipped);\n this.log.onSkipped(this, this.graph);\n return false;\n }\n return true;\n }\n\n // This private method (only called while executing execute()) performs\n // the \"retry\" if specified. The transaction log must be updated before\n // callling this method.\n private retry(state: NodeState, error: Error) {\n this.updateState(state); // this.execute() will update to NodeState.Executing\n this.log.onError(this, this.graph, error.message);\n\n if (this.retryCount < this.retryLimit) {\n this.retryCount++;\n this.execute();\n } else {\n this.result = undefined;\n this.error = error;\n this.transactionId = undefined; // This is necessary for timeout case\n this.graph.onExecutionComplete(this);\n }\n }\n\n private checkDataAvailability() {\n return Object.values(this.graph.resultsOf(this.inputs))\n .flat()\n .some((result) => result !== undefined);\n }\n\n // This method is called right before the Graph add this node to the task manager.\n public beforeAddTask() {\n this.updateState(NodeState.Queued);\n this.log.beforeAddTask(this, this.graph);\n }\n\n // This method is called when the data became available on one of nodes,\n // which this node needs data from.\n public removePending(nodeId: string) {\n if (this.anyInput) {\n if (this.checkDataAvailability()) {\n this.pendings.clear();\n }\n } else {\n this.pendings.delete(nodeId);\n }\n }\n\n private isCurrentTransaction(transactionId: number) {\n return this.transactionId === transactionId;\n }\n\n // This private method (called only fro execute) checks if the callback from\n // the timer came before the completion of agent function call, record it\n // and attempt to retry (if specified).\n private executeTimeout(transactionId: number) {\n if (this.state === NodeState.Executing && this.isCurrentTransaction(transactionId)) {\n GraphAILogger.warn(`-- timeout ${this.timeout} with ${this.nodeId}`);\n this.retry(NodeState.TimedOut, Error(\"Timeout\"));\n }\n }\n\n // Check if we need to apply this filter to this node or not.\n private shouldApplyAgentFilter(agentFilter: AgentFilterInfo, agentId?: string) {\n if (agentFilter.agentIds && Array.isArray(agentFilter.agentIds) && agentFilter.agentIds.length > 0) {\n if (agentId && agentFilter.agentIds.includes(agentId)) {\n return true;\n }\n }\n if (agentFilter.nodeIds && Array.isArray(agentFilter.nodeIds) && agentFilter.nodeIds.length > 0) {\n if (agentFilter.nodeIds.includes(this.nodeId)) {\n return true;\n }\n }\n return !agentFilter.agentIds && !agentFilter.nodeIds;\n }\n\n private agentFilterHandler(context: AgentFunctionContext, agentFunction: AgentFunction, agentId?: string): Promise<ResultData> {\n let index = 0;\n\n const next = (innerContext: AgentFunctionContext): Promise<ResultData> => {\n const agentFilter = this.graph.agentFilters[index++];\n if (agentFilter) {\n if (this.shouldApplyAgentFilter(agentFilter, agentId)) {\n if (agentFilter.filterParams) {\n innerContext.filterParams = { ...agentFilter.filterParams, ...innerContext.filterParams };\n }\n return agentFilter.agent(innerContext, next);\n }\n return next(innerContext);\n }\n return agentFunction(innerContext);\n };\n\n return next(context);\n }\n\n // This method is called when this computed node became ready to run.\n // It asynchronously calls the associated with agent function and set the result,\n // then it removes itself from the \"running node\" list of the graph.\n // Notice that setting the result of this node may make other nodes ready to run.\n public async execute() {\n if (this.isSkip) {\n this.afterExecute(this.defaultValue, []);\n return;\n }\n const previousResults = this.graph.resultsOf(this.inputs, this.anyInput);\n const agentId = this.agentId ? (this.graph.resultOf(parseNodeName(this.agentId)) as string) : this.agentId;\n if (typeof agentId === \"function\") {\n this.agentFunction = agentId;\n }\n const hasNestedGraph = Boolean(this.nestedGraph) || Boolean(agentId && this.graph.getAgentFunctionInfo(agentId).hasGraphData);\n const config: ConfigData | undefined = this.getConfig(hasNestedGraph, agentId);\n\n const transactionId = Date.now();\n this.prepareExecute(transactionId, Object.values(previousResults));\n\n if (this.timeout && this.timeout > 0) {\n setTimeout(() => {\n this.executeTimeout(transactionId);\n }, this.timeout);\n }\n\n try {\n const agentFunction = this.agentFunction ?? this.graph.getAgentFunctionInfo(agentId).agent;\n const localLog: TransactionLog[] = [];\n const context = this.getContext(previousResults, localLog, agentId, config);\n\n // NOTE: We use the existence of graph object in the agent-specific params to determine\n // if this is a nested agent or not.\n if (hasNestedGraph) {\n this.graph.taskManager.prepareForNesting();\n context.forNestedGraph = {\n graphData: this.nestedGraph\n ? \"nodes\" in this.nestedGraph\n ? this.nestedGraph\n : (this.graph.resultOf(this.nestedGraph) as GraphData) // HACK: compiler work-around\n : { version: 0, nodes: {} },\n agents: this.graph.agentFunctionInfoDictionary,\n graphOptions: {\n agentFilters: this.graph.agentFilters,\n taskManager: this.graph.taskManager,\n bypassAgentIds: this.graph.bypassAgentIds,\n config,\n graphLoader: this.graph.graphLoader,\n },\n onLogCallback: this.graph.onLogCallback,\n callbacks: this.graph.callbacks,\n };\n }\n\n this.beforeConsoleLog(context);\n const result = await this.agentFilterHandler(context as AgentFunctionContext, agentFunction, agentId);\n this.afterConsoleLog(result);\n\n if (hasNestedGraph) {\n this.graph.taskManager.restoreAfterNesting();\n }\n\n if (!this.isCurrentTransaction(transactionId)) {\n // This condition happens when the agent function returns\n // after the timeout (either retried or not).\n GraphAILogger.log(`-- transactionId mismatch with ${this.nodeId} (probably timeout)`);\n return;\n }\n\n // after process\n this.afterExecute(result, localLog);\n } catch (error) {\n this.errorProcess(error, transactionId, previousResults);\n }\n }\n\n private afterExecute(result: ResultData, localLog: TransactionLog[]) {\n if (this.state == NodeState.Abort) {\n return;\n }\n this.updateState(NodeState.Completed);\n this.result = this.getResult(result);\n if (this.output) {\n this.result = resultsOf(this.output, { self: this }, this.graph.propFunctions, true);\n if (this.passThrough) {\n this.result = { ...this.result, ...this.graph.resultsOf(this.passThrough) };\n }\n }\n this.log.onComplete(this, this.graph, localLog);\n\n this.onSetResult();\n\n this.graph.onExecutionComplete(this);\n }\n\n // This private method (called only by execute()) prepares the ComputedNode object\n // for execution, and create a new transaction to record it.\n private prepareExecute(transactionId: number, inputs: Array<ResultData>) {\n this.updateState(NodeState.Executing);\n this.log.beforeExecute(this, this.graph, transactionId, inputs);\n this.transactionId = transactionId;\n }\n\n // This private method (called only by execute) processes an error received from\n // the agent function. It records the error in the transaction log and handles\n // the retry if specified.\n private errorProcess(error: unknown, transactionId: number, namedInputs: DefaultInputData) {\n if (error instanceof Error && error.message !== strIntentionalError) {\n GraphAILogger.error(`<-- NodeId: ${this.nodeId}, Agent: ${this.agentId}`);\n GraphAILogger.error({ namedInputs });\n GraphAILogger.error(error);\n GraphAILogger.error(\"-->\");\n }\n if (!this.isCurrentTransaction(transactionId)) {\n GraphAILogger.warn(`-- transactionId mismatch with ${this.nodeId} (not timeout)`);\n return;\n }\n\n if (error instanceof Error) {\n this.retry(NodeState.Failed, error);\n } else {\n GraphAILogger.error(`-- NodeId: ${this.nodeId}: Unknown error was caught`);\n this.retry(NodeState.Failed, Error(\"Unknown\"));\n }\n }\n\n private getContext(previousResults: Record<string, ResultData | undefined>, localLog: TransactionLog[], agentId?: string, config?: ConfigData) {\n // Pass debugInfo by reference, and the state of this node will be received by agent/agentFilter.\n // From graphAgent(nested, map), set the instance of graphai, and use abort on the child graphai.\n this.debugInfo = this.getDebugInfo(agentId);\n const context: AgentFunctionContext<DefaultParamsType, DefaultInputData | string | number | boolean | undefined> = {\n //params: this.graph.resultsOf(this.params),\n params: this.params,\n namedInputs: previousResults,\n inputSchema: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.inputs,\n debugInfo: this.debugInfo,\n cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.cacheType,\n filterParams: this.filterParams,\n config,\n log: localLog,\n };\n return context;\n }\n\n private getResult(result: ResultData) {\n if (result && this.passThrough) {\n if (isObject(result) && !Array.isArray(result)) {\n return { ...result, ...this.graph.resultsOf(this.passThrough) };\n } else if (Array.isArray(result)) {\n return result.map((r) => (isObject(r) && !Array.isArray(r) ? { ...r, ...this.graph.resultsOf(this.passThrough) } : r));\n }\n }\n return result;\n }\n\n private getDebugInfo(agentId?: string) {\n return {\n nodeId: this.nodeId,\n agentId,\n retry: this.retryCount,\n state: this.state,\n subGraphs: new Map(),\n verbose: this.graph.verbose,\n version: this.graph.version,\n isResult: this.isResult,\n };\n }\n\n private beforeConsoleLog(context: AgentFunctionContext<DefaultParamsType, string | number | boolean | DefaultInputData | undefined>) {\n if (this.console === false) {\n return;\n } else if (this.console === true || this.console.before === true) {\n GraphAILogger.log(JSON.stringify(context.namedInputs, null, 2));\n } else if (this.console.before) {\n GraphAILogger.log(this.console.before);\n }\n }\n}\n\nexport class StaticNode extends Node {\n public value?: ResultData;\n public readonly update?: DataSource;\n public readonly isResult: boolean;\n public readonly isStaticNode = true;\n public readonly isComputedNode = false;\n\n constructor(nodeId: string, data: StaticNodeData, graph: GraphAI) {\n super(nodeId, graph);\n this.value = data.value;\n this.update = data.update ? parseNodeName(data.update) : undefined;\n this.isResult = data.isResult ?? false;\n this.console = data.console ?? {};\n }\n\n public injectValue(value: ResultData, injectFrom?: string) {\n this.state = NodeState.Injected;\n this.result = value;\n this.log.onInjected(this, this.graph, injectFrom);\n this.onSetResult();\n }\n\n public consoleLog() {\n this.afterConsoleLog(this.result);\n }\n}\n\nexport type GraphNodes = Record<string, ComputedNode | StaticNode>;\n","export const graphDataAttributeKeys = [\"nodes\", \"concurrency\", \"agentId\", \"loop\", \"verbose\", \"version\", \"metadata\"];\n\nexport const computedNodeAttributeKeys = [\n \"inputs\",\n \"output\",\n \"anyInput\",\n \"params\",\n \"retry\",\n \"timeout\",\n \"agent\",\n \"graph\",\n \"graphLoader\",\n \"isResult\",\n \"priority\",\n \"if\",\n \"unless\",\n \"defaultValue\",\n \"filterParams\",\n \"console\",\n \"passThrough\",\n];\nexport const staticNodeAttributeKeys = [\"value\", \"update\", \"isResult\", \"console\"];\n\nexport class ValidationError extends Error {\n constructor(message: string) {\n super(`\\x1b[41m${message}\\x1b[0m`); // Pass the message to the base Error class\n\n // Set the prototype explicitly to ensure correct prototype chain\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { GraphData } from \"../type\";\nimport { graphDataAttributeKeys, ValidationError } from \"./common\";\n\nexport const graphNodesValidator = (data: GraphData) => {\n if (data.nodes === undefined) {\n throw new ValidationError(\"Invalid Graph Data: no nodes\");\n }\n if (typeof data.nodes !== \"object\") {\n throw new ValidationError(\"Invalid Graph Data: invalid nodes\");\n }\n if (Array.isArray(data.nodes)) {\n throw new ValidationError(\"Invalid Graph Data: nodes must be object\");\n }\n if (Object.keys(data.nodes).length === 0) {\n throw new ValidationError(\"Invalid Graph Data: nodes is empty\");\n }\n Object.keys(data).forEach((key) => {\n if (!graphDataAttributeKeys.includes(key)) {\n throw new ValidationError(\"Graph Data does not allow \" + key);\n }\n });\n};\nexport const graphDataValidator = (data: GraphData) => {\n if (data.loop) {\n if (data.loop.count === undefined && data.loop.while === undefined) {\n throw new ValidationError(\"Loop: Either count or while is required in loop\");\n }\n if (data.loop.count !== undefined && data.loop.while !== undefined) {\n throw new ValidationError(\"Loop: Both count and while cannot be set\");\n }\n }\n if (data.concurrency !== undefined) {\n if (!Number.isInteger(data.concurrency)) {\n throw new ValidationError(\"Concurrency must be an integer\");\n }\n if (data.concurrency < 1) {\n throw new ValidationError(\"Concurrency must be a positive integer\");\n }\n }\n};\n","import { NodeData, StaticNodeData, ComputedNodeData } from \"../type\";\nimport { ValidationError } from \"./common\";\n\nexport const nodeValidator = (nodeData: NodeData) => {\n if ((nodeData as ComputedNodeData).agent && (nodeData as StaticNodeData).value) {\n throw new ValidationError(\"Cannot set both agent and value\");\n }\n // if (!(\"agent\" in nodeData) && !(\"value\" in nodeData)) {\n // throw new ValidationError(\"Either agent or value is required\");\n // }\n return true;\n};\n","import { StaticNodeData } from \"../type\";\nimport { staticNodeAttributeKeys, ValidationError } from \"./common\";\n\nexport const staticNodeValidator = (nodeData: StaticNodeData) => {\n Object.keys(nodeData).forEach((key) => {\n if (!staticNodeAttributeKeys.includes(key)) {\n throw new ValidationError(\"Static node does not allow \" + key);\n }\n });\n return true;\n};\n","import { ComputedNodeData } from \"../type\";\nimport { computedNodeAttributeKeys, ValidationError } from \"./common\";\n\nexport const computedNodeValidator = (nodeData: ComputedNodeData) => {\n Object.keys(nodeData).forEach((key) => {\n if (!computedNodeAttributeKeys.includes(key)) {\n throw new ValidationError(\"Computed node does not allow \" + key);\n }\n });\n return true;\n};\n","import { GraphData } from \"../type\";\nimport { parseNodeName, isComputedNodeData, isStaticNodeData } from \"../utils/utils\";\nimport { inputs2dataSources, dataSourceNodeIds } from \"../utils/nodeUtils\";\nimport { ValidationError } from \"./common\";\n\nexport const relationValidator = (graphData: GraphData, staticNodeIds: string[], computedNodeIds: string[]) => {\n const nodeIds = new Set<string>(Object.keys(graphData.nodes));\n\n const pendings: Record<string, Set<string>> = {};\n const waitlist: Record<string, Set<string>> = {};\n\n // validate input relation and set pendings and wait list\n computedNodeIds.forEach((computedNodeId) => {\n const nodeData = graphData.nodes[computedNodeId];\n pendings[computedNodeId] = new Set<string>();\n\n const dataSourceValidator = (sourceType: string, sourceNodeIds: string[]) => {\n sourceNodeIds.forEach((sourceNodeId) => {\n if (sourceNodeId) {\n if (!nodeIds.has(sourceNodeId)) {\n throw new ValidationError(`${sourceType} not match: NodeId ${computedNodeId}, Inputs: ${sourceNodeId}`);\n }\n waitlist[sourceNodeId] === undefined && (waitlist[sourceNodeId] = new Set<string>());\n pendings[computedNodeId].add(sourceNodeId);\n waitlist[sourceNodeId].add(computedNodeId);\n }\n });\n };\n if (nodeData && isComputedNodeData(nodeData)) {\n if (nodeData.inputs) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources(nodeData.inputs));\n dataSourceValidator(\"Inputs\", sourceNodeIds);\n }\n if (nodeData.params) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources(nodeData.params));\n dataSourceValidator(\"Params\", sourceNodeIds);\n }\n if (nodeData.if) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ if: nodeData.if }));\n dataSourceValidator(\"If\", sourceNodeIds);\n }\n if (nodeData.unless) {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ unless: nodeData.unless }));\n dataSourceValidator(\"Unless\", sourceNodeIds);\n }\n if (nodeData.graph && typeof nodeData?.graph === \"string\") {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ graph: nodeData.graph }));\n dataSourceValidator(\"Graph\", sourceNodeIds);\n }\n if (typeof nodeData.agent === \"string\" && nodeData.agent[0] === \":\") {\n const sourceNodeIds = dataSourceNodeIds(inputs2dataSources({ agent: nodeData.agent }));\n dataSourceValidator(\"Agent\", sourceNodeIds);\n }\n }\n });\n\n // TODO. validate update\n staticNodeIds.forEach((staticNodeId) => {\n const nodeData = graphData.nodes[staticNodeId];\n if (isStaticNodeData(nodeData) && nodeData.update) {\n const update = nodeData.update;\n const updateNodeId = parseNodeName(update).nodeId;\n if (!updateNodeId) {\n throw new ValidationError(\"Update it a literal\");\n }\n if (!nodeIds.has(updateNodeId)) {\n throw new ValidationError(`Update not match: NodeId ${staticNodeId}, update: ${update}`);\n }\n }\n });\n\n const cycle = (possibles: string[]) => {\n possibles.forEach((possobleNodeId) => {\n (waitlist[possobleNodeId] || []).forEach((waitingNodeId) => {\n pendings[waitingNodeId].delete(possobleNodeId);\n });\n });\n\n const running: string[] = [];\n Object.keys(pendings).forEach((pendingNodeId) => {\n if (pendings[pendingNodeId].size === 0) {\n running.push(pendingNodeId);\n delete pendings[pendingNodeId];\n }\n });\n return running;\n };\n\n let runningQueue = cycle(staticNodeIds);\n if (runningQueue.length === 0) {\n throw new ValidationError(\"No Initial Runnning Node\");\n }\n\n do {\n runningQueue = cycle(runningQueue);\n } while (runningQueue.length > 0);\n\n if (Object.keys(pendings).length > 0) {\n throw new ValidationError(\"Some nodes are not executed: \" + Object.keys(pendings).join(\", \"));\n }\n};\n","import { ValidationError } from \"./common\";\n\nexport const agentValidator = (graphAgentIds: Set<string>, agentIds: Set<string>) => {\n graphAgentIds.forEach((agentId) => {\n // agentId or dynamic agentId\n if (!agentIds.has(agentId) && agentId[0] !== \":\") {\n throw new ValidationError(\"Invalid Agent : \" + agentId + \" is not in AgentFunctionInfoDictionary.\");\n }\n });\n return true;\n};\n","import { GraphData, AgentFunctionInfoDictionary } from \"./type\";\nimport { isStaticNodeData } from \"./utils/utils\";\nimport { graphNodesValidator, graphDataValidator } from \"./validators/graph_data_validator\";\nimport { nodeValidator } from \"./validators/nodeValidator\";\nimport { staticNodeValidator } from \"./validators/static_node_validator\";\nimport { computedNodeValidator } from \"./validators/computed_node_validator\";\nimport { relationValidator } from \"./validators/relation_validator\";\nimport { agentValidator } from \"./validators/agent_validator\";\n\nimport { ValidationError } from \"./validators/common\";\n\nexport const validateGraphData = (data: GraphData, agentIds: string[]) => {\n graphNodesValidator(data);\n graphDataValidator(data);\n const computedNodeIds: string[] = [];\n const staticNodeIds: string[] = [];\n const graphAgentIds = new Set<string>();\n Object.keys(data.nodes).forEach((nodeId) => {\n const node = data.nodes[nodeId];\n const isStaticNode = isStaticNodeData(node);\n nodeValidator(node);\n const agentId = isStaticNode ? \"\" : node.agent;\n isStaticNode && staticNodeValidator(node) && staticNodeIds.push(nodeId);\n !isStaticNode && computedNodeValidator(node) && computedNodeIds.push(nodeId) && typeof agentId === \"string\" && graphAgentIds.add(agentId);\n });\n agentValidator(graphAgentIds, new Set<string>(agentIds));\n relationValidator(data, staticNodeIds, computedNodeIds);\n\n return true;\n};\n\nexport const validateAgent = (agentFunctionInfoDictionary: AgentFunctionInfoDictionary) => {\n Object.keys(agentFunctionInfoDictionary).forEach((agentId: string) => {\n if (agentId !== \"default\") {\n const agentInfo = agentFunctionInfoDictionary[agentId];\n if (!agentInfo || !agentInfo.agent) {\n throw new ValidationError(\"No Agent: \" + agentId + \" is not in AgentFunctionInfoDictionary.\");\n }\n }\n });\n};\n","import { ComputedNode } from \"./node\";\nimport { assert } from \"./utils/utils\";\n\ntype TaskEntry = {\n node: ComputedNode;\n graphId: string;\n callback: (node: ComputedNode) => void;\n};\n\n// TaskManage object controls the concurrency of ComputedNode execution.\n//\n// NOTE: A TaskManager instance will be shared between parent graph and its children\n// when nested agents are involved.\nexport class TaskManager {\n private concurrency: number;\n private taskQueue: Array<TaskEntry> = [];\n private runningNodes = new Set<ComputedNode>();\n\n constructor(concurrency: number) {\n this.concurrency = concurrency;\n }\n\n // This internal method dequeus a task from the task queue\n // and call the associated callback method, if the number of\n // running task is lower than the spcified limit.\n private dequeueTaskIfPossible() {\n if (this.runningNodes.size < this.concurrency) {\n const task = this.taskQueue.shift();\n if (task) {\n this.runningNodes.add(task.node);\n task.callback(task.node);\n }\n }\n }\n\n // Node will call this method to put itself in the execution queue.\n // We call the associated callback function when it is dequeued.\n public addTask(node: ComputedNode, graphId: string, callback: (node: ComputedNode) => void) {\n // Finder tasks in the queue, which has either the same or higher priority.\n const count = this.taskQueue.filter((task) => {\n return task.node.priority >= node.priority;\n }).length;\n assert(count <= this.taskQueue.length, \"TaskManager.addTask: Something is really wrong.\");\n this.taskQueue.splice(count, 0, { node, graphId, callback });\n this.dequeueTaskIfPossible();\n }\n\n public isRunning(graphId: string) {\n const count = [...this.runningNodes].filter((node) => {\n return node.graphId == graphId;\n }).length;\n return count > 0 || Array.from(this.taskQueue).filter((data) => data.graphId === graphId).length > 0;\n }\n\n // Node MUST call this method once the execution of agent function is completed\n // either successfully or not.\n public onComplete(node: ComputedNode) {\n assert(this.runningNodes.has(node), `TaskManager.onComplete node(${node.nodeId}) is not in list`);\n this.runningNodes.delete(node);\n this.dequeueTaskIfPossible();\n }\n\n // Node will call this method before it hands the task manager from the graph\n // to a nested agent. We need to make it sure that there is enough room to run\n // computed nodes inside the nested graph to avoid a deadlock.\n public prepareForNesting() {\n this.concurrency++;\n }\n\n public restoreAfterNesting() {\n this.concurrency--;\n }\n\n public getStatus(verbose: boolean = false) {\n const runningNodes = Array.from(this.runningNodes).map((node) => node.nodeId);\n const queuedNodes = this.taskQueue.map((task) => task.node.nodeId);\n const nodes = verbose ? { runningNodes, queuedNodes } : {};\n return {\n concurrency: this.concurrency,\n queue: this.taskQueue.length,\n running: this.runningNodes.size,\n ...nodes,\n };\n }\n}\n","import {\n AgentFunctionInfoDictionary,\n AgentFilterInfo,\n GraphData,\n DataSource,\n LoopData,\n ResultDataDictionary,\n ResultData,\n DefaultResultData,\n GraphOptions,\n PropFunction,\n GraphDataLoader,\n ConfigDataDictionary,\n CallbackFunction,\n} from \"./type\";\nimport { TransactionLog } from \"./transaction_log\";\n\nimport { ComputedNode, StaticNode, GraphNodes } from \"./node\";\n\nimport { resultsOf, resultOf, cleanResult } from \"./utils/result\";\nimport { propFunctions } from \"./utils/prop_function\";\nimport { parseNodeName, assert, isLogicallyTrue, isComputedNodeData, loopCounterKey } from \"./utils/utils\";\nimport { getDataFromSource } from \"./utils/data_source\";\n\nimport { validateGraphData, validateAgent } from \"./validator\";\nimport { TaskManager } from \"./task_manager\";\nimport { GraphAILogger } from \"./utils/GraphAILogger\";\n\nexport const defaultConcurrency = 8;\nexport const graphDataLatestVersion = 0.5;\n\nexport class GraphAI {\n public readonly version: number;\n public readonly graphId: string;\n private readonly graphData: GraphData;\n private readonly loop?: LoopData;\n private readonly forceLoop: boolean;\n private readonly logs: Array<TransactionLog> = [];\n public readonly bypassAgentIds: string[];\n public readonly config?: ConfigDataDictionary = {};\n public readonly agentFunctionInfoDictionary: AgentFunctionInfoDictionary;\n public readonly taskManager: TaskManager;\n public readonly agentFilters: AgentFilterInfo[];\n public readonly retryLimit?: number;\n public readonly propFunctions: PropFunction[];\n public readonly graphLoader?: GraphDataLoader;\n\n public nodes: GraphNodes;\n public onLogCallback: CallbackFunction = (__log: TransactionLog, __isUpdate: boolean) => {};\n public callbacks: CallbackFunction[] = [];\n public verbose: boolean; // REVIEW: Do we need this?\n\n private onComplete: (isAbort: boolean) => void;\n private repeatCount = 0;\n\n // This method is called when either the GraphAI obect was created,\n // or we are about to start n-th iteration (n>2).\n private createNodes(graphData: GraphData) {\n const nodes = Object.keys(graphData.nodes).reduce((_nodes: GraphNodes, nodeId: string) => {\n const nodeData = graphData.nodes[nodeId];\n if (isComputedNodeData(nodeData)) {\n _nodes[nodeId] = new ComputedNode(this.graphId, nodeId, nodeData, this);\n } else {\n _nodes[nodeId] = new StaticNode(nodeId, nodeData, this);\n }\n return _nodes;\n }, {});\n\n // Generate the waitlist for each node.\n Object.keys(nodes).forEach((nodeId) => {\n const node = nodes[nodeId];\n if (node.isComputedNode) {\n node.pendings.forEach((pending) => {\n if (nodes[pending]) {\n nodes[pending].waitlist.add(nodeId); // previousNode\n } else {\n throw new Error(`createNode: invalid input ${pending} for node, ${nodeId}`);\n }\n });\n }\n });\n return nodes;\n }\n\n private getValueFromResults(source: DataSource, results: ResultDataDictionary<DefaultResultData>) {\n return getDataFromSource(source.nodeId ? results[source.nodeId] : undefined, source, this.propFunctions);\n }\n\n // for static\n private initializeStaticNodes(enableConsoleLog: boolean = false) {\n // If the result property is specified, inject it.\n // If the previousResults exists (indicating we are in a loop),\n // process the update property (nodeId or nodeId.propId).\n Object.keys(this.graphData.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node?.isStaticNode) {\n const value = node?.value;\n if (value !== undefined) {\n this.injectValue(nodeId, value, nodeId);\n }\n if (enableConsoleLog) {\n node.consoleLog();\n }\n }\n });\n }\n\n private updateStaticNodes(previousResults?: ResultDataDictionary<DefaultResultData>, enableConsoleLog: boolean = false) {\n // If the result property is specified, inject it.\n // If the previousResults exists (indicating we are in a loop),\n // process the update property (nodeId or nodeId.propId).\n Object.keys(this.graphData.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node?.isStaticNode) {\n const update = node?.update;\n if (update && previousResults) {\n const result = this.getValueFromResults(update, previousResults);\n this.injectValue(nodeId, result, update.nodeId);\n }\n if (enableConsoleLog) {\n node.consoleLog();\n }\n }\n });\n }\n\n constructor(\n graphData: GraphData,\n agentFunctionInfoDictionary: AgentFunctionInfoDictionary,\n options: GraphOptions = {\n taskManager: undefined,\n agentFilters: [],\n bypassAgentIds: [],\n config: {},\n graphLoader: undefined,\n forceLoop: false,\n },\n ) {\n if (!graphData.version && !options.taskManager) {\n GraphAILogger.warn(\"------------ missing version number\");\n }\n this.version = graphData.version ?? graphDataLatestVersion;\n if (this.version < graphDataLatestVersion) {\n GraphAILogger.warn(`------------ upgrade to ${graphDataLatestVersion}!`);\n }\n this.retryLimit = graphData.retry; // optional\n this.graphId = `${Date.now().toString(36)}-${Math.random().toString(36).substr(2, 9)}`; // URL.createObjectURL(new Blob()).slice(-36);\n this.agentFunctionInfoDictionary = agentFunctionInfoDictionary;\n this.propFunctions = propFunctions;\n this.taskManager = options.taskManager ?? new TaskManager(graphData.concurrency ?? defaultConcurrency);\n this.agentFilters = options.agentFilters ?? [];\n this.bypassAgentIds = options.bypassAgentIds ?? [];\n this.config = options.config;\n this.graphLoader = options.graphLoader;\n this.forceLoop = options.forceLoop ?? false;\n this.loop = graphData.loop;\n this.verbose = graphData.verbose === true;\n this.onComplete = (__isAbort: boolean) => {\n throw new Error(\"SOMETHING IS WRONG: onComplete is called without run()\");\n };\n\n validateGraphData(graphData, [...Object.keys(agentFunctionInfoDictionary), ...this.bypassAgentIds]);\n validateAgent(agentFunctionInfoDictionary);\n\n this.graphData = {\n ...graphData,\n nodes: {\n ...graphData.nodes,\n [loopCounterKey]: { value: 0, update: `:${loopCounterKey}.add(1)` },\n },\n };\n this.nodes = this.createNodes(this.graphData);\n this.initializeStaticNodes(true);\n }\n\n public getAgentFunctionInfo(agentId?: string) {\n if (agentId && this.agentFunctionInfoDictionary[agentId]) {\n return this.agentFunctionInfoDictionary[agentId];\n }\n if (agentId && this.bypassAgentIds.includes(agentId)) {\n return {\n agent: async () => {\n return null;\n },\n hasGraphData: false,\n inputs: null,\n cacheType: undefined, // for node.getContext\n };\n }\n // We are not supposed to hit this error because the validator will catch it.\n throw new Error(\"No agent: \" + agentId);\n }\n\n public asString() {\n return Object.values(this.nodes)\n .map((node) => node.asString())\n .join(\"\\n\");\n }\n\n // Public API\n public results<T = DefaultResultData>(all: boolean, internalUse: boolean = false): ResultDataDictionary<T> {\n return Object.keys(this.nodes)\n .filter((nodeId) => (all && (internalUse || nodeId !== loopCounterKey)) || this.nodes[nodeId].isResult)\n .reduce((results: ResultDataDictionary<T>, nodeId) => {\n const node = this.nodes[nodeId];\n if (node.result !== undefined) {\n results[nodeId] = node.result as T;\n }\n return results;\n }, {});\n }\n\n // Public API\n public errors(): Record<string, Error> {\n return Object.keys(this.nodes).reduce((errors: Record<string, Error>, nodeId) => {\n const node = this.nodes[nodeId];\n if (node.isComputedNode) {\n if (node.error !== undefined) {\n errors[nodeId] = node.error;\n }\n }\n return errors;\n }, {});\n }\n\n private pushReadyNodesIntoQueue() {\n // Nodes without pending data should run immediately.\n Object.keys(this.nodes).forEach((nodeId) => {\n const node = this.nodes[nodeId];\n if (node.isComputedNode) {\n this.pushQueueIfReady(node);\n }\n });\n }\n\n private pushQueueIfReady(node: ComputedNode) {\n if (node.isReadyNode()) {\n this.pushQueue(node);\n }\n }\n\n public pushQueueIfReadyAndRunning(node: ComputedNode) {\n if (this.isRunning()) {\n this.pushQueueIfReady(node);\n }\n }\n\n // for computed\n public pushQueue(node: ComputedNode) {\n node.beforeAddTask();\n\n this.taskManager.addTask(node, this.graphId, (_node) => {\n assert(node.nodeId === _node.nodeId, \"GraphAI.pushQueue node mismatch\");\n node.execute();\n });\n }\n\n // Public API\n public async run<T = DefaultResultData>(all: boolean = false): Promise<ResultDataDictionary<T>> {\n if (\n Object.values(this.nodes)\n .filter((node) => node.isStaticNode)\n .some((node) => node.result === undefined && node.update === undefined)\n ) {\n throw new Error(\"Static node must have value. Set value or injectValue or set update\");\n }\n if (this.isRunning()) {\n throw new Error(\"This GraphAI instance is already running\");\n }\n\n this.pushReadyNodesIntoQueue();\n\n if (!this.isRunning()) {\n GraphAILogger.warn(\"-- nothing to execute\");\n return {};\n }\n\n return new Promise((resolve, reject) => {\n this.onComplete = (isAbort: boolean = false) => {\n const errors = this.errors();\n const errorNodeIds = Object.keys(errors);\n if (errorNodeIds.length > 0 || isAbort) {\n reject(errors[errorNodeIds[0]]);\n } else {\n resolve(this.results(all));\n }\n };\n });\n }\n\n public abort() {\n if (this.isRunning()) {\n this.resetPending();\n }\n // For an agent like an event agent, where an external promise remains unresolved,\n // aborting and then retrying can cause nodes or the graph to execute again.\n // To prevent this, the transactionId is updated to ensure the retry fails.\n Object.values(this.nodes).forEach((node) => node.isComputedNode && (node.transactionId = undefined));\n this.onComplete(this.isRunning());\n }\n public resetPending() {\n Object.values(this.nodes).map((node) => {\n if (node.isComputedNode) {\n node.resetPending();\n }\n });\n }\n\n // Public only for testing\n public isRunning() {\n return this.taskManager.isRunning(this.graphId);\n }\n\n // callback from execute\n public onExecutionComplete(node: ComputedNode) {\n this.taskManager.onComplete(node);\n if (this.isRunning() || this.processLoopIfNecessary()) {\n return; // continue running\n }\n this.onComplete(false); // Nothing to run. Finish it.\n }\n\n // Must be called only from onExecutionComplete righ after removeRunning\n // Check if there is any running computed nodes.\n // In case of no running computed note, start the another iteration if ncessary (loop)\n private processLoopIfNecessary() {\n //\n if (!this.forceLoop && Object.keys(this.errors()).length > 0) {\n return false;\n }\n\n this.repeatCount++;\n const loop = this.loop;\n if (!loop) {\n return false;\n }\n\n // We need to update static nodes, before checking the condition\n const previousResults = this.results(true, true); // results from previous loop\n this.updateStaticNodes(previousResults);\n\n if (loop.count === undefined || this.repeatCount < loop.count) {\n if (loop.while) {\n const source = parseNodeName(loop.while);\n const value = this.getValueFromResults(source, this.results(true, true));\n // NOTE: We treat an empty array as false.\n if (!isLogicallyTrue(value)) {\n return false; // while condition is not met\n }\n }\n this.initializeGraphAI();\n this.updateStaticNodes(previousResults, true);\n this.pushReadyNodesIntoQueue();\n return true; // Indicating that we are going to continue.\n }\n return false;\n }\n\n public initializeGraphAI() {\n if (this.isRunning()) {\n throw new Error(\"This GraphAI instance is running\");\n }\n this.nodes = this.createNodes(this.graphData);\n this.initializeStaticNodes();\n }\n public setPreviousResults(previousResults: ResultDataDictionary<DefaultResultData>) {\n this.updateStaticNodes(previousResults);\n }\n public setLoopLog(log: TransactionLog) {\n log.isLoop = !!this.loop;\n log.repeatCount = this.repeatCount;\n }\n\n public appendLog(log: TransactionLog) {\n this.logs.push(log);\n this.onLogCallback(log, false);\n this.callbacks.forEach((callback) => callback(log, false));\n }\n\n public updateLog(log: TransactionLog) {\n this.onLogCallback(log, true);\n this.callbacks.forEach((callback) => callback(log, false));\n }\n\n public registerCallback(callback: CallbackFunction) {\n this.callbacks.push(callback);\n }\n\n public clearCallbacks() {\n this.callbacks = [];\n }\n\n // Public API\n public transactionLogs() {\n return this.logs;\n }\n\n // Public API\n public injectValue(nodeId: string, value: ResultData, injectFrom?: string): void {\n const node = this.nodes[nodeId];\n if (node && node.isStaticNode) {\n node.injectValue(value, injectFrom);\n } else {\n throw new Error(`injectValue with Invalid nodeId, ${nodeId}`);\n }\n }\n\n public resultsOf(inputs?: Record<string, any>, anyInput: boolean = false) {\n const results = resultsOf(inputs ?? {}, this.nodes, this.propFunctions);\n if (anyInput) {\n return cleanResult(results);\n }\n return results;\n }\n public resultOf(source: DataSource) {\n return resultOf(source, this.nodes, this.propFunctions);\n }\n}\n"],"names":[],"mappings":"IAIY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,SAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,SAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC;AACpC,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACtB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAXW,SAAS,KAAT,SAAS,GAWpB,EAAA,CAAA,CAAA;;ACZD,MAAM,aAAa,GAA8B;AAC/C,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,GAAG,EAAE,IAAI;AACT,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;CACZ;AAED,IAAI,YAAY,GAA0B,IAAI;AAE9C,SAAS,eAAe,CAAC,KAAe,EAAE,OAAgB,EAAA;AACxD,IAAA,aAAa,CAAC,KAAK,CAAC,GAAG,OAAO;AAChC;AAEA,SAAS,SAAS,CAAC,MAAsB,EAAA;IACvC,YAAY,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