@soulcraft/brainy 0.63.0 → 1.0.0-rc.2

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.
@@ -260,12 +260,9 @@ export class BrainyChat {
260
260
  }
261
261
  // Private helper methods
262
262
  async createMessageRelationships(messageId) {
263
- // Link message to session using BrainyData addVerb() method
264
- await this.brainy.addVerb(messageId, this.currentSessionId, undefined, {
265
- type: VerbType.PartOf,
266
- metadata: {
267
- relationship: 'message-in-session'
268
- }
263
+ // Link message to session using unified addVerb API
264
+ await this.brainy.addVerb(messageId, this.currentSessionId, VerbType.PartOf, {
265
+ relationship: 'message-in-session'
269
266
  });
270
267
  // Find previous message to create conversation flow using VerbType.Precedes
271
268
  const previousMessages = await this.brainy.search('', 1, {
@@ -276,11 +273,8 @@ export class BrainyChat {
276
273
  }
277
274
  });
278
275
  if (previousMessages.length > 0 && previousMessages[0].id !== messageId) {
279
- await this.brainy.addVerb(previousMessages[0].id, messageId, undefined, {
280
- type: VerbType.Precedes,
281
- metadata: {
282
- relationship: 'message-sequence'
283
- }
276
+ await this.brainy.addVerb(previousMessages[0].id, messageId, VerbType.Precedes, {
277
+ relationship: 'message-sequence'
284
278
  });
285
279
  }
286
280
  }
@@ -585,9 +585,7 @@ export class NeuralImport {
585
585
  }
586
586
  // Add relationships to Brainy
587
587
  for (const relationship of result.detectedRelationships) {
588
- await this.brainy.addVerb(relationship.sourceId, relationship.targetId, undefined, // no custom vector
589
- {
590
- type: relationship.verbType,
588
+ await this.brainy.addVerb(relationship.sourceId, relationship.targetId, relationship.verbType, {
591
589
  weight: relationship.weight,
592
590
  metadata: {
593
591
  confidence: relationship.confidence,
package/dist/index.d.ts CHANGED
@@ -29,11 +29,10 @@ export { UniversalSentenceEncoder, TransformerEmbedding, createEmbeddingFunction
29
29
  import { OPFSStorage, MemoryStorage, R2Storage, S3CompatibleStorage, createStorage } from './storage/storageFactory.js';
30
30
  export { OPFSStorage, MemoryStorage, R2Storage, S3CompatibleStorage, createStorage };
31
31
  export { FileSystemStorage } from './storage/adapters/fileSystemStorage.js';
32
- import { Pipeline, pipeline, augmentationPipeline, ExecutionMode, PipelineOptions, PipelineResult, executeStreamlined, executeByType, executeSingle, processStaticData, processStreamingData, createPipeline, createStreamingPipeline, StreamlinedExecutionMode, StreamlinedPipelineOptions, StreamlinedPipelineResult } from './pipeline.js';
33
- import { SequentialPipeline, sequentialPipeline, SequentialPipelineOptions } from './sequentialPipeline.js';
32
+ import { Pipeline, pipeline, augmentationPipeline, ExecutionMode, PipelineOptions, PipelineResult, createPipeline, createStreamingPipeline, StreamlinedExecutionMode, StreamlinedPipelineOptions, StreamlinedPipelineResult } from './pipeline.js';
34
33
  import { createSenseAugmentation, addWebSocketSupport, executeAugmentation, loadAugmentationModule, AugmentationOptions } from './augmentationFactory.js';
35
- export { Pipeline, pipeline, augmentationPipeline, ExecutionMode, SequentialPipeline, sequentialPipeline, executeStreamlined, executeByType, executeSingle, processStaticData, processStreamingData, createPipeline, createStreamingPipeline, StreamlinedExecutionMode, createSenseAugmentation, addWebSocketSupport, executeAugmentation, loadAugmentationModule };
36
- export type { PipelineOptions, PipelineResult, SequentialPipelineOptions, StreamlinedPipelineOptions, StreamlinedPipelineResult, AugmentationOptions };
34
+ export { Pipeline, pipeline, augmentationPipeline, ExecutionMode, createPipeline, createStreamingPipeline, StreamlinedExecutionMode, createSenseAugmentation, addWebSocketSupport, executeAugmentation, loadAugmentationModule };
35
+ export type { PipelineOptions, PipelineResult, StreamlinedPipelineOptions, StreamlinedPipelineResult, AugmentationOptions };
37
36
  import { availableAugmentations, registerAugmentation, initializeAugmentationPipeline, setAugmentationEnabled, getAugmentationsByType } from './augmentationRegistry.js';
38
37
  export { availableAugmentations, registerAugmentation, initializeAugmentationPipeline, setAugmentationEnabled, getAugmentationsByType };
39
38
  import { loadAugmentationsFromModules, createAugmentationRegistryPlugin, createAugmentationRegistryRollupPlugin } from './augmentationRegistryLoader.js';
package/dist/index.js CHANGED
@@ -51,16 +51,15 @@ export { OPFSStorage, MemoryStorage, R2Storage, S3CompatibleStorage, createStora
51
51
  // FileSystemStorage is exported separately to avoid browser build issues
52
52
  export { FileSystemStorage } from './storage/adapters/fileSystemStorage.js';
53
53
  // Export unified pipeline
54
- import { Pipeline, pipeline, augmentationPipeline, ExecutionMode, executeStreamlined, executeByType, executeSingle, processStaticData, processStreamingData, createPipeline, createStreamingPipeline, StreamlinedExecutionMode } from './pipeline.js';
55
- // Export sequential pipeline (for backward compatibility)
56
- import { SequentialPipeline, sequentialPipeline } from './sequentialPipeline.js';
54
+ import { Pipeline, pipeline, augmentationPipeline, ExecutionMode, createPipeline, createStreamingPipeline, StreamlinedExecutionMode } from './pipeline.js';
55
+ // Sequential pipeline removed - use unified pipeline instead
57
56
  // Export augmentation factory
58
57
  import { createSenseAugmentation, addWebSocketSupport, executeAugmentation, loadAugmentationModule } from './augmentationFactory.js';
59
58
  export {
60
59
  // Unified pipeline exports
61
- Pipeline, pipeline, augmentationPipeline, ExecutionMode, SequentialPipeline, sequentialPipeline,
62
- // Streamlined pipeline exports (now part of unified pipeline)
63
- executeStreamlined, executeByType, executeSingle, processStaticData, processStreamingData, createPipeline, createStreamingPipeline, StreamlinedExecutionMode,
60
+ Pipeline, pipeline, augmentationPipeline, ExecutionMode,
61
+ // Factory functions
62
+ createPipeline, createStreamingPipeline, StreamlinedExecutionMode,
64
63
  // Augmentation factory exports
65
64
  createSenseAugmentation, addWebSocketSupport, executeAugmentation, loadAugmentationModule };
66
65
  // Export augmentation registry for build-time loading
@@ -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>;