UNPKG

erosolar-cli

Version:

Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning

186 lines 4.97 kB
/** * AlphaZero Modular Optimization System * * Enables self-improvement through modular targeting of: * - Token count minimization * - Context window optimization * - Tool management (create/edit/delete) * - Guideline and guardrail management * - System prompt optimization * * Principal Investigator: Bo Shang */ export interface ModularTarget { id: string; type: 'tool' | 'guideline' | 'guardrail' | 'system-prompt' | 'capability' | 'schema'; name: string; path: string; tokenCount: number; priority: number; lastModified: string; issues: ModularIssue[]; } export interface ModularIssue { type: 'token-bloat' | 'redundancy' | 'outdated' | 'unused' | 'ineffective' | 'missing'; severity: 'critical' | 'high' | 'medium' | 'low'; description: string; suggestedAction: string; potentialSavings?: number; } export interface TokenAnalysis { totalTokens: number; byCategory: Record<string, number>; topConsumers: { name: string; tokens: number; path: string; }[]; optimizationOpportunities: OptimizationOpportunity[]; } export interface OptimizationOpportunity { target: string; currentTokens: number; estimatedOptimized: number; savings: number; savingsPercent: number; strategy: string; autoFixable: boolean; } export interface ToolDefinition { name: string; description: string; inputSchema: Record<string, unknown>; handler?: string; capability?: string; priority?: number; } export interface GuidelineDefinition { id: string; category: 'safety' | 'quality' | 'style' | 'behavior' | 'performance'; rule: string; rationale: string; severity: 'must' | 'should' | 'may'; examples?: string[]; } export interface ModularAction { type: 'create' | 'edit' | 'delete' | 'optimize' | 'merge' | 'split'; target: ModularTarget; changes: string; tokenImpact: number; approved: boolean; executed: boolean; rollbackData?: string; } /** * Estimate token count for a string */ export declare function estimateTokens(content: string): number; /** * Analyze token usage across the codebase */ export declare function analyzeTokenUsage(workingDir: string): TokenAnalysis; /** * Discover all modular targets in the codebase */ export declare function discoverModularTargets(workingDir: string): ModularTarget[]; /** * Create a new tool */ export declare function createTool(workingDir: string, definition: ToolDefinition): { success: boolean; path?: string; error?: string; }; /** * Edit an existing tool */ export declare function editTool(workingDir: string, toolPath: string, changes: { description?: string; inputSchema?: Record<string, unknown>; }): { success: boolean; error?: string; }; /** * Delete a tool */ export declare function deleteTool(workingDir: string, toolPath: string): { success: boolean; rollbackData?: string; error?: string; }; /** * Get all guidelines */ export declare function getGuidelines(): GuidelineDefinition[]; /** * Add a new guideline */ export declare function addGuideline(guideline: GuidelineDefinition): { success: boolean; error?: string; }; /** * Update a guideline */ export declare function updateGuideline(id: string, updates: Partial<GuidelineDefinition>): { success: boolean; error?: string; }; /** * Delete a guideline */ export declare function deleteGuideline(id: string): { success: boolean; error?: string; }; export interface ContextOptimization { strategy: string; description: string; impact: 'high' | 'medium' | 'low'; tokensSaved: number; implementation: string; } /** * Generate context optimization strategies */ export declare function generateContextOptimizations(workingDir: string): ContextOptimization[]; /** * Queue a modular action for execution */ export declare function queueModularAction(action: Omit<ModularAction, 'approved' | 'executed'>): void; /** * Get pending actions */ export declare function getPendingActions(): ModularAction[]; /** * Approve and execute a pending action */ export declare function executeModularAction(actionIndex: number, workingDir: string): { success: boolean; error?: string; }; /** * Rollback an executed action */ export declare function rollbackModularAction(actionIndex: number, workingDir: string): { success: boolean; error?: string; }; export interface ModularStatus { totalTargets: number; totalTokens: number; issuesByType: Record<string, number>; optimizationPotential: number; pendingActions: number; guidelines: number; } /** * Get overall modular system status */ export declare function getModularStatus(workingDir: string): ModularStatus; /** * Get formatted status display */ export declare function getModularStatusDisplay(workingDir: string): string; //# sourceMappingURL=alphaZeroModular.d.ts.map