@ai.ntellect/core 0.7.6 → 0.7.8
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/dist/graph/controller.d.ts +2 -3
- package/dist/graph/controller.d.ts.map +1 -1
- package/dist/graph/controller.js +5 -6
- package/dist/graph/controller.js.map +1 -1
- package/dist/graph/event-manager.d.ts +2 -1
- package/dist/graph/event-manager.d.ts.map +1 -1
- package/dist/graph/event-manager.js +55 -3
- package/dist/graph/event-manager.js.map +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +2 -2
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/node.d.ts +10 -39
- package/dist/graph/node.d.ts.map +1 -1
- package/dist/graph/node.js +41 -64
- package/dist/graph/node.js.map +1 -1
- package/dist/graph/observer.d.ts +13 -11
- package/dist/graph/observer.d.ts.map +1 -1
- package/dist/graph/observer.js.map +1 -1
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/index.js.map +1 -1
- package/dist/types/index.d.ts +13 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/generate-action-schema.js +2 -2
- package/graph/controller.ts +5 -10
- package/graph/event-manager.ts +74 -6
- package/graph/index.ts +4 -6
- package/graph/node.ts +53 -95
- package/graph/observer.ts +10 -10
- package/interfaces/index.ts +4 -1
- package/package.json +1 -1
- package/test/graph/event-manager.test.ts +46 -0
- package/test/graph/index.test.ts +119 -173
- package/test/graph/node.test.ts +323 -0
- package/types/index.ts +15 -9
- package/utils/generate-action-schema.ts +2 -2
package/types/index.ts
CHANGED
|
@@ -69,7 +69,9 @@ export type SchemaType<T> = T extends ZodSchema<infer U> ? U : never;
|
|
|
69
69
|
* Type for graph context based on schema
|
|
70
70
|
* @template T - Schema type
|
|
71
71
|
*/
|
|
72
|
-
export type GraphContext<T> =
|
|
72
|
+
export type GraphContext<T extends ZodSchema> = {
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
};
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
77
|
* Interface representing a node in the graph
|
|
@@ -78,17 +80,21 @@ export type GraphContext<T> = SchemaType<T>;
|
|
|
78
80
|
* @template I - Input schema type
|
|
79
81
|
* @template O - Output schema type
|
|
80
82
|
*/
|
|
81
|
-
export interface Node<T extends ZodSchema,
|
|
83
|
+
export interface Node<T extends ZodSchema, P = any> {
|
|
82
84
|
/** Name of the node */
|
|
83
85
|
name: string;
|
|
86
|
+
/** Description of the node */
|
|
87
|
+
description?: string;
|
|
84
88
|
/** Schema for node inputs */
|
|
85
|
-
|
|
86
|
-
/** Schema for node outputs */
|
|
87
|
-
outputs?: ZodSchema;
|
|
89
|
+
params?: P extends void ? never : ZodSchema<P>;
|
|
88
90
|
/** Execute function for the node */
|
|
89
|
-
execute: (
|
|
91
|
+
execute: (
|
|
92
|
+
context: GraphContext<T>,
|
|
93
|
+
params?: P,
|
|
94
|
+
tools?: { eventEmitter: IEventEmitter }
|
|
95
|
+
) => Promise<void>;
|
|
90
96
|
/** Optional condition for node execution */
|
|
91
|
-
condition?: (context: GraphContext<T>, params?:
|
|
97
|
+
condition?: (context: GraphContext<T>, params?: P) => boolean;
|
|
92
98
|
/** Array of next node names */
|
|
93
99
|
next?: string[] | ((context: GraphContext<T>) => string[]);
|
|
94
100
|
/** Array of event names that trigger this node */
|
|
@@ -100,8 +106,8 @@ export interface Node<T extends ZodSchema, I = any> {
|
|
|
100
106
|
/** Event correlation configuration */
|
|
101
107
|
correlateEvents?: {
|
|
102
108
|
events: string[];
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
timeout: number;
|
|
110
|
+
correlation: (events: any[]) => boolean;
|
|
105
111
|
};
|
|
106
112
|
/** Retry configuration */
|
|
107
113
|
retry?: {
|
|
@@ -5,8 +5,8 @@ export const generateActionSchema = (graphs: GraphFlow<any>[]) => {
|
|
|
5
5
|
return graphs
|
|
6
6
|
.map((graph) => {
|
|
7
7
|
const rootNode = Array.from(graph.nodes.values())[0];
|
|
8
|
-
const schemaStr = rootNode.
|
|
9
|
-
? getSchemaString(rootNode.
|
|
8
|
+
const schemaStr = rootNode.params
|
|
9
|
+
? getSchemaString(rootNode.params)
|
|
10
10
|
: "No parameters";
|
|
11
11
|
return `Workflow: ${graph.name}\nParameters: ${schemaStr}`;
|
|
12
12
|
})
|