@ai.ntellect/core 0.6.20 → 0.7.0

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.
Files changed (41) hide show
  1. package/.mocharc.json +2 -1
  2. package/README.md +87 -148
  3. package/graph/controller.ts +1 -1
  4. package/graph/event-manager.ts +288 -0
  5. package/graph/index.ts +152 -384
  6. package/graph/logger.ts +70 -0
  7. package/graph/node.ts +398 -0
  8. package/graph/observer.ts +361 -0
  9. package/interfaces/index.ts +102 -1
  10. package/modules/agenda/index.ts +3 -16
  11. package/modules/embedding/index.ts +3 -3
  12. package/package.json +12 -20
  13. package/test/graph/index.test.ts +296 -154
  14. package/test/graph/observer.test.ts +398 -0
  15. package/test/modules/agenda/node-cron.test.ts +37 -16
  16. package/test/modules/memory/adapters/in-memory.test.ts +2 -2
  17. package/test/modules/memory/adapters/meilisearch.test.ts +28 -24
  18. package/test/modules/memory/base.test.ts +3 -3
  19. package/tsconfig.json +4 -2
  20. package/types/index.ts +23 -2
  21. package/utils/generate-action-schema.ts +8 -7
  22. package/.env.example +0 -2
  23. package/dist/graph/controller.js +0 -75
  24. package/dist/graph/index.js +0 -402
  25. package/dist/index.js +0 -41
  26. package/dist/interfaces/index.js +0 -17
  27. package/dist/modules/agenda/adapters/node-cron/index.js +0 -29
  28. package/dist/modules/agenda/index.js +0 -140
  29. package/dist/modules/embedding/adapters/ai/index.js +0 -57
  30. package/dist/modules/embedding/index.js +0 -59
  31. package/dist/modules/memory/adapters/in-memory/index.js +0 -210
  32. package/dist/modules/memory/adapters/meilisearch/index.js +0 -320
  33. package/dist/modules/memory/adapters/redis/index.js +0 -158
  34. package/dist/modules/memory/index.js +0 -103
  35. package/dist/types/index.js +0 -2
  36. package/dist/utils/generate-action-schema.js +0 -42
  37. package/dist/utils/header-builder.js +0 -34
  38. package/graph.ts +0 -74
  39. package/test/modules/embedding/ai.test.ts +0 -78
  40. package/test/modules/memory/adapters/redis.test.ts +0 -169
  41. package/test/services/agenda.test.ts +0 -279
@@ -1,13 +1,14 @@
1
1
  import { z } from "zod";
2
- import { Node } from "../types";
2
+ import { GraphFlow } from "../graph/index";
3
3
 
4
- export const generateActionSchema = (nodes: Node<any>[]) => {
5
- return nodes
6
- .map((node) => {
7
- const schemaStr = node.inputs
8
- ? getSchemaString(node.inputs)
4
+ export const generateActionSchema = (graphs: GraphFlow<any>[]) => {
5
+ return graphs
6
+ .map((graph) => {
7
+ const rootNode = Array.from(graph.nodes.values())[0];
8
+ const schemaStr = rootNode.inputs
9
+ ? getSchemaString(rootNode.inputs)
9
10
  : "No parameters";
10
- return `Workflow: ${node.name}\nParameters: ${schemaStr}`;
11
+ return `Workflow: ${graph.name}\nParameters: ${schemaStr}`;
11
12
  })
12
13
  .join("\n\n");
13
14
  };
package/.env.example DELETED
@@ -1,2 +0,0 @@
1
- OPENAI_API_KEY=
2
- REDIS_URL=
@@ -1,75 +0,0 @@
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.GraphController = 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 GraphController {
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, inputContexts) {
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], inputContexts === null || inputContexts === void 0 ? void 0 : inputContexts[i]);
31
- results.set(`${graphs[i].name}-${i}`, result);
32
- }
33
- return results;
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, inputContexts, inputs, concurrencyLimit) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- const results = new Map();
49
- if (inputContexts) {
50
- inputContexts = inputContexts.map((ctx) => ctx || {});
51
- }
52
- if (inputs) {
53
- inputs = inputs.map((input) => input || {});
54
- }
55
- if (concurrencyLimit) {
56
- for (let i = 0; i < graphs.length; i += concurrencyLimit) {
57
- const batchResults = yield Promise.all(graphs
58
- .slice(i, i + concurrencyLimit)
59
- .map((graph, index) => graph.execute(startNodes[i + index], (inputContexts === null || inputContexts === void 0 ? void 0 : inputContexts[i + index]) || {}, inputs === null || inputs === void 0 ? void 0 : inputs[i + index])));
60
- batchResults.forEach((result, index) => {
61
- results.set(`${graphs[i + index].name}`, result);
62
- });
63
- }
64
- }
65
- else {
66
- const allResults = yield Promise.all(graphs.map((graph, index) => graph.execute(startNodes[index], (inputContexts === null || inputContexts === void 0 ? void 0 : inputContexts[index]) || {}, (inputs === null || inputs === void 0 ? void 0 : inputs[index]) || {})));
67
- allResults.forEach((result, index) => {
68
- results.set(`${graphs[index].name}`, result);
69
- });
70
- }
71
- return results;
72
- });
73
- }
74
- }
75
- exports.GraphController = GraphController;
@@ -1,402 +0,0 @@
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.GraphFlow = void 0;
13
- const events_1 = require("events");
14
- /**
15
- * @module GraphFlow
16
- * @description A flexible workflow engine that manages the execution of nodes in a graph-like structure.
17
- *
18
- * Key features:
19
- * - Multiple branches support
20
- * - Conditional branching (runs first matching condition, or all if none have conditions)
21
- * - Event-driven nodes
22
- * - Zod validation of context/inputs/outputs
23
- * - Automatic retry on node failures
24
- *
25
- * @template T - Extends ZodSchema for type validation
26
- */
27
- class GraphFlow {
28
- /**
29
- * Creates a new instance of GraphFlow
30
- * @param {string} name - The name of the graph flow
31
- * @param {GraphDefinition<T>} config - Configuration object containing nodes, schema, context, and error handlers
32
- */
33
- constructor(name, config) {
34
- this.name = name;
35
- this.nodes = new Map(config.nodes.map((node) => [node.name, node]));
36
- this.validator = config.schema;
37
- this.context = config.schema.parse(config.context);
38
- this.globalErrorHandler = config.onError;
39
- this.eventEmitter = config.eventEmitter || new events_1.EventEmitter();
40
- this.graphEvents = config.events;
41
- this.setupEventListeners();
42
- this.setupGraphEventListeners();
43
- }
44
- /**
45
- * Creates a new context for execution
46
- * @private
47
- * @returns {GraphContext<T>} A cloned context to prevent pollution during parallel execution
48
- */
49
- createNewContext() {
50
- return structuredClone(this.context);
51
- }
52
- /**
53
- * Sets up event listeners for node-based events
54
- * @private
55
- * @description Attaches all node-based event triggers while preserving external listeners
56
- */
57
- setupEventListeners() {
58
- // First remove only the existing node-based listeners that we might have created previously
59
- // We do NOT remove, for example, "nodeStarted" or "nodeCompleted" listeners that test code added.
60
- for (const [eventName, listener] of this.eventEmitter
61
- .rawListeners("*")
62
- .entries()) {
63
- // This can be tricky—EventEmitter doesn't directly let you remove by "type" of listener.
64
- // Alternatively, we can store references in a separate structure.
65
- // For simplicity, let's do a full removeAllListeners() on node-specified events (only),
66
- // then re-add them below, but keep the test-based events like "nodeStarted" or "nodeCompleted".
67
- }
68
- // The simplest approach: removeAllListeners for each event that is declared as a node event
69
- // so we don't stack up duplicates:
70
- const allEvents = new Set();
71
- for (const node of this.nodes.values()) {
72
- if (node.events) {
73
- node.events.forEach((evt) => allEvents.add(evt));
74
- }
75
- }
76
- for (const evt of allEvents) {
77
- // remove only those events that are used by nodes
78
- this.eventEmitter.removeAllListeners(evt);
79
- }
80
- // Now re-add the node-based event triggers
81
- for (const node of this.nodes.values()) {
82
- if (node.events && node.events.length > 0) {
83
- node.events.forEach((event) => {
84
- this.eventEmitter.on(event, (data) => __awaiter(this, void 0, void 0, function* () {
85
- const freshContext = this.createNewContext();
86
- if (data)
87
- Object.assign(freshContext, data);
88
- // If triggered by an event, we pass "true" so event-driven node will skip `next`.
89
- yield this.executeNode(node.name, freshContext, undefined,
90
- /* triggeredByEvent= */ true);
91
- }));
92
- });
93
- }
94
- }
95
- }
96
- /**
97
- * Executes a specific node in the graph
98
- * @private
99
- * @param {string} nodeName - Name of the node to execute
100
- * @param {GraphContext<T>} context - Current execution context
101
- * @param {any} inputs - Input parameters for the node
102
- * @param {boolean} triggeredByEvent - Whether the execution was triggered by an event
103
- * @returns {Promise<void>}
104
- */
105
- executeNode(nodeName_1, context_1, inputs_1) {
106
- return __awaiter(this, arguments, void 0, function* (nodeName, context, inputs, triggeredByEvent = false) {
107
- var _a, _b, _c, _d;
108
- const node = this.nodes.get(nodeName);
109
- if (!node)
110
- throw new Error(`❌ Node "${nodeName}" not found.`);
111
- if (node.condition && !node.condition(context)) {
112
- return;
113
- }
114
- let attempts = 0;
115
- const maxAttempts = ((_a = node.retry) === null || _a === void 0 ? void 0 : _a.maxAttempts) || 1;
116
- const delay = ((_b = node.retry) === null || _b === void 0 ? void 0 : _b.delay) || 0;
117
- while (attempts < maxAttempts) {
118
- try {
119
- let validatedInputs;
120
- if (node.inputs) {
121
- if (!inputs) {
122
- throw new Error(`❌ Inputs required for node "${nodeName}" but received: ${inputs}`);
123
- }
124
- validatedInputs = node.inputs.parse(inputs);
125
- }
126
- this.eventEmitter.emit("nodeStarted", { name: nodeName, context });
127
- // Execute the node
128
- yield node.execute(context, validatedInputs);
129
- if (node.outputs) {
130
- node.outputs.parse(context);
131
- }
132
- this.validateContext(context);
133
- this.eventEmitter.emit("nodeCompleted", { name: nodeName, context });
134
- // IMPORTANT: Si le nœud est déclenché par un événement et a des événements définis,
135
- // on arrête ici et on ne suit pas la chaîne next
136
- if (triggeredByEvent && node.events && node.events.length > 0) {
137
- this.context = structuredClone(context);
138
- return;
139
- }
140
- // Gérer les nœuds suivants
141
- if (node.next && node.next.length > 0) {
142
- const branchContexts = [];
143
- // Exécuter toutes les branches valides
144
- for (const nextNodeName of node.next) {
145
- const nextNode = this.nodes.get(nextNodeName);
146
- if (!nextNode)
147
- continue;
148
- const branchContext = structuredClone(context);
149
- // Si le nœud a une condition et qu'elle n'est pas remplie, passer au suivant
150
- if (nextNode.condition && !nextNode.condition(branchContext)) {
151
- continue;
152
- }
153
- yield this.executeNode(nextNodeName, branchContext);
154
- branchContexts.push(branchContext);
155
- }
156
- // Fusionner les résultats des branches dans l'ordre
157
- if (branchContexts.length > 0) {
158
- const finalContext = branchContexts[branchContexts.length - 1];
159
- Object.assign(context, finalContext);
160
- }
161
- }
162
- // Mettre à jour le contexte global
163
- this.context = structuredClone(context);
164
- return;
165
- }
166
- catch (error) {
167
- attempts++;
168
- if (attempts >= maxAttempts) {
169
- this.eventEmitter.emit("nodeError", { nodeName, error });
170
- (_c = node.onError) === null || _c === void 0 ? void 0 : _c.call(node, error);
171
- (_d = this.globalErrorHandler) === null || _d === void 0 ? void 0 : _d.call(this, error, context);
172
- throw error;
173
- }
174
- console.warn(`[Graph ${this.name}] Retry attempt ${attempts} for node ${nodeName}`, { error });
175
- yield new Promise((resolve) => setTimeout(resolve, delay));
176
- }
177
- }
178
- });
179
- }
180
- /**
181
- * Validates the current context against the schema
182
- * @private
183
- * @param {GraphContext<T>} context - Context to validate
184
- * @throws {Error} If validation fails
185
- */
186
- validateContext(context) {
187
- if (this.validator) {
188
- this.validator.parse(context);
189
- }
190
- }
191
- /**
192
- * Executes the graph flow starting from a specific node
193
- * @param {string} startNode - Name of the node to start execution from
194
- * @param {Partial<GraphContext<T>>} inputContext - Optional partial context to merge with current context
195
- * @param {any} inputParams - Optional input parameters for the start node
196
- * @returns {Promise<GraphContext<T>>} Final context after execution
197
- */
198
- execute(startNode, inputContext, inputParams) {
199
- return __awaiter(this, void 0, void 0, function* () {
200
- var _a;
201
- // Fresh local context from the global
202
- const context = this.createNewContext();
203
- if (inputContext)
204
- Object.assign(context, inputContext);
205
- // Emit "graphStarted"
206
- this.eventEmitter.emit("graphStarted", { name: this.name });
207
- try {
208
- // Because we're calling explicitly, it's NOT triggered by an event
209
- yield this.executeNode(startNode, context, inputParams,
210
- /* triggeredByEvent= */ false);
211
- // Emit "graphCompleted"
212
- this.eventEmitter.emit("graphCompleted", {
213
- name: this.name,
214
- context: this.context,
215
- });
216
- // Return a snapshot of the final global context
217
- return structuredClone(this.context);
218
- }
219
- catch (error) {
220
- // Emit "graphError"
221
- this.eventEmitter.emit("graphError", { name: this.name, error });
222
- (_a = this.globalErrorHandler) === null || _a === void 0 ? void 0 : _a.call(this, error, context);
223
- throw error;
224
- }
225
- });
226
- }
227
- /**
228
- * Emits an event to trigger event-based nodes
229
- * @param {string} eventName - Name of the event to emit
230
- * @param {Partial<GraphContext<T>>} data - Optional data to merge with context
231
- * @returns {Promise<GraphContext<T>>} Updated context after event handling
232
- */
233
- emit(eventName, data) {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- // Merge data into a fresh copy of the global context if desired
236
- const context = this.createNewContext();
237
- if (data)
238
- Object.assign(context, data);
239
- // Just emit the event; the node-based event listeners in setupEventListeners()
240
- // will handle calling "executeNode(...)"
241
- this.eventEmitter.emit(eventName, context);
242
- // Return the updated global context
243
- return this.getContext();
244
- });
245
- }
246
- /**
247
- * Registers an event handler
248
- * @param {string} eventName - Name of the event to listen for
249
- * @param {Function} handler - Handler function to execute when event is emitted
250
- */
251
- on(eventName, handler) {
252
- this.eventEmitter.on(eventName, handler);
253
- }
254
- /**
255
- * Updates the graph definition with new configuration
256
- * @param {GraphDefinition<T>} definition - New graph definition
257
- */
258
- load(definition) {
259
- var _a;
260
- // Clear all existing nodes
261
- this.nodes.clear();
262
- // Wipe out old node-based event listeners
263
- // (We keep external test listeners like "nodeStarted" or "nodeCompleted".)
264
- if ((_a = definition.nodes) === null || _a === void 0 ? void 0 : _a.length) {
265
- const allEvents = new Set();
266
- definition.nodes.forEach((n) => { var _a; return (_a = n.events) === null || _a === void 0 ? void 0 : _a.forEach((evt) => allEvents.add(evt)); });
267
- for (const evt of allEvents) {
268
- this.eventEmitter.removeAllListeners(evt);
269
- }
270
- }
271
- // Add in new nodes
272
- definition.nodes.forEach((node) => this.nodes.set(node.name, node));
273
- // Parse the new context
274
- this.context = definition.schema.parse(definition.context);
275
- this.validator = definition.schema;
276
- // Store entry node
277
- this.entryNode = definition.entryNode;
278
- // Store graph events
279
- this.graphEvents = definition.events;
280
- // Re-setup only node-based event triggers
281
- for (const node of this.nodes.values()) {
282
- if (node.events && node.events.length > 0) {
283
- node.events.forEach((event) => {
284
- this.eventEmitter.on(event, (data) => __awaiter(this, void 0, void 0, function* () {
285
- const freshContext = structuredClone(this.context);
286
- if (data)
287
- Object.assign(freshContext, data);
288
- yield this.executeNode(node.name, freshContext, undefined, true);
289
- }));
290
- });
291
- }
292
- }
293
- // Re-setup graph event listeners
294
- this.setupGraphEventListeners();
295
- }
296
- /**
297
- * Returns the current context
298
- * @returns {GraphContext<T>} Current graph context
299
- */
300
- getContext() {
301
- return structuredClone(this.context);
302
- }
303
- /**
304
- * Logs a message with optional data
305
- * @param {string} message - Message to log
306
- * @param {any} data - Optional data to log
307
- */
308
- log(message, data) {
309
- console.log(`[Graph ${this.name}] ${message}`, data);
310
- }
311
- /**
312
- * Adds a new node to the graph
313
- * @param {Node<T>} node - Node to add
314
- * @throws {Error} If node with same name already exists
315
- */
316
- addNode(node) {
317
- this.nodes.set(node.name, node);
318
- if (node.events && node.events.length > 0) {
319
- for (const evt of node.events) {
320
- this.eventEmitter.on(evt, (data) => __awaiter(this, void 0, void 0, function* () {
321
- const freshContext = this.createNewContext();
322
- if (data)
323
- Object.assign(freshContext, data);
324
- yield this.executeNode(node.name, freshContext, undefined, true);
325
- }));
326
- }
327
- }
328
- }
329
- /**
330
- * Removes a node from the graph
331
- * @param {string} nodeName - Name of the node to remove
332
- */
333
- removeNode(nodeName) {
334
- const node = this.nodes.get(nodeName);
335
- if (!node)
336
- return;
337
- // remove the node from the map
338
- this.nodes.delete(nodeName);
339
- // remove any of its event-based listeners
340
- if (node.events && node.events.length > 0) {
341
- for (const evt of node.events) {
342
- // removeAllListeners(evt) would also remove other node listeners,
343
- // so we need a more fine-grained approach. Ideally, we should keep a reference
344
- // to the exact listener function we attached. For brevity, let's remove all for that event:
345
- this.eventEmitter.removeAllListeners(evt);
346
- }
347
- // Then reattach the others that remain in the graph
348
- for (const n of this.nodes.values()) {
349
- if (n.events && n.events.length > 0) {
350
- n.events.forEach((e) => {
351
- this.eventEmitter.on(e, (data) => __awaiter(this, void 0, void 0, function* () {
352
- const freshContext = this.createNewContext();
353
- if (data)
354
- Object.assign(freshContext, data);
355
- yield this.executeNode(n.name, freshContext, undefined, true);
356
- }));
357
- });
358
- }
359
- }
360
- }
361
- }
362
- /**
363
- * Returns all nodes in the graph
364
- * @returns {Node<T>[]} Array of all nodes
365
- */
366
- getNodes() {
367
- return Array.from(this.nodes.values());
368
- }
369
- setupGraphEventListeners() {
370
- if (this.graphEvents && this.graphEvents.length > 0) {
371
- this.graphEvents.forEach((event) => {
372
- this.eventEmitter.on(event, (data) => __awaiter(this, void 0, void 0, function* () {
373
- var _a;
374
- const freshContext = this.createNewContext();
375
- if (data)
376
- Object.assign(freshContext, data);
377
- // Emit "graphStarted"
378
- this.eventEmitter.emit("graphStarted", { name: this.name });
379
- try {
380
- // Execute the graph starting from the entry node
381
- if (!this.entryNode) {
382
- throw new Error("No entry node defined for graph event handling");
383
- }
384
- yield this.executeNode(this.entryNode, freshContext, undefined, false);
385
- // Emit "graphCompleted"
386
- this.eventEmitter.emit("graphCompleted", {
387
- name: this.name,
388
- context: this.context,
389
- });
390
- }
391
- catch (error) {
392
- // Emit "graphError"
393
- this.eventEmitter.emit("graphError", { name: this.name, error });
394
- (_a = this.globalErrorHandler) === null || _a === void 0 ? void 0 : _a.call(this, error, freshContext);
395
- throw error;
396
- }
397
- }));
398
- });
399
- }
400
- }
401
- }
402
- exports.GraphFlow = GraphFlow;
package/dist/index.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /**
3
- * @module @ai.ntellect/core
4
- * @description Core module with workflow functionality, providing graph management,
5
- * memory storage, agenda scheduling, and embedding capabilities.
6
- *
7
- * This module exports various components:
8
- * - Graph management and controller
9
- * - Memory storage adapters (Meilisearch, Redis)
10
- * - Agenda scheduling with node-cron adapter
11
- * - Embedding functionality with AI adapter
12
- * - Utility functions for action schema generation and header building
13
- */
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- __exportStar(require("./graph"), exports);
30
- __exportStar(require("./graph/controller"), exports);
31
- __exportStar(require("./modules/memory"), exports);
32
- __exportStar(require("./modules/memory/adapters/meilisearch"), exports);
33
- __exportStar(require("./modules/memory/adapters/redis"), exports);
34
- __exportStar(require("./interfaces"), exports);
35
- __exportStar(require("./modules/agenda"), exports);
36
- __exportStar(require("./modules/agenda/adapters/node-cron"), exports);
37
- __exportStar(require("./modules/embedding"), exports);
38
- __exportStar(require("./modules/embedding/adapters/ai"), exports);
39
- __exportStar(require("./types"), exports);
40
- __exportStar(require("./utils/generate-action-schema"), exports);
41
- __exportStar(require("./utils/header-builder"), exports);
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseMemory = void 0;
4
- /**
5
- * Abstract base class for memory implementations
6
- * @abstract
7
- */
8
- class BaseMemory {
9
- /**
10
- * Creates an instance of BaseMemory
11
- * @param {IMemoryAdapter} adapter - Memory adapter implementation
12
- */
13
- constructor(adapter) {
14
- this.adapter = adapter;
15
- }
16
- }
17
- exports.BaseMemory = BaseMemory;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.NodeCronAdapter = void 0;
7
- const node_cron_1 = __importDefault(require("node-cron"));
8
- /**
9
- * @module NodeCronAdapter
10
- * @description Adapter implementation for node-cron service.
11
- * Provides a bridge between the application's scheduling interface and the node-cron library.
12
- * @implements {ICronService}
13
- */
14
- class NodeCronAdapter {
15
- /**
16
- * Schedules a new cron job
17
- * @param {string} expression - Cron expression defining the schedule
18
- * @param {Function} callback - Function to be executed when the schedule triggers
19
- * @returns {ICronJob} Interface for controlling the scheduled job
20
- */
21
- schedule(expression, callback) {
22
- const job = node_cron_1.default.schedule(expression, callback);
23
- return {
24
- start: () => job.start(),
25
- stop: () => job.stop(),
26
- };
27
- }
28
- }
29
- exports.NodeCronAdapter = NodeCronAdapter;