/** * RLM Orchestrator * Manages the conversation loop between model and REPL * Supports multiple LLM providers: Gemini and Amazon Bedrock * * Token Optimization: Implements context compression techniques from * the RLM paper (arXiv:2512.24601) for efficient token usage: * - Sliding window for conversation history * - Memory bank for key findings * - Result compression for sub-LLM outputs */ import type { RLMConfig, RLMContext, RLMResult, RLMTurn, RLMProgress } from './types.js'; import { ContextManager, type ContextManagerConfig } from './context-manager.js'; import { ParallelExecutor, SelectiveAttention, type ParallelExecutionConfig, type AdaptiveCompressionConfig, type RefinementConfig } from './advanced-features.js'; /** * RLM Orchestrator manages the agentic loop */ /** * Thresholds for minimum sub-LLM calls based on codebase size * These can be adjusted to tune analysis depth vs speed */ export declare const SUB_LLM_THRESHOLDS: { /** Files >= 200: require at least 5 sub-LLM calls */ readonly VERY_LARGE: { readonly files: 200; readonly minCalls: 5; }; /** Files >= 100: require at least 4 sub-LLM calls */ readonly LARGE: { readonly files: 100; readonly minCalls: 4; }; /** Files >= 50: require at least 3 sub-LLM calls */ readonly MEDIUM: { readonly files: 50; readonly minCalls: 3; }; /** Files >= 20: require at least 2 sub-LLM calls */ readonly SMALL: { readonly files: 20; readonly minCalls: 2; }; /** Default minimum for tiny codebases */ readonly DEFAULT_MIN: 1; }; /** Advanced features configuration */ export interface AdvancedFeaturesConfig { /** Parallel execution config */ parallel?: Partial; /** Adaptive compression config */ adaptiveCompression?: Partial; /** Refinement config */ refinement?: Partial; /** Max context tokens for adaptive compression */ maxContextTokens?: number; } /** * Note: The `supply-chain` command is handled directly in cli.ts via runSupplyChainScan() * and does NOT go through the RLM orchestration loop. This is intentional: * supply-chain scanning is deterministic (OSV API) and does not benefit from * recursive LLM orchestration. */ export declare class RLMOrchestrator { private config; private executor; private verbose; private fallbackModel; private contextManager; private parallelExecutor; private adaptiveCompressor; private contextRotDetector; private selectiveAttention; private iterativeRefiner; /** Enable/disable context compression (default: true) */ enableContextCompression: boolean; /** Enable/disable parallel sub-LLM execution (default: true) */ enableParallelExecution: boolean; /** Enable/disable context rot detection (default: true) */ enableContextRotDetection: boolean; /** Enable/disable iterative refinement (default: false - opt-in) */ enableIterativeRefinement: boolean; constructor(config?: Partial, verbose?: boolean, contextConfig?: Partial, advancedConfig?: AdvancedFeaturesConfig); /** * Process a query with the RLM system */ processQuery(query: string, context: RLMContext, onTurnComplete?: (turn: RLMTurn) => void, onProgress?: (progress: RLMProgress) => void): Promise; /** * Call model with conversation history using the configured provider */ private callConversation; /** * Call model with single prompt using the configured provider with fallback */ private callModel; /** * Extract code from response */ private extractCode; /** * Get context manager for external access (e.g., getting memory bank) */ getContextManager(): ContextManager; /** * Get token savings statistics */ getTokenSavings(): { originalChars: number; compressedChars: number; savings: number; }; /** * Execute multiple sub-LLM queries in parallel * Useful for analyzing multiple files concurrently */ executeParallelQueries(queries: Array<{ id: string; query: string; }>): Promise>; /** * Get adaptive compression metrics */ getCompressionMetrics(): { level: "none" | "normal" | "aggressive" | "emergency"; metrics: import("./advanced-features.js").ContextUsageMetrics; }; /** * Get context rot detection statistics */ getContextRotStats(): { rotIndicators: number; memoryReferences: number; ratio: number; }; /** * Get iterative refinement history */ getRefinementHistory(): import("./advanced-features.js").RefinementPassResult[]; /** * Evaluate the quality of an analysis result */ evaluateResultQuality(result: string, query: string): number; /** * Get selective attention manager for external configuration */ getSelectiveAttention(): SelectiveAttention; /** * Get parallel executor for external configuration */ getParallelExecutor(): ParallelExecutor; } //# sourceMappingURL=orchestrator.d.ts.map