graphai 0.6.13 → 0.6.14

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.
package/lib/node.js CHANGED
@@ -74,7 +74,6 @@ class ComputedNode extends Node {
74
74
  const agent = data.agent;
75
75
  this.agentFunction = async ({ namedInputs, params }) => agent(namedInputs, params);
76
76
  }
77
- this.config = this.getConfig(!!data.graph);
78
77
  this.anyInput = data.anyInput ?? false;
79
78
  this.inputs = data.inputs;
80
79
  this.output = data.output;
@@ -108,15 +107,15 @@ class ComputedNode extends Node {
108
107
  getAgentId() {
109
108
  return this.agentId ?? "__custom__function"; // only for display purpose in the log.
110
109
  }
111
- getConfig(hasGraphData) {
112
- if (this.agentId) {
110
+ getConfig(hasGraphData, agentId) {
111
+ if (agentId) {
113
112
  if (hasGraphData) {
114
113
  return this.graph.config;
115
114
  }
116
115
  const config = this.graph.config ?? {};
117
116
  return {
118
117
  ...(config["global"] ?? {}),
119
- ...(config[this.agentId] ?? {}),
118
+ ...(config[agentId] ?? {}),
120
119
  };
121
120
  }
122
121
  return {};
@@ -233,6 +232,7 @@ class ComputedNode extends Node {
233
232
  }
234
233
  const previousResults = this.graph.resultsOf(this.inputs, this.anyInput);
235
234
  const agentId = this.agentId ? this.graph.resultOf((0, utils_2.parseNodeName)(this.agentId)) : this.agentId;
235
+ const config = this.getConfig(!!this.nestedGraph, agentId);
236
236
  const transactionId = Date.now();
237
237
  this.prepareExecute(transactionId, Object.values(previousResults));
238
238
  if (this.timeout && this.timeout > 0) {
@@ -243,7 +243,7 @@ class ComputedNode extends Node {
243
243
  try {
244
244
  const agentFunction = this.agentFunction ?? this.graph.getAgentFunctionInfo(agentId).agent;
245
245
  const localLog = [];
246
- const context = this.getContext(previousResults, localLog, agentId);
246
+ const context = this.getContext(previousResults, localLog, agentId, config);
247
247
  // NOTE: We use the existence of graph object in the agent-specific params to determine
248
248
  // if this is a nested agent or not.
249
249
  if (this.nestedGraph) {
@@ -255,7 +255,7 @@ class ComputedNode extends Node {
255
255
  agentFilters: this.graph.agentFilters,
256
256
  taskManager: this.graph.taskManager,
257
257
  bypassAgentIds: this.graph.bypassAgentIds,
258
- config: this.config,
258
+ config,
259
259
  graphLoader: this.graph.graphLoader,
260
260
  },
261
261
  onLogCallback: this.graph.onLogCallback,
@@ -319,7 +319,7 @@ class ComputedNode extends Node {
319
319
  this.retry(type_1.NodeState.Failed, Error("Unknown"));
320
320
  }
321
321
  }
322
- getContext(previousResults, localLog, agentId) {
322
+ getContext(previousResults, localLog, agentId, config) {
323
323
  const context = {
324
324
  params: this.graph.resultsOf(this.params),
325
325
  namedInputs: previousResults,
@@ -328,7 +328,7 @@ class ComputedNode extends Node {
328
328
  cacheType: this.agentFunction ? undefined : this.graph.getAgentFunctionInfo(agentId)?.cacheType,
329
329
  filterParams: this.filterParams,
330
330
  agentFilters: this.graph.agentFilters,
331
- config: this.config,
331
+ config,
332
332
  log: localLog,
333
333
  };
334
334
  return context;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "Asynchronous data flow execution engine for agentic AI apps.",
5
5
  "main": "lib/bundle.cjs.js",
6
6
  "module": "lib/bundle.esm.js",