@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
@@ -0,0 +1,103 @@
|
|
1
|
+
import { BehaviorSubject, Subject } from "rxjs";
|
2
|
+
import { ZodSchema } from "zod";
|
3
|
+
import { GraphContext, GraphEvent, Node } from "../types";
|
4
|
+
import { GraphEventManager } from "./event-manager";
|
5
|
+
import { GraphLogger } from "./logger";
|
6
|
+
/**
|
7
|
+
* Represents a node in the graph that can execute operations and manage state
|
8
|
+
* @template T - The Zod schema type for validation
|
9
|
+
*/
|
10
|
+
export declare class GraphNode<T extends ZodSchema> {
|
11
|
+
private nodes;
|
12
|
+
private logger;
|
13
|
+
private eventManager;
|
14
|
+
private eventSubject;
|
15
|
+
private stateSubject;
|
16
|
+
/**
|
17
|
+
* Creates a new GraphNode instance
|
18
|
+
* @param nodes - Map of all nodes in the graph
|
19
|
+
* @param logger - Logger instance for tracking node operations
|
20
|
+
* @param eventManager - Manager for handling graph events
|
21
|
+
* @param eventSubject - Subject for emitting events
|
22
|
+
* @param stateSubject - Subject for managing graph state
|
23
|
+
*/
|
24
|
+
constructor(nodes: Map<string, Node<T, any>>, logger: GraphLogger, eventManager: GraphEventManager<T>, eventSubject: Subject<GraphEvent<T>>, stateSubject: BehaviorSubject<GraphContext<T>>);
|
25
|
+
/**
|
26
|
+
* Emits an event with the specified type and payload
|
27
|
+
* @param type - The type of event to emit
|
28
|
+
* @param payload - The data associated with the event
|
29
|
+
* @private
|
30
|
+
*/
|
31
|
+
private emitEvent;
|
32
|
+
/**
|
33
|
+
* Executes a node with the given name and context
|
34
|
+
* @param nodeName - The name of the node to execute
|
35
|
+
* @param context - The current graph context
|
36
|
+
* @param inputs - Input data for the node
|
37
|
+
* @param triggeredByEvent - Whether the execution was triggered by an event
|
38
|
+
* @throws Error if the node is not found or execution fails
|
39
|
+
*/
|
40
|
+
executeNode(nodeName: string, context: GraphContext<T>, inputs: any, triggeredByEvent?: boolean): Promise<void>;
|
41
|
+
/**
|
42
|
+
* Validates the inputs for a node using its schema
|
43
|
+
* @param node - The node whose inputs need validation
|
44
|
+
* @param inputs - The input data to validate
|
45
|
+
* @param nodeName - The name of the node (for error messages)
|
46
|
+
* @throws Error if validation fails
|
47
|
+
* @private
|
48
|
+
*/
|
49
|
+
private validateInputs;
|
50
|
+
/**
|
51
|
+
* Validates the outputs of a node against its schema
|
52
|
+
* @param node - The node whose outputs need validation
|
53
|
+
* @param context - The current graph context
|
54
|
+
* @param nodeName - The name of the node (for error messages)
|
55
|
+
* @throws Error if validation fails
|
56
|
+
* @private
|
57
|
+
*/
|
58
|
+
private validateOutputs;
|
59
|
+
/**
|
60
|
+
* Handles event-related operations for a node
|
61
|
+
* @param node - The node whose events need handling
|
62
|
+
* @param nodeName - The name of the node
|
63
|
+
* @param context - The current graph context
|
64
|
+
* @private
|
65
|
+
*/
|
66
|
+
private handleEvents;
|
67
|
+
/**
|
68
|
+
* Executes a node with retry logic
|
69
|
+
* @param node - The node to execute
|
70
|
+
* @param contextProxy - The proxied graph context
|
71
|
+
* @param inputs - Input data for the node
|
72
|
+
* @param nodeName - The name of the node
|
73
|
+
* @throws Error if all retry attempts fail
|
74
|
+
* @private
|
75
|
+
*/
|
76
|
+
private executeWithRetry;
|
77
|
+
/**
|
78
|
+
* Handles the failure of retry attempts
|
79
|
+
* @param node - The node that failed
|
80
|
+
* @param error - The error that caused the failure
|
81
|
+
* @param context - The current graph context
|
82
|
+
* @param nodeName - The name of the node
|
83
|
+
* @private
|
84
|
+
*/
|
85
|
+
private handleRetryFailure;
|
86
|
+
/**
|
87
|
+
* Handles correlated events for a node
|
88
|
+
* @param node - The node with correlated events
|
89
|
+
* @param nodeName - The name of the node
|
90
|
+
* @throws Error if correlation fails or timeout occurs
|
91
|
+
* @private
|
92
|
+
*/
|
93
|
+
private handleCorrelatedEvents;
|
94
|
+
/**
|
95
|
+
* Handles waiting for events
|
96
|
+
* @param node - The node waiting for events
|
97
|
+
* @param nodeName - The name of the node
|
98
|
+
* @throws Error if timeout occurs
|
99
|
+
* @private
|
100
|
+
*/
|
101
|
+
private handleWaitForEvents;
|
102
|
+
}
|
103
|
+
//# sourceMappingURL=node.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../graph/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,qBAAa,SAAS,CAAC,CAAC,SAAS,SAAS;IAUtC,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,YAAY;IAbtB;;;;;;;OAOG;gBAEO,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAChC,MAAM,EAAE,WAAW,EACnB,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAClC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EACpC,YAAY,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAGxD;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAwBjB;;;;;;;OAOG;IACG,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,MAAM,EAAE,GAAG,EACX,gBAAgB,GAAE,OAAe,GAChC,OAAO,CAAC,IAAI,CAAC;IA+DhB;;;;;;;OAOG;YACW,cAAc;IAkB5B;;;;;;;OAOG;YACW,eAAe;IAgB7B;;;;;;OAMG;YACW,YAAY;IAc1B;;;;;;;;OAQG;YACW,gBAAgB;IA0C9B;;;;;;;OAOG;YACW,kBAAkB;IA8BhC;;;;;;OAMG;YACW,sBAAsB;IAuCpC;;;;;;OAMG;YACW,mBAAmB;CAalC"}
|
@@ -0,0 +1,284 @@
|
|
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.GraphNode = void 0;
|
13
|
+
/**
|
14
|
+
* Represents a node in the graph that can execute operations and manage state
|
15
|
+
* @template T - The Zod schema type for validation
|
16
|
+
*/
|
17
|
+
class GraphNode {
|
18
|
+
/**
|
19
|
+
* Creates a new GraphNode instance
|
20
|
+
* @param nodes - Map of all nodes in the graph
|
21
|
+
* @param logger - Logger instance for tracking node operations
|
22
|
+
* @param eventManager - Manager for handling graph events
|
23
|
+
* @param eventSubject - Subject for emitting events
|
24
|
+
* @param stateSubject - Subject for managing graph state
|
25
|
+
*/
|
26
|
+
constructor(nodes, logger, eventManager, eventSubject, stateSubject) {
|
27
|
+
this.nodes = nodes;
|
28
|
+
this.logger = logger;
|
29
|
+
this.eventManager = eventManager;
|
30
|
+
this.eventSubject = eventSubject;
|
31
|
+
this.stateSubject = stateSubject;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Emits an event with the specified type and payload
|
35
|
+
* @param type - The type of event to emit
|
36
|
+
* @param payload - The data associated with the event
|
37
|
+
* @private
|
38
|
+
*/
|
39
|
+
emitEvent(type, payload) {
|
40
|
+
this.logger.addLog(`📢 Event: ${type}`);
|
41
|
+
const event = {
|
42
|
+
type,
|
43
|
+
payload: Object.assign(Object.assign({}, payload), { name: type === "nodeStateChanged"
|
44
|
+
? payload.name || payload.nodeName
|
45
|
+
: payload.name, context: Object.assign({}, payload.context) }),
|
46
|
+
timestamp: Date.now(),
|
47
|
+
};
|
48
|
+
this.eventSubject.next(event);
|
49
|
+
this.eventManager.emitEvent(type, event);
|
50
|
+
// Update state subject only for state changes
|
51
|
+
if (type === "nodeStateChanged") {
|
52
|
+
this.stateSubject.next(Object.assign({}, payload.context));
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Executes a node with the given name and context
|
57
|
+
* @param nodeName - The name of the node to execute
|
58
|
+
* @param context - The current graph context
|
59
|
+
* @param inputs - Input data for the node
|
60
|
+
* @param triggeredByEvent - Whether the execution was triggered by an event
|
61
|
+
* @throws Error if the node is not found or execution fails
|
62
|
+
*/
|
63
|
+
executeNode(nodeName_1, context_1, inputs_1) {
|
64
|
+
return __awaiter(this, arguments, void 0, function* (nodeName, context, inputs, triggeredByEvent = false) {
|
65
|
+
const node = this.nodes.get(nodeName);
|
66
|
+
if (!node)
|
67
|
+
throw new Error(`Node "${nodeName}" not found.`);
|
68
|
+
this.logger.addLog(`🚀 Starting node "${nodeName}`);
|
69
|
+
this.emitEvent("nodeStarted", { name: nodeName, context });
|
70
|
+
try {
|
71
|
+
// Vérifier la condition avant d'exécuter
|
72
|
+
if (node.condition && !node.condition(context)) {
|
73
|
+
this.logger.addLog(`⏭️ Skipping node "${nodeName}" - condition not met`);
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
const contextProxy = new Proxy(context, {
|
77
|
+
set: (target, prop, value) => {
|
78
|
+
const oldValue = target[prop];
|
79
|
+
if (oldValue === value)
|
80
|
+
return true;
|
81
|
+
target[prop] = value;
|
82
|
+
this.emitEvent("nodeStateChanged", {
|
83
|
+
nodeName,
|
84
|
+
property: prop.toString(),
|
85
|
+
oldValue,
|
86
|
+
newValue: value,
|
87
|
+
context: target,
|
88
|
+
});
|
89
|
+
return true;
|
90
|
+
},
|
91
|
+
get: (target, prop) => target[prop],
|
92
|
+
});
|
93
|
+
// Exécuter le nœud
|
94
|
+
yield node.execute(contextProxy, inputs);
|
95
|
+
// Gérer la suite uniquement si pas déclenché par un événement
|
96
|
+
if (!triggeredByEvent) {
|
97
|
+
const nextNodes = typeof node.next === "function"
|
98
|
+
? node.next(contextProxy)
|
99
|
+
: node.next || [];
|
100
|
+
for (const nextNodeName of nextNodes) {
|
101
|
+
yield this.executeNode(nextNodeName, context, undefined, false);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
this.logger.addLog(`✅ Node "${nodeName}" executed successfully`);
|
105
|
+
this.emitEvent("nodeCompleted", { name: nodeName, context });
|
106
|
+
}
|
107
|
+
catch (error) {
|
108
|
+
this.logger.addLog(`❌ Error in node "${nodeName}": ${error instanceof Error ? error.message : String(error)}`);
|
109
|
+
this.emitEvent("nodeError", { name: nodeName, error, context });
|
110
|
+
throw error;
|
111
|
+
}
|
112
|
+
});
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Validates the inputs for a node using its schema
|
116
|
+
* @param node - The node whose inputs need validation
|
117
|
+
* @param inputs - The input data to validate
|
118
|
+
* @param nodeName - The name of the node (for error messages)
|
119
|
+
* @throws Error if validation fails
|
120
|
+
* @private
|
121
|
+
*/
|
122
|
+
validateInputs(node, inputs, nodeName) {
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
124
|
+
var _a, _b;
|
125
|
+
if (!inputs) {
|
126
|
+
throw new Error(`Inputs required for node "${nodeName}"`);
|
127
|
+
}
|
128
|
+
try {
|
129
|
+
return node.inputs.parse(inputs);
|
130
|
+
}
|
131
|
+
catch (error) {
|
132
|
+
throw new Error(((_b = (_a = error.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || error.message || "Input validation failed");
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
/**
|
137
|
+
* Validates the outputs of a node against its schema
|
138
|
+
* @param node - The node whose outputs need validation
|
139
|
+
* @param context - The current graph context
|
140
|
+
* @param nodeName - The name of the node (for error messages)
|
141
|
+
* @throws Error if validation fails
|
142
|
+
* @private
|
143
|
+
*/
|
144
|
+
validateOutputs(node, context, nodeName) {
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
146
|
+
var _a, _b;
|
147
|
+
try {
|
148
|
+
node.outputs.parse(context);
|
149
|
+
}
|
150
|
+
catch (error) {
|
151
|
+
throw new Error(((_b = (_a = error.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) ||
|
152
|
+
error.message ||
|
153
|
+
"Output validation failed");
|
154
|
+
}
|
155
|
+
});
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* Handles event-related operations for a node
|
159
|
+
* @param node - The node whose events need handling
|
160
|
+
* @param nodeName - The name of the node
|
161
|
+
* @param context - The current graph context
|
162
|
+
* @private
|
163
|
+
*/
|
164
|
+
handleEvents(node, nodeName, context) {
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
166
|
+
if (node.correlateEvents) {
|
167
|
+
yield this.handleCorrelatedEvents(node, nodeName);
|
168
|
+
}
|
169
|
+
if (node.waitForEvents) {
|
170
|
+
yield this.handleWaitForEvents(node, nodeName);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
}
|
174
|
+
/**
|
175
|
+
* Executes a node with retry logic
|
176
|
+
* @param node - The node to execute
|
177
|
+
* @param contextProxy - The proxied graph context
|
178
|
+
* @param inputs - Input data for the node
|
179
|
+
* @param nodeName - The name of the node
|
180
|
+
* @throws Error if all retry attempts fail
|
181
|
+
* @private
|
182
|
+
*/
|
183
|
+
executeWithRetry(node, contextProxy, inputs, nodeName) {
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
185
|
+
let attempts = 0;
|
186
|
+
let lastError = null;
|
187
|
+
while (attempts < node.retry.maxAttempts) {
|
188
|
+
try {
|
189
|
+
this.logger.addLog(`🔄 Attempt ${attempts + 1}/${node.retry.maxAttempts}`);
|
190
|
+
yield node.execute(contextProxy, inputs);
|
191
|
+
return;
|
192
|
+
}
|
193
|
+
catch (error) {
|
194
|
+
lastError = error instanceof Error ? error : new Error(error.message);
|
195
|
+
attempts++;
|
196
|
+
this.logger.addLog(`❌ Attempt ${attempts} failed: ${lastError.message}`);
|
197
|
+
if (attempts === node.retry.maxAttempts) {
|
198
|
+
if (node.retry.onRetryFailed && lastError) {
|
199
|
+
yield this.handleRetryFailure(node, lastError, contextProxy, nodeName);
|
200
|
+
}
|
201
|
+
throw lastError;
|
202
|
+
}
|
203
|
+
yield new Promise((resolve) => { var _a; return setTimeout(resolve, ((_a = node.retry) === null || _a === void 0 ? void 0 : _a.delay) || 0); });
|
204
|
+
}
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
208
|
+
/**
|
209
|
+
* Handles the failure of retry attempts
|
210
|
+
* @param node - The node that failed
|
211
|
+
* @param error - The error that caused the failure
|
212
|
+
* @param context - The current graph context
|
213
|
+
* @param nodeName - The name of the node
|
214
|
+
* @private
|
215
|
+
*/
|
216
|
+
handleRetryFailure(node, error, context, nodeName) {
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
218
|
+
var _a;
|
219
|
+
this.logger.addLog(`🔄 Executing retry failure handler for node "${nodeName}"`);
|
220
|
+
try {
|
221
|
+
if ((_a = node.retry) === null || _a === void 0 ? void 0 : _a.onRetryFailed) {
|
222
|
+
yield node.retry.onRetryFailed(error, context);
|
223
|
+
if (node.retry.continueOnFailed) {
|
224
|
+
this.logger.addLog(`✅ Retry failure handler succeeded - continuing execution`);
|
225
|
+
return;
|
226
|
+
}
|
227
|
+
this.logger.addLog(`⚠️ Retry failure handler executed but node will still fail`);
|
228
|
+
}
|
229
|
+
}
|
230
|
+
catch (handlerError) {
|
231
|
+
this.logger.addLog(`❌ Retry failure handler failed: ${handlerError.message}`);
|
232
|
+
throw handlerError;
|
233
|
+
}
|
234
|
+
});
|
235
|
+
}
|
236
|
+
/**
|
237
|
+
* Handles correlated events for a node
|
238
|
+
* @param node - The node with correlated events
|
239
|
+
* @param nodeName - The name of the node
|
240
|
+
* @throws Error if correlation fails or timeout occurs
|
241
|
+
* @private
|
242
|
+
*/
|
243
|
+
handleCorrelatedEvents(node, nodeName) {
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
245
|
+
if (node.correlateEvents) {
|
246
|
+
const { events, timeout, correlation } = node.correlateEvents;
|
247
|
+
this.logger.addLog(`⏳ Node "${nodeName}" waiting for correlated events: ${events.join(", ")}`);
|
248
|
+
try {
|
249
|
+
// Attendre les événements
|
250
|
+
const receivedEvents = yield this.eventManager.waitForEvents(events, timeout);
|
251
|
+
// Vérifier la corrélation
|
252
|
+
if (!correlation(receivedEvents)) {
|
253
|
+
this.logger.addLog(`❌ Event correlation failed for node "${nodeName}"`);
|
254
|
+
throw new Error(`Event correlation failed for node "${nodeName}"`);
|
255
|
+
}
|
256
|
+
this.logger.addLog(`✅ Event correlation succeeded for node "${nodeName}"`);
|
257
|
+
}
|
258
|
+
catch (error) {
|
259
|
+
this.logger.addLog(`❌ Error waiting for events: ${error.message}`);
|
260
|
+
throw error;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
});
|
264
|
+
}
|
265
|
+
/**
|
266
|
+
* Handles waiting for events
|
267
|
+
* @param node - The node waiting for events
|
268
|
+
* @param nodeName - The name of the node
|
269
|
+
* @throws Error if timeout occurs
|
270
|
+
* @private
|
271
|
+
*/
|
272
|
+
handleWaitForEvents(node, nodeName) {
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
274
|
+
if (node.waitForEvents) {
|
275
|
+
const { events, timeout } = node.waitForEvents;
|
276
|
+
this.logger.addLog(`⏳ Node "${nodeName}" waiting for events: ${events.join(", ")}`);
|
277
|
+
yield this.eventManager.waitForEvents(events, timeout);
|
278
|
+
this.logger.addLog(`✅ All events received for node "${nodeName}"`);
|
279
|
+
}
|
280
|
+
});
|
281
|
+
}
|
282
|
+
}
|
283
|
+
exports.GraphNode = GraphNode;
|
284
|
+
//# sourceMappingURL=node.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../graph/node.ts"],"names":[],"mappings":";;;;;;;;;;;;AAMA;;;GAGG;AACH,MAAa,SAAS;IACpB;;;;;;;OAOG;IACH,YACU,KAAgC,EAChC,MAAmB,EACnB,YAAkC,EAClC,YAAoC,EACpC,YAA8C;QAJ9C,UAAK,GAAL,KAAK,CAA2B;QAChC,WAAM,GAAN,MAAM,CAAa;QACnB,iBAAY,GAAZ,YAAY,CAAsB;QAClC,iBAAY,GAAZ,YAAY,CAAwB;QACpC,iBAAY,GAAZ,YAAY,CAAkC;IACrD,CAAC;IAEJ;;;;;OAKG;IACK,SAAS,CAAC,IAAY,EAAE,OAAY;QAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG;YACZ,IAAI;YACJ,OAAO,kCACF,OAAO,KACV,IAAI,EACF,IAAI,KAAK,kBAAkB;oBACzB,CAAC,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,QAAQ;oBAClC,CAAC,CAAC,OAAO,CAAC,IAAI,EAClB,OAAO,oBAAO,OAAO,CAAC,OAAO,IAC9B;YACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;QAEF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAA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AE,CAAC;wBACjC,IAAI,CAAC,MAAM,CAAC,MAAM,CAChB,wCAAwC,QAAQ,GAAG,CACpD,CAAC;wBACF,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,GAAG,CAAC,CAAC;oBACrE,CAAC;oBAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAChB,2CAA2C,QAAQ,GAAG,CACvD,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,MAAM,CAAC,MAAM,CAChB,+BAAgC,KAAe,CAAC,OAAO,EAAE,CAC1D,CAAC;oBACF,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACW,mBAAmB,CAC/B,IAAkB,EAClB,QAAgB;;YAEhB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;gBAC/C,IAAI,CAAC,MAAM,CAAC,MAAM,CAChB,WAAW,QAAQ,yBAAyB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChE,CAAC;gBACF,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACvD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAmC,QAAQ,GAAG,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;KAAA;CACF;AA7VD,8BA6VC"}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import { BehaviorSubject, Observable, Subject } from "rxjs";
|
2
|
+
import { ZodSchema } from "zod";
|
3
|
+
import { GraphObservable } from "../interfaces";
|
4
|
+
import { GraphContext, GraphEvent } from "../types";
|
5
|
+
import { GraphFlow } from "./index";
|
6
|
+
/**
|
7
|
+
* GraphObserver class provides reactive observation capabilities for a GraphFlow instance
|
8
|
+
* It allows monitoring state changes, node updates, and specific events in the graph
|
9
|
+
* @template T - The Zod schema type that defines the structure of the graph data
|
10
|
+
*/
|
11
|
+
export declare class GraphObserver<T extends ZodSchema> {
|
12
|
+
private graph;
|
13
|
+
private eventSubject;
|
14
|
+
private stateSubject;
|
15
|
+
private destroySubject;
|
16
|
+
constructor(graph: GraphFlow<T>, eventSubject: Subject<GraphEvent<T>>, stateSubject: BehaviorSubject<GraphContext<T>>, destroySubject: Subject<void>);
|
17
|
+
/**
|
18
|
+
* Observes the entire graph state changes
|
19
|
+
* @param options Configuration options for the observation
|
20
|
+
* @param options.debounce Debounce time in milliseconds
|
21
|
+
* @param options.delay Delay between emissions in milliseconds
|
22
|
+
* @param options.stream If true, streams the specified properties letter by letter
|
23
|
+
* @param options.properties List of properties to stream
|
24
|
+
* @param options.onStreamLetter Callback for each letter emitted during streaming
|
25
|
+
* @param options.onStreamComplete Callback when streaming is complete
|
26
|
+
* @returns An Observable that emits the complete graph context whenever it changes
|
27
|
+
*/
|
28
|
+
state(options?: {
|
29
|
+
debounce?: number;
|
30
|
+
delay?: number;
|
31
|
+
stream?: boolean;
|
32
|
+
properties?: (keyof GraphContext<T>)[];
|
33
|
+
onStreamLetter?: (data: {
|
34
|
+
letter: string;
|
35
|
+
property: string;
|
36
|
+
}) => void;
|
37
|
+
onStreamComplete?: () => void;
|
38
|
+
}): GraphObservable<T>;
|
39
|
+
/**
|
40
|
+
* Observes state changes for a specific node
|
41
|
+
* @param name - The name of the node to observe
|
42
|
+
* @returns An Observable that emits the graph context when the specified node changes
|
43
|
+
*/
|
44
|
+
node(name: string): Observable<GraphContext<T>>;
|
45
|
+
/**
|
46
|
+
* Observes state changes for multiple nodes
|
47
|
+
* @param names - Array of node names to observe
|
48
|
+
* @returns An Observable that emits the graph context when any of the specified nodes change
|
49
|
+
*/
|
50
|
+
nodes(names: string[]): Observable<GraphContext<T>>;
|
51
|
+
/**
|
52
|
+
* Observes specific properties of the graph context
|
53
|
+
* @param keys - Single or multiple property keys to observe
|
54
|
+
* @returns An Observable that emits an object containing only the specified properties
|
55
|
+
* @template K - The key of the property to observe from GraphContext<T>
|
56
|
+
*/
|
57
|
+
property<K extends keyof GraphContext<T>>(keys: K | K[]): Observable<{
|
58
|
+
[P in K]: GraphContext<T>[P];
|
59
|
+
} & {
|
60
|
+
name: string;
|
61
|
+
}>;
|
62
|
+
/**
|
63
|
+
* Observes specific events in the graph
|
64
|
+
* @param type - The type of event to observe
|
65
|
+
* @returns An Observable that emits events of the specified type
|
66
|
+
*/
|
67
|
+
event(type: string): Observable<GraphEvent<T>>;
|
68
|
+
/**
|
69
|
+
* Waits for a specific condition to be met on an observable
|
70
|
+
* @param observable - The Observable to watch
|
71
|
+
* @param predicate - A function that returns true when the desired condition is met
|
72
|
+
* @returns A Promise that resolves with the value when the predicate returns true
|
73
|
+
* @template R - The type of value emitted by the observable
|
74
|
+
*/
|
75
|
+
until<R>(observable: Observable<R>, predicate: (value: R) => boolean): Promise<R>;
|
76
|
+
/**
|
77
|
+
* Waits for correlated events to occur and validates them using a correlation function
|
78
|
+
* @param eventTypes - Array of event types to wait for
|
79
|
+
* @param timeoutMs - Timeout duration in milliseconds
|
80
|
+
* @param correlationFn - Function to validate the correlation between events
|
81
|
+
* @returns Promise that resolves when all correlated events are received
|
82
|
+
*/
|
83
|
+
waitForCorrelatedEvents(eventTypes: string[], timeoutMs: number, correlationFn: (events: GraphEvent<T>[]) => boolean): Promise<GraphEvent<T>[]>;
|
84
|
+
/**
|
85
|
+
* Observes the current state of the graph
|
86
|
+
* @returns Observable that emits the current graph context
|
87
|
+
*/
|
88
|
+
observeState(): Observable<GraphContext<T>>;
|
89
|
+
/**
|
90
|
+
* Observes specific event types in the graph
|
91
|
+
* @param eventType - The type of event to observe
|
92
|
+
* @returns Observable that emits events of the specified type
|
93
|
+
*/
|
94
|
+
observeEvents(eventType: string): Observable<GraphEvent<T>>;
|
95
|
+
/**
|
96
|
+
* Observes state changes for a specific node
|
97
|
+
* @param nodeName - The name of the node to observe
|
98
|
+
* @returns Observable that emits the graph context when the specified node changes
|
99
|
+
*/
|
100
|
+
observeNodeState(nodeName: string): Observable<GraphContext<T>>;
|
101
|
+
/**
|
102
|
+
* Streams a message letter by letter with a specified delay
|
103
|
+
* @param message - The message to stream
|
104
|
+
* @param delayMs - The delay in milliseconds between each letter
|
105
|
+
* @param property - The property name being streamed
|
106
|
+
* @returns An Observable that emits each letter of the message along with its property
|
107
|
+
*/
|
108
|
+
streamMessage(message: string, delayMs: number, property: string): Observable<{
|
109
|
+
letter: string;
|
110
|
+
property: string;
|
111
|
+
}>;
|
112
|
+
}
|
113
|
+
//# sourceMappingURL=observer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"observer.d.ts","sourceRoot":"","sources":["../../graph/observer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,OAAO,EAGR,MAAM,MAAM,CAAC;AAYd,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,SAAS,SAAS;IAE1C,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,cAAc;gBAHd,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,EACnB,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EACpC,YAAY,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAC9C,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC;IAGvC;;;;;;;;;;OAUG;IACH,KAAK,CACH,OAAO,GAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MA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