UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

103 lines 3.99 kB
/** * Server startup utilities including migration * * ARCHITECTURE NOTES - Memory Auto-Load Implementation: * * There are two valid architectural approaches for memory auto-load: * * 1. MemoryManager.loadAndActivateAutoLoadMemories() (CURRENT IMPLEMENTATION) * - Auto-load logic lives in MemoryManager * - Called directly from Container.preparePortfolio() * - Follows DI pattern: managers own all operations for their element type * - Pros: Better encapsulation, clearer ownership, no duplicated responsibility * - Used by: Container.preparePortfolio() (current production approach) * * 2. ServerStartup.initializeAutoLoadMemories() (ALTERNATIVE APPROACH) * - Auto-load orchestrated by ServerStartup * - ServerStartup delegates to MemoryManager for actual operations * - Useful for: Complex startup sequences with multiple coordinated steps * - Pros: Centralizes startup concerns, easier to add cross-cutting features * - Used by: This class (kept for future use and alternative workflows) * * Both approaches are valid and maintained. Choose based on your needs: * - Use MemoryManager directly for simple, focused auto-load * - Use ServerStartup for complex orchestration with multiple startup phases * * See docs/architecture/memory-autoload-architectures.md for detailed comparison. */ import { PortfolioManager, ElementType } from '../portfolio/PortfolioManager.js'; import { MigrationManager } from '../portfolio/MigrationManager.js'; import { FileLockManager } from '../security/fileLockManager.js'; import { MemoryManager } from '../elements/memories/MemoryManager.js'; import { ConfigManager } from '../config/ConfigManager.js'; import { OperationalTelemetry } from '../telemetry/OperationalTelemetry.js'; export interface StartupOptions { skipMigration?: boolean; autoBackup?: boolean; } export declare class ServerStartup { private portfolioManager; private migrationManager; private fileLockManager; private memoryManager; private configManager; private operationalTelemetry; constructor(portfolioManager: PortfolioManager, fileLockManager: FileLockManager, configManager: ConfigManager, migrationManager: MigrationManager, memoryManager: MemoryManager, operationalTelemetry: OperationalTelemetry); /** * Initialize server with migration check */ initialize(options?: StartupOptions): Promise<void>; /** * Process a single auto-load memory * FIX (SonarCloud): Extracted to reduce cognitive complexity * FIX (SonarCloud): Reduced parameter count by using options object * @private */ private processAutoLoadMemory; /** * Handle errors during auto-load memory processing * FIX (SonarCloud): Extracted to reduce cognitive complexity * @private */ private handleAutoLoadMemoryError; /** * Check and log size warnings for a memory * @private */ private checkMemorySizeWarnings; /** * Check if memory should be skipped due to budget limits * @private */ private shouldSkipMemory; /** * Log error recovery suggestions based on error type * @private */ private logAutoLoadErrorSuggestions; /** * Initialize auto-load memories * Issue #1430: Automatically load baseline memories on server startup * @private */ private initializeAutoLoadMemories; /** * Get migration status without performing migration */ getMigrationStatus(): Promise<{ hasLegacyPersonas: boolean; legacyPersonaCount: number; portfolioExists: boolean; portfolioStats: Record<ElementType, number>; }>; /** * Get the personas directory path for legacy compatibility */ getPersonasDir(): string; /** * Dispose of resources and cleanup * Cleans up managers and telemetry to prevent open handles */ dispose(): Promise<void>; } //# sourceMappingURL=startup.d.ts.map