@ai.ntellect/core 0.7.7 → 1.0.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 (111) hide show
  1. package/README.md +158 -81
  2. package/index.ts +462 -22
  3. package/package copy.json +21 -0
  4. package/package.json +9 -44
  5. package/tsconfig.json +108 -22
  6. package/types.ts +62 -0
  7. package/utils/executor.ts +42 -0
  8. package/.mocharc.json +0 -5
  9. package/dist/graph/controller.d.ts +0 -31
  10. package/dist/graph/controller.d.ts.map +0 -1
  11. package/dist/graph/controller.js +0 -71
  12. package/dist/graph/controller.js.map +0 -1
  13. package/dist/graph/event-manager.d.ts +0 -92
  14. package/dist/graph/event-manager.d.ts.map +0 -1
  15. package/dist/graph/event-manager.js +0 -244
  16. package/dist/graph/event-manager.js.map +0 -1
  17. package/dist/graph/index.d.ts +0 -159
  18. package/dist/graph/index.d.ts.map +0 -1
  19. package/dist/graph/index.js +0 -303
  20. package/dist/graph/index.js.map +0 -1
  21. package/dist/graph/logger.d.ts +0 -46
  22. package/dist/graph/logger.d.ts.map +0 -1
  23. package/dist/graph/logger.js +0 -69
  24. package/dist/graph/logger.js.map +0 -1
  25. package/dist/graph/node.d.ts +0 -92
  26. package/dist/graph/node.d.ts.map +0 -1
  27. package/dist/graph/node.js +0 -249
  28. package/dist/graph/node.js.map +0 -1
  29. package/dist/graph/observer.d.ts +0 -113
  30. package/dist/graph/observer.d.ts.map +0 -1
  31. package/dist/graph/observer.js +0 -198
  32. package/dist/graph/observer.js.map +0 -1
  33. package/dist/index.d.ts +0 -26
  34. package/dist/index.d.ts.map +0 -1
  35. package/dist/index.js +0 -42
  36. package/dist/index.js.map +0 -1
  37. package/dist/interfaces/index.d.ts +0 -447
  38. package/dist/interfaces/index.d.ts.map +0 -1
  39. package/dist/interfaces/index.js +0 -75
  40. package/dist/interfaces/index.js.map +0 -1
  41. package/dist/modules/agenda/adapters/node-cron/index.d.ts +0 -17
  42. package/dist/modules/agenda/adapters/node-cron/index.d.ts.map +0 -1
  43. package/dist/modules/agenda/adapters/node-cron/index.js +0 -30
  44. package/dist/modules/agenda/adapters/node-cron/index.js.map +0 -1
  45. package/dist/modules/agenda/index.d.ts +0 -63
  46. package/dist/modules/agenda/index.d.ts.map +0 -1
  47. package/dist/modules/agenda/index.js +0 -141
  48. package/dist/modules/agenda/index.js.map +0 -1
  49. package/dist/modules/embedding/adapters/ai/index.d.ts +0 -29
  50. package/dist/modules/embedding/adapters/ai/index.d.ts.map +0 -1
  51. package/dist/modules/embedding/adapters/ai/index.js +0 -58
  52. package/dist/modules/embedding/adapters/ai/index.js.map +0 -1
  53. package/dist/modules/embedding/index.d.ts +0 -36
  54. package/dist/modules/embedding/index.d.ts.map +0 -1
  55. package/dist/modules/embedding/index.js +0 -60
  56. package/dist/modules/embedding/index.js.map +0 -1
  57. package/dist/modules/memory/adapters/in-memory/index.d.ts +0 -120
  58. package/dist/modules/memory/adapters/in-memory/index.d.ts.map +0 -1
  59. package/dist/modules/memory/adapters/in-memory/index.js +0 -211
  60. package/dist/modules/memory/adapters/in-memory/index.js.map +0 -1
  61. package/dist/modules/memory/adapters/meilisearch/index.d.ts +0 -110
  62. package/dist/modules/memory/adapters/meilisearch/index.d.ts.map +0 -1
  63. package/dist/modules/memory/adapters/meilisearch/index.js +0 -321
  64. package/dist/modules/memory/adapters/meilisearch/index.js.map +0 -1
  65. package/dist/modules/memory/adapters/redis/index.d.ts +0 -82
  66. package/dist/modules/memory/adapters/redis/index.d.ts.map +0 -1
  67. package/dist/modules/memory/adapters/redis/index.js +0 -159
  68. package/dist/modules/memory/adapters/redis/index.js.map +0 -1
  69. package/dist/modules/memory/index.d.ts +0 -67
  70. package/dist/modules/memory/index.d.ts.map +0 -1
  71. package/dist/modules/memory/index.js +0 -104
  72. package/dist/modules/memory/index.js.map +0 -1
  73. package/dist/types/index.d.ts +0 -166
  74. package/dist/types/index.d.ts.map +0 -1
  75. package/dist/types/index.js +0 -3
  76. package/dist/types/index.js.map +0 -1
  77. package/dist/utils/generate-action-schema.d.ts +0 -5
  78. package/dist/utils/generate-action-schema.d.ts.map +0 -1
  79. package/dist/utils/generate-action-schema.js +0 -44
  80. package/dist/utils/generate-action-schema.js.map +0 -1
  81. package/dist/utils/header-builder.d.ts +0 -12
  82. package/dist/utils/header-builder.d.ts.map +0 -1
  83. package/dist/utils/header-builder.js +0 -35
  84. package/dist/utils/header-builder.js.map +0 -1
  85. package/graph/controller.ts +0 -74
  86. package/graph/event-manager.ts +0 -295
  87. package/graph/index.ts +0 -397
  88. package/graph/logger.ts +0 -70
  89. package/graph/node.ts +0 -305
  90. package/graph/observer.ts +0 -368
  91. package/interfaces/index.ts +0 -545
  92. package/modules/agenda/adapters/node-cron/index.ts +0 -25
  93. package/modules/agenda/index.ts +0 -146
  94. package/modules/embedding/adapters/ai/index.ts +0 -42
  95. package/modules/embedding/index.ts +0 -45
  96. package/modules/memory/adapters/in-memory/index.ts +0 -207
  97. package/modules/memory/adapters/meilisearch/index.ts +0 -361
  98. package/modules/memory/adapters/redis/index.ts +0 -164
  99. package/modules/memory/index.ts +0 -93
  100. package/test/graph/controller.test.ts +0 -187
  101. package/test/graph/event-manager.test.ts +0 -72
  102. package/test/graph/index.test.ts +0 -768
  103. package/test/graph/node.test.ts +0 -510
  104. package/test/graph/observer.test.ts +0 -398
  105. package/test/modules/agenda/node-cron.test.ts +0 -307
  106. package/test/modules/memory/adapters/in-memory.test.ts +0 -153
  107. package/test/modules/memory/adapters/meilisearch.test.ts +0 -287
  108. package/test/modules/memory/base.test.ts +0 -230
  109. package/types/index.ts +0 -184
  110. package/utils/generate-action-schema.ts +0 -46
  111. package/utils/header-builder.ts +0 -40
package/index.ts CHANGED
@@ -1,29 +1,469 @@
1
+ import EventEmitter from "events";
2
+ import {
3
+ Node,
4
+ Persistence,
5
+ RealTimeNotifier,
6
+ SharedState,
7
+ WorkflowDefinition,
8
+ mergeState,
9
+ } from "./types";
10
+
1
11
  /**
2
- * @module @ai.ntellect/core
3
- * @description Core module with workflow functionality, providing graph management,
4
- * memory storage, agenda scheduling, and embedding capabilities.
12
+ * Represents a directed worflow structure capable of executing nodes in sequence or parallel.
13
+ * The worflow can handle state management, event emissions, and conditional execution paths.
5
14
  *
6
- * This module exports various components:
7
- * - Graph management and controller
8
- * - Memory storage adapters (Meilisearch, Redis)
9
- * - Agenda scheduling with node-cron adapter
10
- * - Embedding functionality with AI adapter
11
- * - Utility functions for action schema generation and header building
15
+ * @template T - The type of data stored in the worflow's context
12
16
  */
17
+ export class Workflow<T> {
18
+ /** Stores global context data accessible to all nodes */
19
+ public globalContext: Map<string, any>;
20
+
21
+ /** Event emitter for handling worflow-wide events */
22
+ private eventEmitter: EventEmitter;
23
+
24
+ /** Map of all nodes in the worflow */
25
+ public nodes: Map<string, Node<T>>;
26
+
27
+ /** Set of nodes that have been executed */
28
+ public executedNodes: Set<string>;
29
+
30
+ /** Name identifier for the worflow */
31
+ public name: string;
32
+
33
+ /** Optional persistence layer for saving worflow state */
34
+ private persistence: Persistence<T> | null;
35
+
36
+ /** Optional notifier for real-time updates */
37
+ private notifier: RealTimeNotifier | null;
38
+
39
+ /**
40
+ * Creates a new Workflow instance.
41
+ *
42
+ * @param {WorkflowDefinition<T>} [definition] - Initial worflow structure and configuration
43
+ * @param {Object} [config] - Additional configuration options
44
+ * @param {boolean} [config.autoDetectCycles] - Whether to check for cycles during initialization
45
+ * @throws {Error} If cycles are detected when autoDetectCycles is true
46
+ */
47
+ constructor(
48
+ definition?: WorkflowDefinition<T>,
49
+ config?: { autoDetectCycles?: boolean }
50
+ ) {
51
+ this.name = definition?.name || "anonymous";
52
+ this.eventEmitter = new EventEmitter();
53
+ this.globalContext = new Map();
54
+ this.nodes = new Map();
55
+ this.executedNodes = new Set();
56
+ this.persistence = null;
57
+ this.notifier = null;
58
+
59
+ if (definition) {
60
+ this.loadFromDefinition(definition);
61
+ }
62
+
63
+ if (config?.autoDetectCycles && this.checkForCycles()) {
64
+ throw new Error("Cycle detected in the worflow");
65
+ }
66
+ }
67
+ /**
68
+ * Loads a worflow structure from a definition object.
69
+ * @private
70
+ * @param {WorkflowDefinition<T>} definition - The worflow definition
71
+ */
72
+ private loadFromDefinition(definition: WorkflowDefinition<T>): void {
73
+ Object.entries(definition.nodes).forEach(([_, nodeConfig]) => {
74
+ this.addNode(nodeConfig, {
75
+ condition: nodeConfig.condition,
76
+ next: nodeConfig.next,
77
+ });
78
+ });
79
+ }
80
+
81
+ /**
82
+ * Recursively checks if a node is part of a cycle.
83
+ * @private
84
+ * @param {string} nodeName - The name of the node to check
85
+ * @param {Set<string>} visited - Set of visited nodes
86
+ * @param {Set<string>} recStack - Set of nodes in the current recursion stack
87
+ * @returns {boolean} True if a cycle is detected, false otherwise
88
+ */
89
+ private isCyclic(
90
+ nodeName: string,
91
+ visited: Set<string>,
92
+ recStack: Set<string>
93
+ ): boolean {
94
+ if (!visited.has(nodeName)) {
95
+ visited.add(nodeName);
96
+ recStack.add(nodeName);
97
+
98
+ const currentNode = this.nodes.get(nodeName);
99
+ if (currentNode?.next) {
100
+ for (const nextNode of currentNode.next) {
101
+ if (
102
+ !visited.has(nextNode) &&
103
+ this.isCyclic(nextNode, visited, recStack)
104
+ ) {
105
+ return true;
106
+ } else if (recStack.has(nextNode)) {
107
+ return true;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ recStack.delete(nodeName);
113
+ return false;
114
+ }
115
+
116
+ /**
117
+ * Checks if the worflow contains any cycles.
118
+ * @returns {boolean} True if cycles are detected, false otherwise
119
+ */
120
+ checkForCycles(): boolean {
121
+ const visited = new Set<string>();
122
+ const recStack = new Set<string>();
123
+
124
+ for (const nodeName of this.nodes.keys()) {
125
+ if (this.isCyclic(nodeName, visited, recStack)) {
126
+ return true;
127
+ }
128
+ }
129
+ return false;
130
+ }
131
+
132
+ /**
133
+ * Adds a new node to the worflow.
134
+ * @param {Node<T>} node - The node to add
135
+ * @param {Object} options - Node configuration options
136
+ * @param {Function} [options.condition] - Condition function for node execution
137
+ * @param {string[]} [options.next] - Array of next node names
138
+ * @param {string[]} [options.events] - Array of event names to listen for
139
+ */
140
+ addNode(
141
+ node: Node<T>,
142
+ {
143
+ condition,
144
+ next,
145
+ events,
146
+ }: {
147
+ condition?: (state: SharedState<T>) => boolean;
148
+ next?: string[];
149
+ events?: string[];
150
+ }
151
+ ): void {
152
+ node.next = next;
153
+ node.condition = condition;
154
+
155
+ if (events) {
156
+ events.forEach((event) => {
157
+ this.eventEmitter.on(event, async (data) => {
158
+ console.log(`Event "${event}" received by node "${node.name}"`);
159
+ const state = data.state || {};
160
+ await this.execute(state, node.name);
161
+ });
162
+ });
163
+ }
164
+
165
+ this.nodes.set(node.name, node);
166
+ }
167
+
168
+ /**
169
+ * Emits an event to the worflow's event emitter.
170
+ * @param {string} eventName - Name of the event to emit
171
+ * @param {any} data - Data to pass with the event
172
+ */
173
+ emit(eventName: string, data: any): void {
174
+ console.log(`Event "${eventName}" emitted with data:`, data);
175
+ this.eventEmitter.emit(eventName, data);
176
+ }
177
+
178
+ /**
179
+ * Adds a subworflow as a node in the current worflow.
180
+ * @param {Workflow<T>} subWorkflow - The subworflow to add
181
+ * @param {string} entryNode - The entry node name in the subworflow
182
+ * @param {string} name - The name for the subworflow node
183
+ */
184
+ addSubWorkflow(
185
+ subWorkflow: Workflow<T>,
186
+ entryNode: string,
187
+ name: string
188
+ ): void {
189
+ const subWorkflowNode: Node<T> = {
190
+ name,
191
+ execute: async (state) => {
192
+ console.log(`Executing subworflow: ${name}`);
193
+ await subWorkflow.execute(state, entryNode);
194
+ return state;
195
+ },
196
+ };
197
+ this.nodes.set(name, subWorkflowNode);
198
+ }
199
+
200
+ /**
201
+ * Updates the worflow structure with a new definition.
202
+ * @param {WorkflowDefinition<T>} definition - The new worflow definition
203
+ */
204
+ updateWorkflow(definition: WorkflowDefinition<T>): void {
205
+ Object.entries(definition.nodes).forEach(([_, nodeConfig]) => {
206
+ if (this.nodes.has(nodeConfig.name)) {
207
+ const existingNode = this.nodes.get(nodeConfig.name)!;
208
+ existingNode.next = nodeConfig.next || existingNode.next;
209
+ existingNode.condition = nodeConfig.condition || existingNode.condition;
210
+ } else {
211
+ this.addNode(nodeConfig, {
212
+ condition: nodeConfig.condition,
213
+ next: nodeConfig.next,
214
+ });
215
+ }
216
+ });
217
+ }
218
+
219
+ /**
220
+ * Replace the worflow with a new definition.
221
+ * @param {WorkflowDefinition<T>} definition - The new worflow definition
222
+ */
223
+ replaceWorkflow(definition: WorkflowDefinition<T>): void {
224
+ this.nodes.clear();
225
+ this.loadFromDefinition(definition);
226
+ }
227
+
228
+ /**
229
+ * Executes the worflow starting from a specific node.
230
+ * @param {SharedState<T>} state - The initial state
231
+ * @param {string} startNode - The name of the starting node
232
+ * @param {Function} [onStream] - Callback for streaming state updates
233
+ * @param {Function} [onError] - Callback for handling errors
234
+ */
235
+ async execute(
236
+ state: SharedState<T>,
237
+ startNode: string,
238
+ onStream?: (state: SharedState<T>) => void,
239
+ onError?: (error: Error, nodeName: string, state: SharedState<T>) => void
240
+ ): Promise<void> {
241
+ let currentNodeName = startNode;
242
+
243
+ while (currentNodeName) {
244
+ this.executedNodes.add(currentNodeName);
245
+
246
+ const currentNode = this.nodes.get(currentNodeName);
247
+ if (!currentNode) throw new Error(`Node ${currentNodeName} not found.`);
248
+
249
+ if (currentNode.condition && !currentNode.condition(state)) {
250
+ console.log(
251
+ `Condition for node "${currentNodeName}" not met. Ending Workflow.`
252
+ );
253
+ break;
254
+ }
255
+
256
+ try {
257
+ if (this.notifier) {
258
+ this.notifier.notify("nodeExecutionStarted", {
259
+ worflow: this.name,
260
+ node: currentNodeName,
261
+ });
262
+ }
263
+
264
+ console.log(`Executing node: ${currentNodeName}`);
265
+ const newState = await currentNode.execute(state);
266
+ Object.assign(state, mergeState(state, newState));
267
+
268
+ if (onStream) onStream(state);
269
+
270
+ if (this.persistence) {
271
+ await this.persistence.saveState(this.name, state, currentNodeName);
272
+ }
273
+
274
+ if (this.notifier) {
275
+ await this.notifier.notify("nodeExecutionCompleted", {
276
+ worflow: this.name,
277
+ node: currentNodeName,
278
+ state,
279
+ });
280
+ }
281
+ } catch (error) {
282
+ console.error(`Error in node ${currentNodeName}:`, error);
283
+ if (onError) onError(error as Error, currentNodeName, state);
284
+ if (this.notifier) {
285
+ this.notifier.notify("nodeExecutionFailed", {
286
+ worflow: this.name,
287
+ node: currentNodeName,
288
+ state,
289
+ error,
290
+ });
291
+ }
292
+ break;
293
+ }
294
+
295
+ const nextNodes = currentNode.next || [];
296
+ if (nextNodes.length > 1) {
297
+ await Promise.all(
298
+ nextNodes.map((nextNode) =>
299
+ this.execute(state, nextNode, onStream, onError)
300
+ )
301
+ );
302
+ break;
303
+ } else {
304
+ currentNodeName = nextNodes[0] || "";
305
+ }
306
+ }
307
+
308
+ console.log(`Workflow completed for node: ${startNode}`);
309
+ }
310
+
311
+ /**
312
+ * Executes multiple nodes in parallel with a concurrency limit.
313
+ * @param {SharedState<T>} state - The shared state
314
+ * @param {string[]} nodeNames - Array of node names to execute
315
+ * @param {number} [concurrencyLimit=5] - Maximum number of concurrent executions
316
+ * @param {Function} [onStream] - Callback for streaming state updates
317
+ * @param {Function} [onError] - Callback for handling errors
318
+ */
319
+ async executeParallel(
320
+ state: SharedState<T>,
321
+ nodeNames: string[],
322
+ concurrencyLimit: number = 5,
323
+ onStream?: (state: SharedState<T>) => void,
324
+ onError?: (error: Error, nodeName: string, state: SharedState<T>) => void
325
+ ): Promise<void> {
326
+ console.log(`Executing nodes in parallel: ${nodeNames.join(", ")}`);
327
+
328
+ const executeWithLimit = async (nodeName: string) => {
329
+ await this.execute(state, nodeName, onStream, onError);
330
+ };
331
+
332
+ const chunks = [];
333
+ for (let i = 0; i < nodeNames.length; i += concurrencyLimit) {
334
+ chunks.push(nodeNames.slice(i, i + concurrencyLimit));
335
+ }
336
+
337
+ for (const chunk of chunks) {
338
+ await Promise.all(chunk.map(executeWithLimit));
339
+ }
340
+ }
341
+
342
+ /**
343
+ * Adds a value to the global context.
344
+ * @param {string} key - The key to store the value under
345
+ * @param {any} value - The value to store
346
+ */
347
+ addToContext(key: string, value: any): void {
348
+ this.globalContext.set(key, value);
349
+ }
350
+
351
+ /**
352
+ * Retrieves a value from the global context.
353
+ * @param {string} key - The key to retrieve
354
+ * @returns {any} The stored value, or undefined if not found
355
+ */
356
+ getContext(key: string): any {
357
+ return this.globalContext.get(key);
358
+ }
359
+
360
+ /**
361
+ * Removes a value from the global context.
362
+ * @param {string} key - The key to remove
363
+ */
364
+ removeFromContext(key: string): void {
365
+ this.globalContext.delete(key);
366
+ }
367
+
368
+ /**
369
+ * Sets the persistence layer for the worflow.
370
+ * @param {Persistence<T>} persistence - The persistence implementation
371
+ */
372
+ setPersistence(persistence: Persistence<T>): void {
373
+ this.persistence = persistence;
374
+ }
375
+
376
+ /**
377
+ * Sets the real-time notifier for the worflow.
378
+ * @param {RealTimeNotifier} notifier - The notifier implementation
379
+ */
380
+ setNotifier(notifier: RealTimeNotifier): void {
381
+ this.notifier = notifier;
382
+ }
383
+
384
+ /**
385
+ * Generates a visual representation of the worflow using Mermaid diagram syntax.
386
+ * The diagram shows all nodes and their connections, with special highlighting for:
387
+ * - Entry nodes (green)
388
+ * - Event nodes (yellow)
389
+ * - Conditional nodes (orange)
390
+ *
391
+ * @param {string} [title] - Optional title for the diagram
392
+ * @returns {string} Mermaid diagram syntax representing the worflow
393
+ */
394
+ generateMermaidDiagram(title?: string): string {
395
+ const lines: string[] = ["worflow TD"];
396
+
397
+ if (title) {
398
+ lines.push(` subworflow ${title}`);
399
+ }
400
+
401
+ // Add nodes with styling
402
+ this.nodes.forEach((node, nodeName) => {
403
+ const hasEvents = node.events && node.events.length > 0;
404
+ const hasCondition = !!node.condition;
405
+
406
+ // Style nodes based on their properties
407
+ let style = "";
408
+ if (hasEvents) {
409
+ style = "style " + nodeName + " fill:#FFD700,stroke:#DAA520"; // Yellow for event nodes
410
+ } else if (hasCondition) {
411
+ style = "style " + nodeName + " fill:#FFA500,stroke:#FF8C00"; // Orange for conditional nodes
412
+ }
413
+
414
+ // Add node definition
415
+ lines.push(` ${nodeName}[${nodeName}]`);
416
+ if (style) {
417
+ lines.push(` ${style}`);
418
+ }
419
+ });
420
+
421
+ // Add connections
422
+ this.nodes.forEach((node, nodeName) => {
423
+ if (node.next) {
424
+ node.next.forEach((nextNode) => {
425
+ let connectionStyle = "";
426
+ if (node.condition) {
427
+ connectionStyle = "---|condition|"; // Add label for conditional connections
428
+ } else {
429
+ connectionStyle = "-->"; // Normal connection
430
+ }
431
+ lines.push(` ${nodeName} ${connectionStyle} ${nextNode}`);
432
+ });
433
+ }
13
434
 
14
- export * from "./graph/controller";
15
- export * from "./graph/index";
16
- export * from "./modules/memory";
17
- export * from "./modules/memory/adapters/meilisearch";
18
- export * from "./modules/memory/adapters/redis";
435
+ // Add event connections if any
436
+ if (node.events && node.events.length > 0) {
437
+ node.events.forEach((event) => {
438
+ const eventNodeId = `${event}_event`;
439
+ lines.push(` ${eventNodeId}((${event})):::event`);
440
+ lines.push(` ${eventNodeId} -.->|trigger| ${nodeName}`);
441
+ });
442
+ // Add style class for event nodes
443
+ lines.push(" classDef event fill:#FFD700,stroke:#DAA520");
444
+ }
445
+ });
19
446
 
20
- export * from "./interfaces";
21
- export * from "./modules/agenda";
22
- export * from "./modules/agenda/adapters/node-cron";
23
- export * from "./modules/embedding";
24
- export * from "./modules/embedding/adapters/ai";
447
+ if (title) {
448
+ lines.push(" end");
449
+ }
25
450
 
26
- export * from "./types";
451
+ return lines.join("\n");
452
+ }
27
453
 
28
- export * from "./utils/generate-action-schema";
29
- export * from "./utils/header-builder";
454
+ /**
455
+ * Renders the worflow visualization using Mermaid syntax.
456
+ * This method can be used to visualize the worflow structure in supported environments.
457
+ *
458
+ * @param {string} [title] - Optional title for the visualization
459
+ */
460
+ visualize(title?: string): void {
461
+ const diagram = this.generateMermaidDiagram(title);
462
+ console.log(
463
+ "To visualize this worflow, use a Mermaid-compatible renderer with this syntax:"
464
+ );
465
+ console.log("\n```mermaid");
466
+ console.log(diagram);
467
+ console.log("```\n");
468
+ }
469
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@ai.ntellect/workflow",
3
+ "version": "1.0.0",
4
+ "description": "A robust framework for managing and executing workflows, supporting dynamic decision-making, conditional paths, event-driven execution, and state persistence.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "rm -rf dist && tsc"
9
+ },
10
+ "keywords": [],
11
+ "author": "Lorcann Rauzduel",
12
+ "license": "ISC",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/ai-ntellect/workflow.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/ai-ntellect/workflow/issues"
19
+ },
20
+ "homepage": "https://github.com/ai-ntellect/workflow#readme"
21
+ }
package/package.json CHANGED
@@ -1,54 +1,19 @@
1
1
  {
2
2
  "name": "@ai.ntellect/core",
3
- "version": "0.7.7",
4
- "description": "",
5
- "main": "dist/index.js",
3
+ "version": "1.0.0",
4
+ "description": "A robust framework for managing and executing workflows, supporting dynamic decision-making, conditional paths, event-driven execution, and state persistence.",
5
+ "main": "index.js",
6
6
  "scripts": {
7
- "build": "rm -rf dist && tsc",
8
- "prepare": "npm run build",
9
- "prepublishOnly": "npm run build",
10
- "test": "mocha -r ./node_modules/ts-node/register",
11
- "test:all": "mocha -r ./node_modules/ts-node/register 'test/**/*.test.ts'",
12
- "test:coverage": "nyc --reporter=text --reporter=html pnpm test",
13
- "test:watch": "mocha --require ./node_modules/ts-node/register 'test/**/*.test.ts' --watch --watch-files ./**/*.ts,test/**/*.ts",
14
- "test:watch:graph": "mocha --require ./node_modules/ts-node/register 'test/graph/**/*.test.ts' --watch --watch-files ./graph/**/*.ts test/**/*.ts"
15
- },
16
- "keywords": [],
17
- "author": "Lorcann Rauzduel",
18
- "license": "ISC",
19
- "dependencies": {
20
- "@types/node-cron": "^3.0.11",
21
- "ai": "^3.0.0",
22
- "node-cron": "^3.0.3",
23
- "redis": "^4.7.0",
24
- "rxjs": "^7.8.1",
25
- "zod": "^3.24.1"
26
- },
27
- "devDependencies": {
28
- "@types/chai": "^4.3.20",
29
- "@types/chai-as-promised": "^8.0.1",
30
- "@types/mocha": "^10.0.10",
31
- "@types/node": "^20",
32
- "@types/sinon": "^17.0.3",
33
- "chai": "^4.5.0",
34
- "chai-as-promised": "^8.0.1",
35
- "mocha": "^10.0.0",
36
- "nyc": "^17.1.0",
37
- "redis": "^4.6.13",
38
- "sinon": "^19.0.2",
39
- "ts-node": "10.9.1",
40
- "typescript": "^5.7.2"
7
+ "test": "echo \"Error: no test specified\" && exit 1"
41
8
  },
42
9
  "repository": {
43
10
  "type": "git",
44
- "url": "git+https://github.com/ai-ntellect/core.git"
11
+ "url": "git+https://github.com/ai-ntellect/workflow.git"
45
12
  },
13
+ "author": "",
14
+ "license": "ISC",
46
15
  "bugs": {
47
- "url": "https://github.com/ai-ntellect/core/issues"
16
+ "url": "https://github.com/ai-ntellect/workflow/issues"
48
17
  },
49
- "homepage": "https://github.com/ai-ntellect/core#readme",
50
- "bin": {
51
- "wallet-assistant": "./dist/examples/index.js",
52
- "workflow": "./dist/cli.js"
53
- }
18
+ "homepage": "https://github.com/ai-ntellect/workflow#readme"
54
19
  }