import type { Workflow, WorkflowState, WorkflowResult, CheckpointStore } from '@cogitator-ai/types'; import type { Cogitator } from '@cogitator-ai/core'; export type SubworkflowErrorStrategy = 'propagate' | 'catch' | 'retry' | 'ignore'; export interface SubworkflowRetryConfig { maxAttempts: number; delay?: number; backoff?: 'linear' | 'exponential'; } export interface SubworkflowConfig { name: string; workflow: Workflow; inputMapper: (parentState: PS, context: SubworkflowContext) => Partial; outputMapper: (childResult: WorkflowResult, parentState: PS, context: SubworkflowContext) => PS; onError?: SubworkflowErrorStrategy; retryConfig?: SubworkflowRetryConfig; maxDepth?: number; timeout?: number; shareCheckpoints?: boolean; onStart?: (childState: Partial, context: SubworkflowContext) => void; onComplete?: (result: WorkflowResult, context: SubworkflowContext) => void; onChildError?: (error: Error, context: SubworkflowContext) => void; condition?: (parentState: PS, context: SubworkflowContext) => boolean; } export interface SubworkflowContext { cogitator: Cogitator; parentWorkflowId: string; parentRunId: string; parentNodeId: string; depth: number; checkpointStore?: CheckpointStore; metadata?: Record; signal?: AbortSignal; } export interface SubworkflowResult { success: boolean; parentState: PS; childResult?: WorkflowResult; error?: Error; skipped: boolean; duration: number; depth: number; } export declare class MaxDepthExceededError extends Error { readonly depth: number; readonly maxDepth: number; constructor(depth: number, maxDepth: number); } export declare function executeSubworkflow(parentState: PS, config: SubworkflowConfig, context: SubworkflowContext): Promise>; export declare function subworkflowNode(name: string, config: Omit, 'name'>): SubworkflowConfig; export declare function simpleSubworkflow(name: string, workflow: Workflow, options?: Partial, 'name' | 'workflow' | 'inputMapper' | 'outputMapper'>>): SubworkflowConfig; export declare function nestedSubworkflow(name: string, workflow: Workflow, stateKey: K, options?: Partial, 'name' | 'workflow' | 'inputMapper' | 'outputMapper'>>): SubworkflowConfig; export declare function conditionalSubworkflow(name: string, config: Omit, 'name'> & { condition: (state: PS) => boolean; }): SubworkflowConfig; //# sourceMappingURL=subworkflow-node.d.ts.map