import type { Workflow, WorkflowState, WorkflowResult } from '@cogitator-ai/types'; import { type SubworkflowContext, type SubworkflowConfig, type SubworkflowResult, type SubworkflowErrorStrategy } from './subworkflow-node.js'; export interface ParallelSubworkflowDef { id: string; config: SubworkflowConfig; } export interface ParallelSubworkflowsConfig { name: string; subworkflows: ParallelSubworkflowDef[] | ((state: S) => ParallelSubworkflowDef[]); concurrency?: number; continueOnError?: boolean; onError?: SubworkflowErrorStrategy; aggregator: (results: Map>, parentState: S) => S; maxDepth?: number; shareCheckpoints?: boolean; onSubworkflowStart?: (id: string, config: SubworkflowConfig) => void; onSubworkflowComplete?: (id: string, result: SubworkflowResult) => void; onProgress?: (progress: ParallelProgress) => void; } export interface ParallelProgress { total: number; completed: number; successful: number; failed: number; pending: number; running: number; } export interface ParallelSubworkflowsResult { success: boolean; parentState: S; results: Map>; errors: Map; duration: number; stats: { total: number; successful: number; failed: number; skipped: number; }; } export declare function executeParallelSubworkflows(parentState: S, config: ParallelSubworkflowsConfig, context: SubworkflowContext): Promise>; export declare function parallelSubworkflows(name: string, config: Omit, 'name'>): ParallelSubworkflowsConfig; export declare function fanOutFanIn(name: string, config: { workflow: Workflow; getInputs: (state: S) => { id: string; input: Partial; }[]; aggregator: (results: Map>, state: S) => S; concurrency?: number; continueOnError?: boolean; }): ParallelSubworkflowsConfig; export declare function scatterGather(name: string, config: { workflows: Map>; inputMapper: (state: S, workflowId: string) => Partial; outputMapper: (results: Map>, state: S) => S; concurrency?: number; timeout?: number; continueOnError?: boolean; }): ParallelSubworkflowsConfig; export declare function raceSubworkflows(parentState: PS, subworkflows: SubworkflowConfig[], context: SubworkflowContext): Promise | null>; export declare function fallbackSubworkflows(parentState: PS, subworkflows: SubworkflowConfig[], context: SubworkflowContext): Promise>; //# sourceMappingURL=parallel-subworkflows.d.ts.map