2025-08-26 12:32:21 -07:00
|
|
|
/**
|
2026-02-01 08:22:11 -08:00
|
|
|
* Pipeline - Augmentation execution pipeline
|
2025-08-26 12:32:21 -07:00
|
|
|
*
|
2026-02-01 08:22:11 -08:00
|
|
|
* Provides Pipeline class, execution modes, and factory functions.
|
|
|
|
|
* All augmentation management should use brain.augmentations API.
|
2025-08-26 12:32:21 -07:00
|
|
|
*/
|
|
|
|
|
|
2026-02-01 08:22:11 -08:00
|
|
|
/**
|
|
|
|
|
* Execution mode for pipeline operations
|
|
|
|
|
*/
|
|
|
|
|
export enum ExecutionMode {
|
|
|
|
|
SEQUENTIAL = 'sequential',
|
|
|
|
|
PARALLEL = 'parallel',
|
|
|
|
|
FIRST_SUCCESS = 'firstSuccess',
|
|
|
|
|
FIRST_RESULT = 'firstResult',
|
|
|
|
|
THREADED = 'threaded'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Options for pipeline execution
|
|
|
|
|
*/
|
|
|
|
|
export interface PipelineOptions {
|
|
|
|
|
mode?: ExecutionMode
|
|
|
|
|
timeout?: number
|
|
|
|
|
retries?: number
|
|
|
|
|
throwOnError?: boolean
|
2025-08-26 12:32:21 -07:00
|
|
|
}
|
2026-02-01 08:22:11 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Minimal Pipeline class for backward compatibility.
|
|
|
|
|
* All augmentation management should use brain.augmentations API.
|
|
|
|
|
*/
|
|
|
|
|
export class Pipeline {
|
|
|
|
|
private static instance?: Pipeline
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
if (Pipeline.instance) {
|
|
|
|
|
return Pipeline.instance
|
|
|
|
|
}
|
|
|
|
|
Pipeline.instance = this
|
|
|
|
|
}
|
2025-08-26 12:32:21 -07:00
|
|
|
}
|
|
|
|
|
|
2026-02-01 08:22:11 -08:00
|
|
|
// Default singleton instance
|
|
|
|
|
export const pipeline = new Pipeline()
|
|
|
|
|
|
|
|
|
|
// Backward compatibility aliases
|
|
|
|
|
export const AugmentationPipeline = Pipeline
|
|
|
|
|
export const augmentationPipeline = pipeline
|
|
|
|
|
|
|
|
|
|
// Factory functions
|
|
|
|
|
export const createPipeline = async () => new Pipeline()
|
|
|
|
|
export const createStreamingPipeline = async () => new Pipeline()
|
|
|
|
|
|
|
|
|
|
// Type aliases
|
|
|
|
|
export type StreamlinedPipelineOptions = PipelineOptions
|
2025-08-26 12:32:21 -07:00
|
|
|
export type PipelineResult<T> = { success: boolean; data: T; error?: string }
|
|
|
|
|
export type StreamlinedPipelineResult<T> = PipelineResult<T>
|
|
|
|
|
|
|
|
|
|
// Execution mode alias
|
|
|
|
|
export enum StreamlinedExecutionMode {
|
|
|
|
|
SEQUENTIAL = 'sequential',
|
2026-02-01 08:22:11 -08:00
|
|
|
PARALLEL = 'parallel',
|
2025-08-26 12:32:21 -07:00
|
|
|
FIRST_SUCCESS = 'firstSuccess',
|
|
|
|
|
FIRST_RESULT = 'firstResult',
|
|
|
|
|
THREADED = 'threaded'
|
2026-02-01 08:22:11 -08:00
|
|
|
}
|