/** * DagEngine - AI-powered workflow orchestration * * Main entry point for the DAG execution engine. * Orchestrates the execution of AI dimensions across multiple sections * with dependency management, parallel execution, and comprehensive error handling. * * @module engine/dag-engine * * @example Basic Usage * ```typescript * const engine = new DagEngine({ * plugin: myPlugin, * providers: myAdapter * }); * * const result = await engine.process(sections); * console.log(result.sections); * console.log(result.globalResults); * ``` * * @example Advanced Configuration * ```typescript * const engine = new DagEngine({ * plugin: myPlugin, * providers: myAdapter, * execution: { * concurrency: 10, * maxRetries: 5, * timeout: 30000, * continueOnError: false * }, * pricing: { * models: { * 'gpt-4': { inputPer1M: 30, outputPer1M: 60 } * } * } * }); * * const result = await engine.process(sections, { * onDimensionStart: (dim) => console.log(`Starting ${dim}`), * onDimensionComplete: (dim, result) => console.log(`Completed ${dim}`) * }); * ``` */ import type PQueue from "p-queue"; import { ProviderAdapter } from "../../providers/adapter.js"; import { type EngineConfig } from "./engine-config.js"; import type { GraphAnalytics } from "../analysis/graph-types.js"; import type { ProgressUpdate } from "../../types"; import type { ProcessOptions, ProcessResult, SectionData } from "../../types"; import type { PricingConfig } from "../../types"; export interface ExecutionConfig { concurrency: number; maxRetries: number; retryDelay: number; timeout: number; continueOnError: boolean; dimensionTimeouts: Record; pricing?: PricingConfig; } /** * Graph export format */ export interface GraphExport { nodes: Array<{ id: string; label: string; type: "global" | "section"; }>; links: Array<{ source: string; target: string; }>; } /** * DagEngine - Main orchestration engine * * Coordinates the execution of AI-powered workflows with: * - Automatic dependency resolution * - Parallel execution where possible * - Comprehensive error handling and retries * - Cost tracking and analytics * - Flexible plugin architecture */ export declare class DagEngine { private readonly plugin; private readonly adapter; private readonly phaseExecutor; private readonly graphManager; private readonly inngestOrchestrator?; private readonly progressDisplayOptions?; private cachedDependencyGraph?; constructor(config: EngineConfig); process(sections: SectionData[], options?: ProcessOptions): Promise; /** * Get current progress (for polling) * Returns undefined if not currently processing */ getProgress(): ProgressUpdate | undefined; private resolveProgressDisplay; /** * Process sections using Inngest orchestration * * Explicitly use Inngest for long-running workflows with automatic * checkpointing and resumption capabilities. * * @param sections - Sections to process * @param options - Process options for hooks and callbacks * @returns Process result with sections, global results, and costs * @throws {Error} If Inngest is not enabled * * @example * ```typescript * const result = await engine.processWithInngest(sections, { * onDimensionStart: (dim) => console.log(`Starting ${dim}`) * }); * ``` */ processWithInngest(sections: SectionData[], options?: ProcessOptions): Promise; /** * Gets comprehensive graph analytics * * Provides insights into the dependency graph including: * - Total dimensions and dependencies * - Maximum depth and critical path * - Parallel execution groups * - Independent dimensions * - Bottleneck identification * * @returns Graph analytics * * @example * ```typescript * const analytics = await engine.getGraphAnalytics(); * * console.log('Total dimensions:', analytics.totalDimensions); * console.log('Max depth:', analytics.maxDepth); * console.log('Critical path:', analytics.criticalPath); * console.log('Bottlenecks:', analytics.bottlenecks); * ``` */ getGraphAnalytics(): Promise; /** * Exports dependency graph as DOT format for visualization * * Use with Graphviz or other DOT visualization tools. * * @returns DOT format string * * @example * ```typescript * const dot = await engine.exportGraphDOT(); * * // Save to file * await fs.writeFile('graph.dot', dot); * * // Render with Graphviz * // dot -Tpng graph.dot -o graph.png * ``` */ exportGraphDOT(): Promise; /** * Exports dependency graph as JSON for programmatic use * * @returns JSON graph with nodes and links * * @example * ```typescript * const graph = await engine.exportGraphJSON(); * * console.log('Nodes:', graph.nodes); * console.log('Links:', graph.links); * * // Use with D3.js, vis.js, etc. * ``` */ exportGraphJSON(): Promise; /** * Gets the provider adapter instance * * @returns Provider adapter * * @example * ```typescript * const adapter = engine.getAdapter(); * * // Register additional provider * adapter.registerProvider(newProvider); * ``` */ getAdapter(): ProviderAdapter; /** * Gets list of available provider names * * @returns Array of provider names * * @example * ```typescript * const providers = engine.getAvailableProviders(); * console.log('Available:', providers); * // ['openai', 'anthropic', 'custom-provider'] * ``` */ getAvailableProviders(): string[]; /** * Gets the internal execution queue * * Advanced usage only. Allows monitoring queue state. * * @returns PQueue instance * * @example * ```typescript * const queue = engine.getQueue(); * console.log('Queue size:', queue.size); * console.log('Pending:', queue.pending); * ``` */ getQueue(): PQueue; /** * Gets the current execution configuration * * @returns Execution configuration * * @example * ```typescript * const config = engine.getExecutionConfig(); * console.log('Concurrency:', config.concurrency); * console.log('Max retries:', config.maxRetries); * ``` */ getExecutionConfig(): ExecutionConfig; } //# sourceMappingURL=dag-engine.d.ts.map