@ai.ntellect/core 0.6.14 → 0.6.16

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.
@@ -13,10 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Graph = void 0;
16
- const dotenv_1 = require("dotenv");
17
16
  const events_1 = __importDefault(require("events"));
18
- (0, dotenv_1.configDotenv)();
19
- // Classe Graph avec un contexte typé
20
17
  class Graph {
21
18
  constructor(name, config) {
22
19
  this.name = name;
@@ -64,7 +61,7 @@ class Graph {
64
61
  }
65
62
  validatedParams = node.parameters.parse(params);
66
63
  }
67
- // Exécuter avec ou sans `params`
64
+ this.eventEmitter.emit("nodeStarted", { name: nodeName, context });
68
65
  if (node.execute) {
69
66
  yield node.execute(context);
70
67
  }
@@ -75,7 +72,7 @@ class Graph {
75
72
  yield node.executeWithParams(context, validatedParams);
76
73
  }
77
74
  this.validateContext(context);
78
- this.eventEmitter.emit("nodeCompleted", { nodeName, context });
75
+ this.eventEmitter.emit("nodeCompleted", { name: nodeName, context });
79
76
  if (node.next) {
80
77
  yield Promise.all(node.next.map((nextNode) => this.executeNode(nextNode, context)));
81
78
  }
@@ -148,11 +145,9 @@ class Graph {
148
145
  getContext() {
149
146
  return structuredClone(this.context);
150
147
  }
151
- // Journalisation (logging)
152
148
  log(message, data) {
153
149
  console.log(`[Graph ${this.name}] ${message}`, data);
154
150
  }
155
- // Modification dynamique du graph
156
151
  addNode(node) {
157
152
  this.nodes.set(node.name, node);
158
153
  this.setupEventListeners();
package/graph/graph.ts CHANGED
@@ -2,7 +2,6 @@ import { GraphConfig, GraphContext, GraphDefinition, Node } from "@/types";
2
2
  import EventEmitter from "events";
3
3
  import { ZodSchema } from "zod";
4
4
 
5
- // Classe Graph avec un contexte typé
6
5
  export class Graph<T extends ZodSchema> {
7
6
  private nodes: Map<string, Node<T>>;
8
7
  private context: GraphContext<T>;
@@ -62,7 +61,7 @@ export class Graph<T extends ZodSchema> {
62
61
  validatedParams = node.parameters.parse(params);
63
62
  }
64
63
 
65
- // Exécuter avec ou sans `params`
64
+ this.eventEmitter.emit("nodeStarted", { name: nodeName, context });
66
65
  if (node.execute) {
67
66
  await node.execute(context);
68
67
  } else if (node.executeWithParams) {
@@ -76,7 +75,7 @@ export class Graph<T extends ZodSchema> {
76
75
 
77
76
  this.validateContext(context);
78
77
 
79
- this.eventEmitter.emit("nodeCompleted", { nodeName, context });
78
+ this.eventEmitter.emit("nodeCompleted", { name: nodeName, context });
80
79
 
81
80
  if (node.next) {
82
81
  await Promise.all(
@@ -175,12 +174,10 @@ export class Graph<T extends ZodSchema> {
175
174
  return structuredClone(this.context);
176
175
  }
177
176
 
178
- // Journalisation (logging)
179
177
  log(message: string, data?: any): void {
180
178
  console.log(`[Graph ${this.name}] ${message}`, data);
181
179
  }
182
180
 
183
- // Modification dynamique du graph
184
181
  addNode(node: Node<T>): void {
185
182
  this.nodes.set(node.name, node);
186
183
  this.setupEventListeners();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai.ntellect/core",
3
- "version": "0.6.14",
3
+ "version": "0.6.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {