@ai.ntellect/core 0.7.1 → 0.7.4
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/README.md +13 -28
- package/dist/graph/controller.d.ts +33 -0
- package/dist/graph/controller.d.ts.map +1 -0
- package/dist/graph/controller.js +73 -0
- package/dist/graph/controller.js.map +1 -0
- package/dist/graph/event-manager.d.ts +92 -0
- package/dist/graph/event-manager.d.ts.map +1 -0
- package/dist/graph/event-manager.js +244 -0
- package/dist/graph/event-manager.js.map +1 -0
- package/dist/graph/index.d.ts +157 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +299 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/logger.d.ts +46 -0
- package/dist/graph/logger.d.ts.map +1 -0
- package/dist/graph/logger.js +69 -0
- package/dist/graph/logger.js.map +1 -0
- package/dist/graph/node.d.ts +103 -0
- package/dist/graph/node.d.ts.map +1 -0
- package/dist/graph/node.js +284 -0
- package/dist/graph/node.js.map +1 -0
- package/dist/graph/observer.d.ts +113 -0
- package/dist/graph/observer.d.ts.map +1 -0
- package/dist/graph/observer.js +199 -0
- package/dist/graph/observer.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +447 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +75 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/modules/agenda/adapters/node-cron/index.d.ts +17 -0
- package/dist/modules/agenda/adapters/node-cron/index.d.ts.map +1 -0
- package/dist/modules/agenda/adapters/node-cron/index.js +30 -0
- package/dist/modules/agenda/adapters/node-cron/index.js.map +1 -0
- package/dist/modules/agenda/index.d.ts +63 -0
- package/dist/modules/agenda/index.d.ts.map +1 -0
- package/dist/modules/agenda/index.js +141 -0
- package/dist/modules/agenda/index.js.map +1 -0
- package/dist/modules/embedding/adapters/ai/index.d.ts +29 -0
- package/dist/modules/embedding/adapters/ai/index.d.ts.map +1 -0
- package/dist/modules/embedding/adapters/ai/index.js +58 -0
- package/dist/modules/embedding/adapters/ai/index.js.map +1 -0
- package/dist/modules/embedding/index.d.ts +36 -0
- package/dist/modules/embedding/index.d.ts.map +1 -0
- package/dist/modules/embedding/index.js +60 -0
- package/dist/modules/embedding/index.js.map +1 -0
- package/dist/modules/memory/adapters/in-memory/index.d.ts +120 -0
- package/dist/modules/memory/adapters/in-memory/index.d.ts.map +1 -0
- package/dist/modules/memory/adapters/in-memory/index.js +211 -0
- package/dist/modules/memory/adapters/in-memory/index.js.map +1 -0
- package/dist/modules/memory/adapters/meilisearch/index.d.ts +110 -0
- package/dist/modules/memory/adapters/meilisearch/index.d.ts.map +1 -0
- package/dist/modules/memory/adapters/meilisearch/index.js +321 -0
- package/dist/modules/memory/adapters/meilisearch/index.js.map +1 -0
- package/dist/modules/memory/adapters/redis/index.d.ts +82 -0
- package/dist/modules/memory/adapters/redis/index.d.ts.map +1 -0
- package/dist/modules/memory/adapters/redis/index.js +159 -0
- package/dist/modules/memory/adapters/redis/index.js.map +1 -0
- package/dist/modules/memory/index.d.ts +67 -0
- package/dist/modules/memory/index.d.ts.map +1 -0
- package/dist/modules/memory/index.js +104 -0
- package/dist/modules/memory/index.js.map +1 -0
- package/dist/types/index.d.ts +166 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/generate-action-schema.d.ts +5 -0
- package/dist/utils/generate-action-schema.d.ts.map +1 -0
- package/dist/utils/generate-action-schema.js +44 -0
- package/dist/utils/generate-action-schema.js.map +1 -0
- package/dist/utils/header-builder.d.ts +12 -0
- package/dist/utils/header-builder.d.ts.map +1 -0
- package/dist/utils/header-builder.js +35 -0
- package/dist/utils/header-builder.js.map +1 -0
- package/graph/event-manager.ts +9 -2
- package/graph/node.ts +25 -63
- package/graph/observer.ts +17 -9
- package/package.json +5 -1
- package/test/graph/controller.test.ts +0 -0
- package/test/graph/event-manager.test.ts +72 -0
- package/test/graph/index.test.ts +41 -34
- package/test/graph/node.test.ts +197 -0
- package/tsconfig.json +13 -2
package/README.md
CHANGED
@@ -34,50 +34,35 @@ npm install @ai.ntellect/core zod
|
|
34
34
|
## Example
|
35
35
|
|
36
36
|
```typescript
|
37
|
-
import { z } from "zod";
|
38
37
|
import { GraphFlow } from "@ai.ntellect/core";
|
38
|
+
import { z } from "zod";
|
39
39
|
|
40
|
-
//
|
40
|
+
// Definition of the context schema
|
41
41
|
const ContextSchema = z.object({
|
42
42
|
message: z.string(),
|
43
|
-
counter: z.number(),
|
44
43
|
});
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
type ContextSchema = typeof ContextSchema;
|
46
|
+
|
47
|
+
// Definition of the graph
|
48
|
+
const myGraph = new GraphFlow<ContextSchema>("TestGraph", {
|
49
|
+
name: "TestGraph",
|
50
|
+
context: { message: "Installation success" },
|
49
51
|
schema: ContextSchema,
|
50
|
-
context: { message: "Hello", counter: 0 },
|
51
52
|
nodes: [
|
52
53
|
{
|
53
|
-
name: "
|
54
|
-
execute: async (context) => {
|
55
|
-
context.counter++;
|
56
|
-
},
|
57
|
-
next: ["checkThreshold"],
|
58
|
-
},
|
59
|
-
{
|
60
|
-
name: "checkThreshold",
|
61
|
-
condition: (context) => context.counter < 5,
|
54
|
+
name: "printMessage",
|
62
55
|
execute: async (context) => {
|
63
|
-
|
64
|
-
context.message = "Threshold reached!";
|
65
|
-
}
|
66
|
-
},
|
67
|
-
next: ["incrementCounter"],
|
68
|
-
retry: {
|
69
|
-
maxAttempts: 3,
|
70
|
-
delay: 1000,
|
56
|
+
console.log(context.message);
|
71
57
|
},
|
58
|
+
next: [],
|
72
59
|
},
|
73
60
|
],
|
74
61
|
});
|
75
62
|
|
76
|
-
//
|
63
|
+
// Execution of the graph
|
77
64
|
(async () => {
|
78
|
-
|
79
|
-
graph.execute("incrementCounter");
|
80
|
-
graph.observe().state().subscribe(console.log);
|
65
|
+
await myGraph.execute("printMessage");
|
81
66
|
})();
|
82
67
|
```
|
83
68
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ZodSchema } from "zod";
|
2
|
+
import { GraphFlow } from "./index";
|
3
|
+
/**
|
4
|
+
* Controller class for managing the execution of graph flows
|
5
|
+
* Handles both sequential and parallel execution of multiple graphs
|
6
|
+
*/
|
7
|
+
export declare class GraphFlowController {
|
8
|
+
/**
|
9
|
+
* Executes multiple graphs sequentially
|
10
|
+
* @param graphs - Array of GraphFlow instances to execute
|
11
|
+
* @param startNodes - Array of starting node identifiers for each graph
|
12
|
+
* @param inputContexts - Optional array of initial contexts for each graph
|
13
|
+
* @returns Map containing results of each graph execution, keyed by graph name and index
|
14
|
+
* @template T - Zod schema type for graph context validation
|
15
|
+
*/
|
16
|
+
static executeSequential<T extends ZodSchema[]>(graphs: {
|
17
|
+
[K in keyof T]: GraphFlow<T[K]>;
|
18
|
+
}, startNodes: string[], inputs: any[]): Promise<any[]>;
|
19
|
+
/**
|
20
|
+
* Executes multiple graphs in parallel with optional concurrency control
|
21
|
+
* @param graphs - Array of GraphFlow instances to execute
|
22
|
+
* @param startNodes - Array of starting node identifiers for each graph
|
23
|
+
* @param inputContexts - Optional array of initial contexts for each graph
|
24
|
+
* @param inputs - Optional array of additional inputs for each graph
|
25
|
+
* @param concurrencyLimit - Optional limit on number of concurrent graph executions
|
26
|
+
* @returns Map containing results of each graph execution, keyed by graph name
|
27
|
+
* @template T - Zod schema type for graph context validation
|
28
|
+
*/
|
29
|
+
static executeParallel<T extends ZodSchema[]>(graphs: {
|
30
|
+
[K in keyof T]: GraphFlow<T[K]>;
|
31
|
+
}, startNodes: string[], concurrency: number, inputs: any[]): Promise<any[]>;
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=controller.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../graph/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;;;;;;OAOG;WACU,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAAE,EAClD,MAAM,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,EAC3C,UAAU,EAAE,MAAM,EAAE,EACpB,MAAM,EAAE,GAAG,EAAE,GACZ,OAAO,CAAC,GAAG,EAAE,CAAC;IASjB;;;;;;;;;OASG;WACU,eAAe,CAAC,CAAC,SAAS,SAAS,EAAE,EAChD,MAAM,EAAE;SAAG,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,EAC3C,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,GAAG,EAAE,GACZ,OAAO,CAAC,GAAG,EAAE,CAAC;CAgClB"}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.GraphFlowController = void 0;
|
13
|
+
/**
|
14
|
+
* Controller class for managing the execution of graph flows
|
15
|
+
* Handles both sequential and parallel execution of multiple graphs
|
16
|
+
*/
|
17
|
+
class GraphFlowController {
|
18
|
+
/**
|
19
|
+
* Executes multiple graphs sequentially
|
20
|
+
* @param graphs - Array of GraphFlow instances to execute
|
21
|
+
* @param startNodes - Array of starting node identifiers for each graph
|
22
|
+
* @param inputContexts - Optional array of initial contexts for each graph
|
23
|
+
* @returns Map containing results of each graph execution, keyed by graph name and index
|
24
|
+
* @template T - Zod schema type for graph context validation
|
25
|
+
*/
|
26
|
+
static executeSequential(graphs, startNodes, inputs) {
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
28
|
+
const results = new Map();
|
29
|
+
for (let i = 0; i < graphs.length; i++) {
|
30
|
+
const result = yield graphs[i].execute(startNodes[i], inputs[i]);
|
31
|
+
results.set(`${graphs[i].name}-${i}`, result);
|
32
|
+
}
|
33
|
+
return Array.from(results.values());
|
34
|
+
});
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Executes multiple graphs in parallel with optional concurrency control
|
38
|
+
* @param graphs - Array of GraphFlow instances to execute
|
39
|
+
* @param startNodes - Array of starting node identifiers for each graph
|
40
|
+
* @param inputContexts - Optional array of initial contexts for each graph
|
41
|
+
* @param inputs - Optional array of additional inputs for each graph
|
42
|
+
* @param concurrencyLimit - Optional limit on number of concurrent graph executions
|
43
|
+
* @returns Map containing results of each graph execution, keyed by graph name
|
44
|
+
* @template T - Zod schema type for graph context validation
|
45
|
+
*/
|
46
|
+
static executeParallel(graphs, startNodes, concurrency, inputs) {
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
48
|
+
const results = new Map();
|
49
|
+
if (inputs) {
|
50
|
+
inputs = inputs.map((input) => input || {});
|
51
|
+
}
|
52
|
+
if (concurrency) {
|
53
|
+
for (let i = 0; i < graphs.length; i += concurrency) {
|
54
|
+
const batchResults = yield Promise.all(graphs
|
55
|
+
.slice(i, i + concurrency)
|
56
|
+
.map((graph, index) => graph.execute(startNodes[i + index], inputs === null || inputs === void 0 ? void 0 : inputs[i + index])));
|
57
|
+
batchResults.forEach((result, index) => {
|
58
|
+
results.set(`${graphs[i + index].name}`, result);
|
59
|
+
});
|
60
|
+
}
|
61
|
+
}
|
62
|
+
else {
|
63
|
+
const allResults = yield Promise.all(graphs.map((graph, index) => graph.execute(startNodes[index], (inputs === null || inputs === void 0 ? void 0 : inputs[index]) || {})));
|
64
|
+
allResults.forEach((result, index) => {
|
65
|
+
results.set(`${graphs[index].name}`, result);
|
66
|
+
});
|
67
|
+
}
|
68
|
+
return Array.from(results.values());
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
exports.GraphFlowController = GraphFlowController;
|
73
|
+
//# sourceMappingURL=controller.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../graph/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA;;;GAGG;AACH,MAAa,mBAAmB;IAC9B;;;;;;;OAOG;IACH,MAAM,CAAO,iBAAiB,CAC5B,MAA2C,EAC3C,UAAoB,EACpB,MAAa;;YAEb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAoC,CAAC;YAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC;KAAA;IAED;;;;;;;;;OASG;IACH,MAAM,CA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CAAC;gBACF,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;oBACnC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACL,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC;KAAA;CACF;AArED,kDAqEC"}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
import { ZodSchema } from "zod";
|
2
|
+
import { IEventEmitter } from "../interfaces";
|
3
|
+
import { GraphContext, Node } from "../types";
|
4
|
+
import { GraphNode } from "./node";
|
5
|
+
/**
|
6
|
+
* Manages event handling and routing for a graph
|
7
|
+
* Coordinates event emission, listening, and execution of event-driven nodes
|
8
|
+
* @template T - The Zod schema type for validation
|
9
|
+
*/
|
10
|
+
export declare class GraphEventManager<T extends ZodSchema> {
|
11
|
+
private eventEmitter;
|
12
|
+
private nodes;
|
13
|
+
private nodeExecutor?;
|
14
|
+
private eventSubject;
|
15
|
+
private nodeStreams;
|
16
|
+
private context;
|
17
|
+
private name;
|
18
|
+
private graphEvents?;
|
19
|
+
private entryNode?;
|
20
|
+
private globalErrorHandler?;
|
21
|
+
/**
|
22
|
+
* Creates a new GraphEventManager instance
|
23
|
+
* @param eventEmitter - The event emitter implementation to use
|
24
|
+
* @param nodes - Map of all nodes in the graph
|
25
|
+
* @param name - Name of the graph
|
26
|
+
* @param context - Initial graph context
|
27
|
+
* @param graphEvents - List of events the graph should listen to
|
28
|
+
* @param entryNode - Name of the entry node for graph events
|
29
|
+
* @param globalErrorHandler - Global error handling function
|
30
|
+
* @param nodeExecutor - GraphNode instance for executing nodes
|
31
|
+
*/
|
32
|
+
constructor(eventEmitter: IEventEmitter, nodes: Map<string, Node<T, any>>, name: string, context: GraphContext<T>, graphEvents?: string[], entryNode?: string, globalErrorHandler?: (error: Error, context: GraphContext<T>) => void, nodeExecutor?: GraphNode<T> | undefined);
|
33
|
+
/**
|
34
|
+
* Sets up event streams for all nodes that listen to events
|
35
|
+
*/
|
36
|
+
setupEventStreams(): void;
|
37
|
+
/**
|
38
|
+
* Emits an event with optional payload and context
|
39
|
+
* @param type - The type of event to emit
|
40
|
+
* @param payload - Optional payload data
|
41
|
+
* @param context - Optional graph context
|
42
|
+
*/
|
43
|
+
emitEvent<P = any>(type: string, payload?: P, context?: GraphContext<T>): void;
|
44
|
+
/**
|
45
|
+
* Sets up event listeners for all nodes in the graph
|
46
|
+
* Handles cleanup and re-registration of event listeners
|
47
|
+
*/
|
48
|
+
setupEventListeners(): void;
|
49
|
+
/**
|
50
|
+
* Sets up listeners for graph-level events
|
51
|
+
* Handles graph start, completion, and error events
|
52
|
+
*/
|
53
|
+
setupGraphEventListeners(): void;
|
54
|
+
/**
|
55
|
+
* Waits for a set of events to occur within a timeout period
|
56
|
+
* @param events - Array of event names to wait for
|
57
|
+
* @param timeout - Maximum time to wait in milliseconds
|
58
|
+
* @returns Promise that resolves with array of received events
|
59
|
+
* @throws Error if timeout occurs before all events are received
|
60
|
+
*/
|
61
|
+
waitForEvents(events: string[], timeout?: number): Promise<any[]>;
|
62
|
+
/**
|
63
|
+
* Registers an event handler
|
64
|
+
* @param eventName - Name of the event to listen for
|
65
|
+
* @param handler - Function to handle the event
|
66
|
+
*/
|
67
|
+
on(eventName: string, handler: (...args: any[]) => void): void;
|
68
|
+
/**
|
69
|
+
* Emits an event through the event emitter
|
70
|
+
* @param eventName - Name of the event to emit
|
71
|
+
* @param data - Optional data to include with the event
|
72
|
+
*/
|
73
|
+
emit(eventName: string, data?: any): void;
|
74
|
+
/**
|
75
|
+
* Creates a new context object by cloning the current context
|
76
|
+
* @returns A new graph context instance
|
77
|
+
* @private
|
78
|
+
*/
|
79
|
+
private createNewContext;
|
80
|
+
/**
|
81
|
+
* Executes a node with the given parameters
|
82
|
+
* @param nodeName - Name of the node to execute
|
83
|
+
* @param context - Graph context for execution
|
84
|
+
* @param inputs - Input data for the node
|
85
|
+
* @param triggeredByEvent - Whether execution was triggered by an event
|
86
|
+
* @returns Promise that resolves when execution is complete
|
87
|
+
* @throws Error if nodeExecutor is not initialized
|
88
|
+
* @private
|
89
|
+
*/
|
90
|
+
private executeNode;
|
91
|
+
}
|
92
|
+
//# sourceMappingURL=event-manager.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-manager.d.ts","sourceRoot":"","sources":["../../graph/event-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAc,IAAI,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;;GAIG;AACH,qBAAa,iBAAiB,CAAC,CAAC,SAAS,SAAS;IAqB9C,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,YAAY,CAAC;IA3BvB,OAAO,CAAC,YAAY,CAAyC;IAC7D,OAAO,CAAC,WAAW,CAAqD;IACxE,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAC,CAAW;IAC/B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,kBAAkB,CAAC,CAAmD;IAE9E;;;;;;;;;;OAUG;gBAEO,YAAY,EAAE,aAAa,EAC3B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,EAC7D,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,YAAA;IAUrC;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAWhC;;;;;OAKG;IACI,SAAS,CAAC,CAAC,GAAG,GAAG,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,CAAC,EACX,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,GACxB,IAAI;IAaP;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAiD3B;;;OAGG;IACH,wBAAwB,IAAI,IAAI;IAuChC;;;;;;OAMG;IACG,aAAa,CACjB,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,GAAE,MAAc,GACtB,OAAO,CAAC,GAAG,EAAE,CAAC;IAiDjB;;;;OAIG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAI9D;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAIzC;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;;OASG;YACW,WAAW;CAgB1B"}
|
@@ -0,0 +1,244 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
exports.GraphEventManager = void 0;
|
13
|
+
const rxjs_1 = require("rxjs");
|
14
|
+
/**
|
15
|
+
* Manages event handling and routing for a graph
|
16
|
+
* Coordinates event emission, listening, and execution of event-driven nodes
|
17
|
+
* @template T - The Zod schema type for validation
|
18
|
+
*/
|
19
|
+
class GraphEventManager {
|
20
|
+
/**
|
21
|
+
* Creates a new GraphEventManager instance
|
22
|
+
* @param eventEmitter - The event emitter implementation to use
|
23
|
+
* @param nodes - Map of all nodes in the graph
|
24
|
+
* @param name - Name of the graph
|
25
|
+
* @param context - Initial graph context
|
26
|
+
* @param graphEvents - List of events the graph should listen to
|
27
|
+
* @param entryNode - Name of the entry node for graph events
|
28
|
+
* @param globalErrorHandler - Global error handling function
|
29
|
+
* @param nodeExecutor - GraphNode instance for executing nodes
|
30
|
+
*/
|
31
|
+
constructor(eventEmitter, nodes, name, context, graphEvents, entryNode, globalErrorHandler, nodeExecutor) {
|
32
|
+
this.eventEmitter = eventEmitter;
|
33
|
+
this.nodes = nodes;
|
34
|
+
this.nodeExecutor = nodeExecutor;
|
35
|
+
this.eventSubject = new rxjs_1.Subject();
|
36
|
+
this.nodeStreams = new Map();
|
37
|
+
this.name = name;
|
38
|
+
this.context = context;
|
39
|
+
this.graphEvents = graphEvents;
|
40
|
+
this.entryNode = entryNode;
|
41
|
+
this.globalErrorHandler = globalErrorHandler;
|
42
|
+
this.setupEventStreams();
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Sets up event streams for all nodes that listen to events
|
46
|
+
*/
|
47
|
+
setupEventStreams() {
|
48
|
+
for (const [nodeName, node] of this.nodes.entries()) {
|
49
|
+
if (node.events && node.events.length > 0) {
|
50
|
+
const nodeStream = this.eventSubject.pipe((0, rxjs_1.filter)((event) => node.events.includes(event.type)));
|
51
|
+
this.nodeStreams.set(nodeName, nodeStream);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Emits an event with optional payload and context
|
57
|
+
* @param type - The type of event to emit
|
58
|
+
* @param payload - Optional payload data
|
59
|
+
* @param context - Optional graph context
|
60
|
+
*/
|
61
|
+
emitEvent(type, payload, context) {
|
62
|
+
// Éviter la double imbrication des événements
|
63
|
+
const event = {
|
64
|
+
type,
|
65
|
+
payload,
|
66
|
+
timestamp: Date.now(),
|
67
|
+
};
|
68
|
+
// Émettre l'événement une seule fois
|
69
|
+
this.eventSubject.next(event);
|
70
|
+
this.eventEmitter.emit(type, payload);
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* Sets up event listeners for all nodes in the graph
|
74
|
+
* Handles cleanup and re-registration of event listeners
|
75
|
+
*/
|
76
|
+
setupEventListeners() {
|
77
|
+
// First remove only the existing node-based listeners that we might have created previously
|
78
|
+
// We do NOT remove, for example, "nodeStarted" or "nodeCompleted" listeners that test code added.
|
79
|
+
for (const [eventName, listener] of this.eventEmitter
|
80
|
+
.rawListeners("*")
|
81
|
+
.entries()) {
|
82
|
+
// This can be tricky—EventEmitter doesn't directly let you remove by "type" of listener.
|
83
|
+
// Alternatively, we can store references in a separate structure.
|
84
|
+
// For simplicity, let's do a full removeAllListeners() on node-specified events (only),
|
85
|
+
// then re-add them below, but keep the test-based events like "nodeStarted" or "nodeCompleted".
|
86
|
+
}
|
87
|
+
// The simplest approach: removeAllListeners for each event that is declared as a node event
|
88
|
+
// so we don't stack up duplicates:
|
89
|
+
const allEvents = new Set();
|
90
|
+
for (const node of this.nodes.values()) {
|
91
|
+
if (node.events) {
|
92
|
+
node.events.forEach((evt) => allEvents.add(evt));
|
93
|
+
}
|
94
|
+
}
|
95
|
+
for (const evt of allEvents) {
|
96
|
+
// remove only those events that are used by nodes
|
97
|
+
this.eventEmitter.removeAllListeners(evt);
|
98
|
+
}
|
99
|
+
// Now re-add the node-based event triggers
|
100
|
+
for (const node of this.nodes.values()) {
|
101
|
+
if (node.events && node.events.length > 0) {
|
102
|
+
node.events.forEach((event) => {
|
103
|
+
this.eventEmitter.on(event, (data) => __awaiter(this, void 0, void 0, function* () {
|
104
|
+
const freshContext = structuredClone(this.context);
|
105
|
+
if (data)
|
106
|
+
Object.assign(freshContext, data);
|
107
|
+
// If triggered by an event, we pass "true" so event-driven node will skip `next`.
|
108
|
+
yield this.executeNode(node.name, freshContext, undefined,
|
109
|
+
/* triggeredByEvent= */ true);
|
110
|
+
}));
|
111
|
+
});
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
/**
|
116
|
+
* Sets up listeners for graph-level events
|
117
|
+
* Handles graph start, completion, and error events
|
118
|
+
*/
|
119
|
+
setupGraphEventListeners() {
|
120
|
+
if (this.graphEvents && this.graphEvents.length > 0) {
|
121
|
+
this.graphEvents.forEach((event) => {
|
122
|
+
this.eventEmitter.on(event, (data) => __awaiter(this, void 0, void 0, function* () {
|
123
|
+
var _a;
|
124
|
+
const freshContext = this.createNewContext();
|
125
|
+
if (data)
|
126
|
+
Object.assign(freshContext, data);
|
127
|
+
// Emit "graphStarted"
|
128
|
+
this.eventEmitter.emit("graphStarted", { name: this.name });
|
129
|
+
try {
|
130
|
+
// Execute the graph starting from the entry node
|
131
|
+
if (!this.entryNode) {
|
132
|
+
throw new Error("No entry node defined for graph event handling");
|
133
|
+
}
|
134
|
+
yield this.executeNode(this.entryNode, freshContext, undefined, false);
|
135
|
+
// Emit "graphCompleted"
|
136
|
+
this.eventEmitter.emit("graphCompleted", {
|
137
|
+
name: this.name,
|
138
|
+
context: this.context,
|
139
|
+
});
|
140
|
+
}
|
141
|
+
catch (error) {
|
142
|
+
// Emit "graphError"
|
143
|
+
this.eventEmitter.emit("graphError", { name: this.name, error });
|
144
|
+
(_a = this.globalErrorHandler) === null || _a === void 0 ? void 0 : _a.call(this, error, freshContext);
|
145
|
+
throw error;
|
146
|
+
}
|
147
|
+
}));
|
148
|
+
});
|
149
|
+
}
|
150
|
+
}
|
151
|
+
/**
|
152
|
+
* Waits for a set of events to occur within a timeout period
|
153
|
+
* @param events - Array of event names to wait for
|
154
|
+
* @param timeout - Maximum time to wait in milliseconds
|
155
|
+
* @returns Promise that resolves with array of received events
|
156
|
+
* @throws Error if timeout occurs before all events are received
|
157
|
+
*/
|
158
|
+
waitForEvents(events_1) {
|
159
|
+
return __awaiter(this, arguments, void 0, function* (events, timeout = 30000) {
|
160
|
+
return new Promise((resolve, reject) => {
|
161
|
+
const receivedEvents = new Map();
|
162
|
+
const eventHandlers = new Map();
|
163
|
+
let isResolved = false;
|
164
|
+
const cleanup = () => {
|
165
|
+
events.forEach((event) => {
|
166
|
+
const handler = eventHandlers.get(event);
|
167
|
+
if (handler) {
|
168
|
+
this.eventEmitter.removeListener(event, handler);
|
169
|
+
}
|
170
|
+
});
|
171
|
+
};
|
172
|
+
events.forEach((event) => {
|
173
|
+
const handler = (eventData) => {
|
174
|
+
console.log(`Received event: ${event}`, eventData);
|
175
|
+
if (!isResolved) {
|
176
|
+
receivedEvents.set(event, eventData);
|
177
|
+
console.log("Current received events:", Array.from(receivedEvents.keys()));
|
178
|
+
if (events.every((e) => receivedEvents.has(e))) {
|
179
|
+
console.log("All events received, resolving");
|
180
|
+
isResolved = true;
|
181
|
+
clearTimeout(timeoutId);
|
182
|
+
cleanup();
|
183
|
+
resolve(Array.from(receivedEvents.values()));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
};
|
187
|
+
eventHandlers.set(event, handler);
|
188
|
+
this.eventEmitter.on(event, handler);
|
189
|
+
});
|
190
|
+
const timeoutId = setTimeout(() => {
|
191
|
+
if (!isResolved) {
|
192
|
+
isResolved = true;
|
193
|
+
cleanup();
|
194
|
+
reject(new Error(`Timeout waiting for events: ${events.join(", ")}`));
|
195
|
+
}
|
196
|
+
}, timeout);
|
197
|
+
});
|
198
|
+
});
|
199
|
+
}
|
200
|
+
/**
|
201
|
+
* Registers an event handler
|
202
|
+
* @param eventName - Name of the event to listen for
|
203
|
+
* @param handler - Function to handle the event
|
204
|
+
*/
|
205
|
+
on(eventName, handler) {
|
206
|
+
this.eventEmitter.on(eventName, handler);
|
207
|
+
}
|
208
|
+
/**
|
209
|
+
* Emits an event through the event emitter
|
210
|
+
* @param eventName - Name of the event to emit
|
211
|
+
* @param data - Optional data to include with the event
|
212
|
+
*/
|
213
|
+
emit(eventName, data) {
|
214
|
+
this.eventEmitter.emit(eventName, data);
|
215
|
+
}
|
216
|
+
/**
|
217
|
+
* Creates a new context object by cloning the current context
|
218
|
+
* @returns A new graph context instance
|
219
|
+
* @private
|
220
|
+
*/
|
221
|
+
createNewContext() {
|
222
|
+
return structuredClone(this.context);
|
223
|
+
}
|
224
|
+
/**
|
225
|
+
* Executes a node with the given parameters
|
226
|
+
* @param nodeName - Name of the node to execute
|
227
|
+
* @param context - Graph context for execution
|
228
|
+
* @param inputs - Input data for the node
|
229
|
+
* @param triggeredByEvent - Whether execution was triggered by an event
|
230
|
+
* @returns Promise that resolves when execution is complete
|
231
|
+
* @throws Error if nodeExecutor is not initialized
|
232
|
+
* @private
|
233
|
+
*/
|
234
|
+
executeNode(nodeName, context, inputs, triggeredByEvent) {
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
236
|
+
if (!this.nodeExecutor) {
|
237
|
+
throw new Error("NodeExecutor not initialized");
|
238
|
+
}
|
239
|
+
return this.nodeExecutor.executeNode(nodeName, context, inputs, triggeredByEvent);
|
240
|
+
});
|
241
|
+
}
|
242
|
+
}
|
243
|
+
exports.GraphEventManager = GraphEventManager;
|
244
|
+
//# sourceMappingURL=event-manager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"event-manager.js","sourceRoot":"","sources":["../../graph/event-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAmD;AAMnD;;;;GAIG;AACH,MAAa,iBAAiB;IAS5B;;;;;;;;;;OAUG;IACH,YACU,YAA2B,EAC3B,KAAgC,EACxC,IAAY,EACZ,OAAwB,EACxB,WAAs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