@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/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> = SchemaType<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, I = any> {
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
- inputs?: I extends void ? never : ZodSchema<I>;
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: (context: GraphContext<T>, params?: I) => Promise<void>;
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?: I) => boolean;
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
- correlation: (events: GraphEvent<T>[]) => boolean;
104
- timeout?: number;
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.inputs
9
- ? getSchemaString(rootNode.inputs)
8
+ const schemaStr = rootNode.params
9
+ ? getSchemaString(rootNode.params)
10
10
  : "No parameters";
11
11
  return `Workflow: ${graph.name}\nParameters: ${schemaStr}`;
12
12
  })