/** * FlowExecutor — extracted from index.ts for testability. * * Encapsulates the orchestration logic for running flows: cycle detection, * project-flow confirmation, parallel execution with failover, caching, * and telemetry. */ import type { FlowConfig } from "./agents.js"; import type { SingleResult, FlowDetails, FlowMetrics } from "../types/flow.js"; import { type LoadedFlowModelConfigs } from "../config/config.js"; import { type Complexity } from "./complexity.js"; import type { GoalContext } from '../flow/types.js'; export { preserveMetadata, createGhostResult, shouldFailover, type CycleHistoryEntry } from "./cycle-guard.js"; export { buildReworkIntent, buildGroupAuditIntent, formatPriorAuditHistory, formatPriorBuildOutputs } from "./audit-formatters.js"; export interface FlowExecutorDeps { flows: FlowConfig[]; currentDepth: number; maxDepth: number; ancestorFlowStack: string[]; preventCycles: boolean; toolOptimize: boolean; structuredOutput: boolean; cwd: string; loadedFlowModelConfigs: LoadedFlowModelConfigs; maxConcurrency: number; defaultComplexity: Complexity; signal?: AbortSignal; onUpdate?: (result: import("@earendil-works/pi-agent-core").AgentToolResult) => void; makeDetails: (results: SingleResult[]) => FlowDetails; getFlag: (name: string) => unknown; tierOverrideResolver: (tier: "lite" | "flash" | "full") => string | undefined; fallbackModel?: string; forkSessionSnapshotJsonl: string | null; compressionStats?: import("../core2/snapshot.js").CompressionStats; projectFlowsDir: string | null; sessionManager: { getHeader: () => unknown; getBranch: () => unknown[]; getSessionId: () => string; }; hasUI: boolean; uiConfirm: (title: string, body: string) => Promise; onFlowMetrics?: (metrics: FlowMetrics) => void; confirmProjectFlows?: boolean; goalContinuationCallback?: (results: SingleResult[]) => Promise; goalContext?: GoalContext; debugMode: boolean; /** Connection-error retries after model failover is exhausted. Default: 3. */ subAgentMaxRetries?: number; /** Base delay (ms) for exponential backoff between connection retries. Default: 1000. */ subAgentBaseDelayMs?: number; } export interface ExecuteFlowParams { type: string; intent: string; aim: string; acceptance?: string; concern?: string; cwd?: string; complexity: Complexity; _childTools?: string[]; preDispatchResults?: string; } export interface ExecuteFlowResult { content: Array<{ type: string; text: string; }>; details: FlowDetails; failed?: boolean; _toolCallId?: string; } export declare function executeFlows(deps: FlowExecutorDeps, params: ExecuteFlowParams[], toolCallId: string, auditLoop: number): Promise; //# sourceMappingURL=executor.d.ts.map