/** * Autonomous loop execution system for iterative workflows. * Inspired by everything-claude-code: enables VerificationLoop, PRReviewLoop, * SequentialPipeline, and DAGOrchestration patterns. */ export interface LoopConfig { maxIterations: number; stopCondition: 'success' | 'no-change' | 'manual'; timeout: number; } export interface PipelineStep { id: string; name: string; task: string; dependsOn: string[]; status: 'pending' | 'running' | 'done' | 'error' | 'skipped'; result?: string; error?: string; startedAt?: number; finishedAt?: number; } export interface DAG { steps: PipelineStep[]; strategy: 'parallel-max' | 'sequential' | 'topological'; } export interface VerificationLoopState { iteration: number; testsPassed: boolean; lastError?: string; fixHistory: string[]; } export interface PRReviewState { iteration: number; approved: boolean; comments: string[]; reviewHistory: string[]; } /** * Build a prompt for iterative PR review. * Instructs the agent to review the PR, address comments, and re-review until approved. */ export declare function buildPRLoopPrompt(cwd: string): string; /** * Build a prompt for sequential pipeline execution. * Each task can reference the output of prior tasks. */ export declare function buildSequentialPipelinePrompt(tasks: string[]): string; /** * Build a prompt for DAG (directed acyclic graph) execution. * Steps run in dependency order, potentially in parallel where possible. */ export declare function buildDAGPrompt(dag: DAG): string; /** * Topological sort of PipelineStep array. * Returns an array of arrays, where each inner array is an execution layer. * Steps in the same layer have no inter-dependencies and can run in parallel. */ export declare function topologicalSort(steps: PipelineStep[]): PipelineStep[][]; /** * Pretty-print the status of a DAG using chalk colors. */ export declare function printDAGStatus(dag: DAG): void; /** * Build a prompt for multi-agent task decomposition. * Instructs the agent to break down a task into subtasks for parallel/sequential execution. */ export declare function buildMultiPlanPrompt(task: string): string; /** * Build a prompt for executing a multi-agent plan. * Takes a JSON plan and generates execution instructions. */ export declare function buildMultiExecutePrompt(plan: string): string; /** * Build a prompt for orchestrating backend service changes. * Useful for coordinating changes across multiple backend services. */ export declare function buildMultiBackendPrompt(services: string[]): string; /** * Build a prompt for orchestrating frontend component changes. * Useful for coordinating changes across multiple frontend components. */ export declare function buildMultiFrontendPrompt(components: string[]): string; /** * Build a general autonomous loop prompt. * Supports various loop types: verification, review, exploration, convergence, etc. */ export declare function buildLoopOperatorPrompt(task: string, loopType: string): string; /** * Helper function to compute the status of all steps in a DAG. * Returns a summary string for logging. */ export declare function summarizeDAGStatus(dag: DAG): string; /** * Helper function to check if a DAG has completed successfully. */ export declare function isDAGComplete(dag: DAG): boolean; /** * Helper function to check if a DAG has failed. */ export declare function hasDAGFailed(dag: DAG): boolean; /** * Helper function to collect all results from a completed DAG. */ export declare function collectDAGResults(dag: DAG): Record; /** * Helper function to format a DAG as a readable plan. */ export declare function formatDAGAsPlan(dag: DAG): string;