erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
141 lines • 4.37 kB
TypeScript
/**
* Self-Improvement Orchestrator
*
* Applies AlphaZero-style learning to complex debugging, refactoring, and
* precision tasks to continuously improve erosolar-cli source code.
*
* Features:
* 1. Identifies improvement opportunities from learning data
* 2. Applies quality-driven code changes
* 3. Uses git for safe versioning and rollback
* 4. Validates changes before committing
*
* Principal Investigator: Bo Shang
*/
export interface ImprovementOpportunity {
type: 'bug-fix' | 'refactor' | 'performance' | 'reliability' | 'feature';
priority: 'critical' | 'high' | 'medium' | 'low';
description: string;
sourceFile: string;
suggestedChange: string;
confidence: number;
evidence: string[];
}
export interface ImprovementPlan {
id: string;
opportunities: ImprovementOpportunity[];
totalConfidence: number;
estimatedImpact: string;
createdAt: string;
}
export interface ImprovementResult {
success: boolean;
filesChanged: string[];
testsRun: boolean;
testsPassed: boolean;
buildPassed: boolean;
commitHash?: string;
rollbackCommand?: string;
error?: string;
}
/**
* Analyze learning data to identify improvement opportunities
*/
export declare function analyzeImprovementOpportunities(workingDir?: string): ImprovementOpportunity[];
/**
* Execute a self-improvement plan
*/
export declare function executeImprovementPlan(plan: ImprovementPlan, workingDir?: string, options?: {
runTests?: boolean;
autoCommit?: boolean;
dryRun?: boolean;
}): Promise<ImprovementResult>;
/**
* Trigger self-improvement for complex debugging task
*/
export declare function triggerDebugImprovement(errorPattern: string, workingDir?: string): Promise<ImprovementResult | null>;
/**
* Trigger self-improvement for refactoring task
*/
export declare function triggerRefactorImprovement(targetArea: string, workingDir?: string): Promise<ImprovementResult | null>;
/**
* Run comprehensive self-improvement analysis
*/
export declare function runSelfImprovementCycle(workingDir?: string, options?: {
maxChanges?: number;
minConfidence?: number;
runTests?: boolean;
autoCommit?: boolean;
}): Promise<{
analyzed: number;
applied: number;
results: ImprovementResult[];
summary: string;
}>;
/**
* Get a summary of improvement opportunities for display
*/
export declare function getImprovementSummary(workingDir?: string): string;
export interface AutoImprovementConfig {
workingDir: string;
minConfidence: number;
maxIterations: number;
delayBetweenMs: number;
runTests: boolean;
onProgress?: (event: AutoImprovementEvent) => void;
shouldStop?: () => boolean;
}
export interface AutoImprovementEvent {
type: 'start' | 'iteration' | 'applied' | 'failed' | 'rollback' | 'complete' | 'no-opportunities';
iteration?: number;
message: string;
opportunity?: ImprovementOpportunity;
result?: ImprovementResult;
totalApplied?: number;
totalFailed?: number;
}
export interface AutoImprovementState {
isRunning: boolean;
startTime: string | null;
iteration: number;
applied: number;
failed: number;
rollbacks: number;
lastError: string | null;
safetyBranchBase: string | null;
}
/**
* Get current auto-improvement state
*/
export declare function getAutoImprovementState(): AutoImprovementState;
/**
* Request stop of autonomous improvement
*/
export declare function requestAutoImprovementStop(): void;
/**
* Run autonomous infinite improvement
*
* This function runs in a loop, continuously:
* 1. Analyzing improvement opportunities
* 2. Applying the highest-confidence improvement
* 3. Validating with build/tests
* 4. Rolling back if validation fails
* 5. Continuing until no more improvements or stopped
*/
export declare function runAutonomousImprovement(config: AutoImprovementConfig): Promise<{
success: boolean;
totalApplied: number;
totalFailed: number;
totalRollbacks: number;
iterations: number;
stoppedReason: 'no-opportunities' | 'max-iterations' | 'user-stopped' | 'error';
error?: string;
}>;
/**
* Emergency rollback - use if something goes wrong
*/
export declare function emergencyRollback(workingDir: string): {
success: boolean;
message: string;
};
//# sourceMappingURL=selfImprovement.d.ts.map