graphai 0.6.17 → 0.6.19

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/graphai.js CHANGED
@@ -126,6 +126,7 @@ class GraphAI {
126
126
  agent: async () => {
127
127
  return null;
128
128
  },
129
+ hasGraphData: false,
129
130
  inputs: null,
130
131
  cacheType: undefined, // for node.getContext
131
132
  };
package/lib/node.js CHANGED
@@ -235,7 +235,8 @@ class ComputedNode extends Node {
235
235
  if (typeof agentId === "function") {
236
236
  this.agentFunction = agentId;
237
237
  }
238
- const config = this.getConfig(!!this.nestedGraph, agentId);
238
+ const hasNestedGraph = Boolean(this.nestedGraph) || Boolean(agentId && this.graph.getAgentFunctionInfo(agentId).hasGraphData);
239
+ const config = this.getConfig(hasNestedGraph, agentId);
239
240
  const transactionId = Date.now();
240
241
  this.prepareExecute(transactionId, Object.values(previousResults));
241
242
  if (this.timeout && this.timeout > 0) {
@@ -249,10 +250,14 @@ class ComputedNode extends Node {
249
250
  const context = this.getContext(previousResults, localLog, agentId, config);
250
251
  // NOTE: We use the existence of graph object in the agent-specific params to determine
251
252
  // if this is a nested agent or not.
252
- if (this.nestedGraph) {
253
+ if (hasNestedGraph) {
253
254
  this.graph.taskManager.prepareForNesting();
254
255
  context.forNestedGraph = {
255
- graphData: "nodes" in this.nestedGraph ? this.nestedGraph : this.graph.resultOf(this.nestedGraph), // HACK: compiler work-around
256
+ graphData: this.nestedGraph
257
+ ? "nodes" in this.nestedGraph
258
+ ? this.nestedGraph
259
+ : this.graph.resultOf(this.nestedGraph) // HACK: compiler work-around
260
+ : { version: 0, nodes: {} },
256
261
  agents: this.graph.agentFunctionInfoDictionary,
257
262
  graphOptions: {
258
263
  agentFilters: this.graph.agentFilters,
@@ -267,7 +272,7 @@ class ComputedNode extends Node {
267
272
  this.beforeConsoleLog(context);
268
273
  const result = await this.agentFilterHandler(context, agentFunction, agentId);
269
274
  this.afterConsoleLog(result);
270
- if (this.nestedGraph) {
275
+ if (hasNestedGraph) {
271
276
  this.graph.taskManager.restoreAfterNesting();
272
277
  }
273
278
  if (!this.isCurrentTransaction(transactionId)) {
package/lib/type.d.ts CHANGED
@@ -133,6 +133,7 @@ export type AgentFunctionInfo = {
133
133
  outputFormat?: any;
134
134
  params?: any;
135
135
  config?: any;
136
+ tools?: Record<string, any>[];
136
137
  samples: AgentFunctionInfoSample[];
137
138
  description: string;
138
139
  category: string[];
@@ -141,6 +142,7 @@ export type AgentFunctionInfo = {
141
142
  license: string;
142
143
  cacheType?: CacheTypes;
143
144
  environmentVariables?: string[];
145
+ hasGraphData?: boolean;
144
146
  stream?: boolean;
145
147
  apiKeys?: string[];
146
148
  npms?: string[];
@@ -18,7 +18,7 @@ export declare const defaultAgentInfo: {
18
18
  repository: string;
19
19
  license: string;
20
20
  };
21
- export declare const agentInfoWrapper: (agent: AgentFunction<any, any, any>) => {
21
+ export declare const agentInfoWrapper: (agent: AgentFunction<any, any, any, any>) => {
22
22
  name: string;
23
23
  samples: {
24
24
  inputs: never[];
@@ -30,8 +30,8 @@ export declare const agentInfoWrapper: (agent: AgentFunction<any, any, any>) =>
30
30
  author: string;
31
31
  repository: string;
32
32
  license: string;
33
- agent: AgentFunction<any, any, any>;
34
- mock: AgentFunction<any, any, any>;
33
+ agent: AgentFunction<any, any, any, any>;
34
+ mock: AgentFunction<any, any, any, any>;
35
35
  };
36
36
  export declare const debugResultKey: (agentId: string, result: any) => string[];
37
37
  export declare const isLogicallyTrue: (value: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphai",
3
- "version": "0.6.17",
3
+ "version": "0.6.19",
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",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/receptron/graphai#readme",
29
29
  "devDependencies": {
30
- "typedoc": "^0.27.5"
30
+ "typedoc": "^0.27.6"
31
31
  },
32
32
  "types": "./lib/index.d.ts",
33
33
  "directories": {