/**
 * Agent Infrastructure
 *
 * Encapsulates all infrastructure dependencies for agents.
 * Extracts the 15+ managers from BaseAgent to reduce the God Object anti-pattern.
 *
 * Benefits:
 * - Single Responsibility: Infrastructure concerns separated from agent logic
 * - Testability: Easy to mock infrastructure for unit tests
 * - Dependency Injection: Clear dependencies via constructor
 * - Lazy Loading: Heavy resources loaded on-demand
 */
import { EventEmitter } from 'events';
import type { IServiceContainer } from '../../infrastructure/types.js';
import type { TokenCounter } from '../../utils/token-counter.js';
import type { ContextManagerV2 } from '../../context/context-manager-v2.js';
import type { AgentModeManager } from '../agent-mode.js';
import type { SandboxManager } from '../../security/sandbox.js';
import type { MCPClient } from '../../mcp/mcp-client.js';
import type { PromptCacheManager } from '../../optimization/prompt-cache.js';
import type { HooksManager } from '../../hooks/lifecycle-hooks.js';
import type { MoltbotHooksManager } from '../../hooks/moltbot-hooks.js';
import type { ModelRouter, RoutingDecision } from '../../optimization/model-routing.js';
import type { PluginMarketplace } from '../../plugins/marketplace.js';
import type { RepairCoordinator } from '../execution/repair-coordinator.js';
import type { EnhancedMemory, MemoryEntry, MemoryType } from '../../memory/index.js';
/**
 * Required dependencies for AgentInfrastructure
 */
export interface AgentInfrastructureDeps {
    /** Service container with core services */
    container: IServiceContainer;
    /** Token counter for the model */
    tokenCounter: TokenCounter;
    /** Context manager for message history */
    contextManager: ContextManagerV2;
    /** Agent mode manager */
    modeManager: AgentModeManager;
    /** Sandbox manager for security */
    sandboxManager: SandboxManager;
    /** MCP client for tool servers */
    mcpClient: MCPClient;
    /** Prompt cache manager */
    promptCacheManager: PromptCacheManager;
    /** Lifecycle hooks manager */
    hooksManager: HooksManager;
    /** Moltbot hooks manager (intro, persistence, command logging) */
    moltbotHooksManager: MoltbotHooksManager;
    /** Model router for optimization */
    modelRouter: ModelRouter;
    /** Plugin marketplace */
    marketplace: PluginMarketplace;
    /** Repair coordinator for auto-fix */
    repairCoordinator: RepairCoordinator;
}
/**
 * Optional configuration for AgentInfrastructure
 */
export interface AgentInfrastructureConfig {
    /** Enable memory system (default: true) */
    memoryEnabled?: boolean;
    /** Enable model routing (default: false) */
    useModelRouting?: boolean;
}
/**
 * Memory context options
 */
export interface MemoryContextOptions {
    query?: string;
    includePreferences?: boolean;
    includeProject?: boolean;
    includeRecentSummaries?: boolean;
}
/**
 * Encapsulates all infrastructure dependencies for agents.
 *
 * This class manages:
 * - Core services via IServiceContainer (settings, checkpoints, sessions, costs)
 * - Token counting and context management
 * - Agent modes and sandbox security
 * - MCP servers and plugins
 * - Memory system
 * - Model routing optimization
 */
export declare class AgentInfrastructure extends EventEmitter {
    private readonly deps;
    private readonly config;
    private _memory;
    private _lastRoutingDecision;
    constructor(deps: AgentInfrastructureDeps, config?: AgentInfrastructureConfig);
    /** Settings manager */
    get settings(): import("../../infrastructure/types.js").ISettingsManager;
    /** Checkpoint manager */
    get checkpoints(): import("../../infrastructure/types.js").ICheckpointManager;
    /** Session store */
    get sessions(): import("../../infrastructure/types.js").ISessionStore;
    /** Cost tracker */
    get costs(): import("../../infrastructure/types.js").ICostTracker;
    /** Token counter */
    get tokenCounter(): TokenCounter;
    /** Context manager */
    get contextManager(): ContextManagerV2;
    /** Mode manager */
    get modeManager(): AgentModeManager;
    /** Sandbox manager */
    get sandboxManager(): SandboxManager;
    /** MCP client */
    get mcpClient(): MCPClient;
    /** Prompt cache manager */
    get promptCacheManager(): PromptCacheManager;
    /** Hooks manager */
    get hooksManager(): HooksManager;
    /** Moltbot hooks manager (intro, session persistence, command logging) */
    get moltbotHooksManager(): MoltbotHooksManager;
    /** Model router */
    get modelRouter(): ModelRouter;
    /** Plugin marketplace */
    get marketplace(): PluginMarketplace;
    /** Repair coordinator */
    get repairCoordinator(): RepairCoordinator;
    /**
     * Lazy-loaded memory system
     */
    get memory(): EnhancedMemory;
    /** Check if memory is enabled */
    get memoryEnabled(): boolean;
    /** Enable/disable memory */
    setMemoryEnabled(enabled: boolean): void;
    /**
     * Store a memory entry
     */
    remember(type: MemoryType, content: string, options?: {
        summary?: string;
        importance?: number;
        tags?: string[];
        metadata?: Record<string, unknown>;
    }): Promise<MemoryEntry>;
    /**
     * Recall memories matching a query
     */
    recall(query?: string, options?: {
        types?: MemoryType[];
        tags?: string[];
        limit?: number;
        minImportance?: number;
    }): Promise<MemoryEntry[]>;
    /**
     * Build memory context for system prompt
     */
    getMemoryContext(options?: MemoryContextOptions): Promise<string>;
    /**
     * Store conversation summary
     */
    storeConversationSummary(sessionId: string, summary: string, topics: string[], messageCount: number, decisions?: string[]): Promise<void>;
    /**
     * Get memory stats
     */
    getMemoryStats(): {
        totalMemories: number;
        byType: Record<string, number>;
        projects: number;
        summaries: number;
    } | null;
    /**
     * Format memory status
     */
    formatMemoryStatus(): string;
    /** Check if model routing is enabled */
    get useModelRouting(): boolean;
    /** Enable/disable model routing */
    setModelRouting(enabled: boolean): void;
    /** Get last routing decision */
    get lastRoutingDecision(): RoutingDecision | null;
    /** Set last routing decision */
    setLastRoutingDecision(decision: RoutingDecision): void;
    /**
     * Get model routing statistics
     */
    getModelRoutingStats(): {
        enabled: boolean;
        totalCost: number;
        savings: {
            saved: number;
            percentage: number;
        };
        usageByModel: {
            [k: string]: {
                calls: number;
                tokens: number;
                cost: number;
            };
        };
        lastDecision: RoutingDecision | null;
    };
    /**
     * Format model routing stats
     */
    formatModelRoutingStats(): string;
    /**
     * Dispose of all resources
     */
    dispose(): Promise<void>;
}
/**
 * Create AgentInfrastructure with default implementations
 *
 * This factory uses the Service Locator pattern internally but returns
 * a properly encapsulated AgentInfrastructure instance.
 */
export declare function createAgentInfrastructure(apiKey: string, model: string, baseURL?: string, config?: AgentInfrastructureConfig): Promise<AgentInfrastructure>;
/**
 * Create AgentInfrastructure for testing with mock dependencies
 */
export declare function createTestInfrastructure(overrides?: Partial<AgentInfrastructureDeps>, config?: AgentInfrastructureConfig): AgentInfrastructure;
/**
 * Create AgentInfrastructure synchronously using singleton getters
 *
 * This is the preferred factory for use in constructors where async
 * initialization isn't possible. Uses the same sync singleton patterns
 * that were previously scattered throughout CodeBuddyAgent.
 */
export declare function createAgentInfrastructureSync(options: {
    apiKey: string;
    model: string;
    baseURL?: string;
    maxContextTokens?: number;
}, config?: AgentInfrastructureConfig): AgentInfrastructure;
