@soulcraft/brainy 0.62.3 → 1.0.0-rc.1

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 (36) hide show
  1. package/README.md +3 -3
  2. package/bin/brainy.js +903 -1153
  3. package/dist/augmentationPipeline.d.ts +60 -0
  4. package/dist/augmentationPipeline.js +94 -0
  5. package/dist/augmentations/{cortexSense.d.ts → neuralImport.d.ts} +14 -11
  6. package/dist/augmentations/{cortexSense.js → neuralImport.js} +14 -11
  7. package/dist/brainyData.d.ts +199 -18
  8. package/dist/brainyData.js +601 -18
  9. package/dist/chat/BrainyChat.d.ts +113 -0
  10. package/dist/chat/BrainyChat.js +368 -0
  11. package/dist/chat/ChatCLI.d.ts +61 -0
  12. package/dist/chat/ChatCLI.js +351 -0
  13. package/dist/connectors/interfaces/IConnector.d.ts +3 -3
  14. package/dist/connectors/interfaces/IConnector.js +1 -1
  15. package/dist/cortex/neuralImport.js +1 -3
  16. package/dist/index.d.ts +4 -6
  17. package/dist/index.js +6 -7
  18. package/dist/pipeline.d.ts +15 -271
  19. package/dist/pipeline.js +25 -586
  20. package/dist/shared/default-augmentations.d.ts +3 -3
  21. package/dist/shared/default-augmentations.js +10 -10
  22. package/package.json +3 -1
  23. package/dist/chat/brainyChat.d.ts +0 -42
  24. package/dist/chat/brainyChat.js +0 -340
  25. package/dist/cortex/cliWrapper.d.ts +0 -32
  26. package/dist/cortex/cliWrapper.js +0 -209
  27. package/dist/cortex/cortex-legacy.d.ts +0 -264
  28. package/dist/cortex/cortex-legacy.js +0 -2463
  29. package/dist/cortex/cortex.d.ts +0 -264
  30. package/dist/cortex/cortex.js +0 -2463
  31. package/dist/cortex/serviceIntegration.d.ts +0 -156
  32. package/dist/cortex/serviceIntegration.js +0 -384
  33. package/dist/sequentialPipeline.d.ts +0 -113
  34. package/dist/sequentialPipeline.js +0 -417
  35. package/dist/utils/modelLoader.d.ts +0 -12
  36. package/dist/utils/modelLoader.js +0 -88
@@ -1,280 +1,24 @@
1
1
  /**
2
- * Unified Pipeline
2
+ * Pipeline - Clean Re-export of Cortex
3
3
  *
4
- * This module combines the functionality of the primary augmentation pipeline and the streamlined pipeline
5
- * into a single, unified pipeline system. It provides both the registry functionality of the primary pipeline
6
- * and the simplified execution API of the streamlined pipeline.
4
+ * After the Great Cleanup: Pipeline IS Cortex. No delegation, no complexity.
5
+ * ONE way to do everything.
7
6
  */
8
- import { IAugmentation, AugmentationType, AugmentationResponse, IWebSocketSupport, BrainyAugmentations } from './types/augmentations.js';
9
- import { IPipeline } from './types/pipelineTypes.js';
10
- /**
11
- * Execution mode for the pipeline
12
- */
13
- export declare enum ExecutionMode {
7
+ export { Cortex as Pipeline, cortex as pipeline, ExecutionMode, PipelineOptions } from './augmentationPipeline.js';
8
+ export { cortex as augmentationPipeline, Cortex } from './augmentationPipeline.js';
9
+ export declare const createPipeline: () => Promise<import("./augmentationPipeline.js").Cortex>;
10
+ export declare const createStreamingPipeline: () => Promise<import("./augmentationPipeline.js").Cortex>;
11
+ export type { PipelineOptions as StreamlinedPipelineOptions } from './augmentationPipeline.js';
12
+ export type PipelineResult<T> = {
13
+ success: boolean;
14
+ data: T;
15
+ error?: string;
16
+ };
17
+ export type StreamlinedPipelineResult<T> = PipelineResult<T>;
18
+ export declare enum StreamlinedExecutionMode {
14
19
  SEQUENTIAL = "sequential",
15
20
  PARALLEL = "parallel",
16
21
  FIRST_SUCCESS = "firstSuccess",
17
22
  FIRST_RESULT = "firstResult",
18
23
  THREADED = "threaded"
19
24
  }
20
- /**
21
- * Options for pipeline execution
22
- */
23
- export interface PipelineOptions {
24
- mode?: ExecutionMode;
25
- timeout?: number;
26
- stopOnError?: boolean;
27
- forceThreading?: boolean;
28
- disableThreading?: boolean;
29
- }
30
- /**
31
- * Result of a pipeline execution
32
- */
33
- export interface PipelineResult<T> {
34
- results: AugmentationResponse<T>[];
35
- errors: Error[];
36
- successful: AugmentationResponse<T>[];
37
- }
38
- /**
39
- * Pipeline class
40
- *
41
- * Manages multiple augmentations of each type and provides methods to execute them.
42
- * Implements the IPipeline interface to avoid circular dependencies.
43
- */
44
- export declare class Pipeline implements IPipeline {
45
- private registry;
46
- /**
47
- * Register an augmentation with the pipeline
48
- *
49
- * @param augmentation The augmentation to register
50
- * @returns The pipeline instance for chaining
51
- */
52
- register<T extends IAugmentation>(augmentation: T): Pipeline;
53
- /**
54
- * Unregister an augmentation from the pipeline
55
- *
56
- * @param augmentationName The name of the augmentation to unregister
57
- * @returns The pipeline instance for chaining
58
- */
59
- unregister(augmentationName: string): Pipeline;
60
- /**
61
- * Initialize all registered augmentations
62
- *
63
- * @returns A promise that resolves when all augmentations are initialized
64
- */
65
- initialize(): Promise<void>;
66
- /**
67
- * Shut down all registered augmentations
68
- *
69
- * @returns A promise that resolves when all augmentations are shut down
70
- */
71
- shutDown(): Promise<void>;
72
- /**
73
- * Get all registered augmentations
74
- *
75
- * @returns An array of all registered augmentations
76
- */
77
- getAllAugmentations(): IAugmentation[];
78
- /**
79
- * Get all augmentations of a specific type
80
- *
81
- * @param type The type of augmentation to get
82
- * @returns An array of all augmentations of the specified type
83
- */
84
- getAugmentationsByType(type: AugmentationType): IAugmentation[];
85
- /**
86
- * Get all available augmentation types
87
- *
88
- * @returns An array of all augmentation types that have at least one registered augmentation
89
- */
90
- getAvailableAugmentationTypes(): AugmentationType[];
91
- /**
92
- * Get all WebSocket-supporting augmentations
93
- *
94
- * @returns An array of all augmentations that support WebSocket connections
95
- */
96
- getWebSocketAugmentations(): IWebSocketSupport[];
97
- /**
98
- * Check if an augmentation is of a specific type
99
- *
100
- * @param augmentation The augmentation to check
101
- * @param methods The methods that should be present on the augmentation
102
- * @returns True if the augmentation is of the specified type
103
- */
104
- private isAugmentationType;
105
- /**
106
- * Determines if threading should be used based on options and environment
107
- *
108
- * @param options The pipeline options
109
- * @returns True if threading should be used, false otherwise
110
- */
111
- private shouldUseThreading;
112
- /**
113
- * Executes a method on multiple augmentations using the specified execution mode
114
- *
115
- * @param augmentations The augmentations to execute the method on
116
- * @param method The method to execute
117
- * @param args The arguments to pass to the method
118
- * @param options Options for the execution
119
- * @returns A promise that resolves with the results
120
- */
121
- execute<T>(augmentations: IAugmentation[], method: string, args?: any[], options?: PipelineOptions): Promise<PipelineResult<T>>;
122
- /**
123
- * Executes a method on augmentations of a specific type
124
- *
125
- * @param type The type of augmentations to execute the method on
126
- * @param method The method to execute
127
- * @param args The arguments to pass to the method
128
- * @param options Options for the execution
129
- * @returns A promise that resolves with the results
130
- */
131
- executeByType<T>(type: AugmentationType, method: string, args?: any[], options?: PipelineOptions): Promise<PipelineResult<T>>;
132
- /**
133
- * Executes a method on a single augmentation with automatic error handling
134
- *
135
- * @param augmentation The augmentation to execute the method on
136
- * @param method The method to execute
137
- * @param args The arguments to pass to the method
138
- * @returns A promise that resolves with the result
139
- */
140
- executeSingle<T>(augmentation: IAugmentation, method: string, ...args: any[]): Promise<AugmentationResponse<T>>;
141
- /**
142
- * Process static data through a pipeline of augmentations
143
- *
144
- * @param data The data to process
145
- * @param pipeline An array of processing steps, each with an augmentation, method, and optional args transformer
146
- * @param options Options for the execution
147
- * @returns A promise that resolves with the final result
148
- */
149
- processStaticData<T, R = any>(data: T, pipeline: Array<{
150
- augmentation: IAugmentation;
151
- method: string;
152
- transformArgs?: (data: any, prevResult?: any) => any[];
153
- }>, options?: PipelineOptions): Promise<AugmentationResponse<R>>;
154
- /**
155
- * Process streaming data through a pipeline of augmentations
156
- *
157
- * @param source The source augmentation that provides the data stream
158
- * @param sourceMethod The method on the source augmentation that provides the data stream
159
- * @param sourceArgs The arguments to pass to the source method
160
- * @param pipeline An array of processing steps, each with an augmentation, method, and optional args transformer
161
- * @param callback Function to call with the results of processing each data item
162
- * @param options Options for the execution
163
- * @returns A promise that resolves when the pipeline is set up
164
- */
165
- processStreamingData<T>(source: IAugmentation, sourceMethod: string, sourceArgs: any[], pipeline: Array<{
166
- augmentation: IAugmentation;
167
- method: string;
168
- transformArgs?: (data: any, prevResult?: any) => any[];
169
- }>, callback: (result: AugmentationResponse<T>) => void, options?: PipelineOptions): Promise<void>;
170
- /**
171
- * Create a reusable pipeline for processing data
172
- *
173
- * @param pipeline An array of processing steps
174
- * @param options Options for the execution
175
- * @returns A function that processes data through the pipeline
176
- */
177
- createPipeline<T, R>(pipeline: Array<{
178
- augmentation: IAugmentation;
179
- method: string;
180
- transformArgs?: (data: any, prevResult?: any) => any[];
181
- }>, options?: PipelineOptions): (data: T) => Promise<AugmentationResponse<R>>;
182
- /**
183
- * Create a reusable streaming pipeline
184
- *
185
- * @param source The source augmentation
186
- * @param sourceMethod The method on the source augmentation
187
- * @param pipeline An array of processing steps
188
- * @param options Options for the execution
189
- * @returns A function that sets up the streaming pipeline
190
- */
191
- createStreamingPipeline<T, R>(source: IAugmentation, sourceMethod: string, pipeline: Array<{
192
- augmentation: IAugmentation;
193
- method: string;
194
- transformArgs?: (data: any, prevResult?: any) => any[];
195
- }>, options?: PipelineOptions): (sourceArgs: any[], callback: (result: AugmentationResponse<R>) => void) => Promise<void>;
196
- /**
197
- * Execute a sense pipeline (legacy method)
198
- */
199
- executeSensePipeline<M extends keyof BrainyAugmentations.ISenseAugmentation & string, R extends BrainyAugmentations.ISenseAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.ISenseAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.ISenseAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
200
- success: boolean;
201
- data: R;
202
- error?: string;
203
- }>[]>;
204
- /**
205
- * Execute a conduit pipeline (legacy method)
206
- */
207
- executeConduitPipeline<M extends keyof BrainyAugmentations.IConduitAugmentation & string, R extends BrainyAugmentations.IConduitAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.IConduitAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.IConduitAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
208
- success: boolean;
209
- data: R;
210
- error?: string;
211
- }>[]>;
212
- /**
213
- * Execute a cognition pipeline (legacy method)
214
- */
215
- executeCognitionPipeline<M extends keyof BrainyAugmentations.ICognitionAugmentation & string, R extends BrainyAugmentations.ICognitionAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.ICognitionAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.ICognitionAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
216
- success: boolean;
217
- data: R;
218
- error?: string;
219
- }>[]>;
220
- /**
221
- * Execute a memory pipeline (legacy method)
222
- */
223
- executeMemoryPipeline<M extends keyof BrainyAugmentations.IMemoryAugmentation & string, R extends BrainyAugmentations.IMemoryAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.IMemoryAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.IMemoryAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
224
- success: boolean;
225
- data: R;
226
- error?: string;
227
- }>[]>;
228
- /**
229
- * Execute a perception pipeline (legacy method)
230
- */
231
- executePerceptionPipeline<M extends keyof BrainyAugmentations.IPerceptionAugmentation & string, R extends BrainyAugmentations.IPerceptionAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.IPerceptionAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.IPerceptionAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
232
- success: boolean;
233
- data: R;
234
- error?: string;
235
- }>[]>;
236
- /**
237
- * Execute a dialog pipeline (legacy method)
238
- */
239
- executeDialogPipeline<M extends keyof BrainyAugmentations.IDialogAugmentation & string, R extends BrainyAugmentations.IDialogAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.IDialogAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.IDialogAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
240
- success: boolean;
241
- data: R;
242
- error?: string;
243
- }>[]>;
244
- /**
245
- * Execute an activation pipeline (legacy method)
246
- */
247
- executeActivationPipeline<M extends keyof BrainyAugmentations.IActivationAugmentation & string, R extends BrainyAugmentations.IActivationAugmentation[M] extends (...args: any[]) => AugmentationResponse<infer U> ? U : never>(method: M & (BrainyAugmentations.IActivationAugmentation[M] extends (...args: any[]) => any ? M : never), args: Parameters<Extract<BrainyAugmentations.IActivationAugmentation[M], (...args: any[]) => any>>, options?: PipelineOptions): Promise<Promise<{
248
- success: boolean;
249
- data: R;
250
- error?: string;
251
- }>[]>;
252
- }
253
- export declare const pipeline: Pipeline;
254
- export declare const augmentationPipeline: Pipeline;
255
- export declare const executeStreamlined: <T>(augmentations: IAugmentation[], method: string, args?: any[], options?: PipelineOptions) => Promise<PipelineResult<T>>;
256
- export declare const executeByType: <T>(type: AugmentationType, method: string, args?: any[], options?: PipelineOptions) => Promise<PipelineResult<T>>;
257
- export declare const executeSingle: <T>(augmentation: IAugmentation, method: string, ...args: any[]) => Promise<AugmentationResponse<T>>;
258
- export declare const processStaticData: <T, R = any>(data: T, pipelineSteps: Array<{
259
- augmentation: IAugmentation;
260
- method: string;
261
- transformArgs?: (data: any, prevResult?: any) => any[];
262
- }>, options?: PipelineOptions) => Promise<AugmentationResponse<R>>;
263
- export declare const processStreamingData: <T>(source: IAugmentation, sourceMethod: string, sourceArgs: any[], pipelineSteps: Array<{
264
- augmentation: IAugmentation;
265
- method: string;
266
- transformArgs?: (data: any, prevResult?: any) => any[];
267
- }>, callback: (result: AugmentationResponse<T>) => void, options?: PipelineOptions) => Promise<void>;
268
- export declare const createPipeline: <T, R>(pipelineSteps: Array<{
269
- augmentation: IAugmentation;
270
- method: string;
271
- transformArgs?: (data: any, prevResult?: any) => any[];
272
- }>, options?: PipelineOptions) => (data: T) => Promise<AugmentationResponse<R>>;
273
- export declare const createStreamingPipeline: <T, R>(source: IAugmentation, sourceMethod: string, pipelineSteps: Array<{
274
- augmentation: IAugmentation;
275
- method: string;
276
- transformArgs?: (data: any, prevResult?: any) => any[];
277
- }>, options?: PipelineOptions) => (sourceArgs: any[], callback: (result: AugmentationResponse<R>) => void) => Promise<void>;
278
- export declare const StreamlinedExecutionMode: typeof ExecutionMode;
279
- export type StreamlinedPipelineOptions = PipelineOptions;
280
- export type StreamlinedPipelineResult<T> = PipelineResult<T>;