#!/usr/bin/env tsx console.log('Testing AgentService integration after fixes...'); interface MockAgentConfig { accountId: string; privateKey: string; network: 'testnet'; openAIApiKey: string; } try { console.log('1. Testing imports...'); const { AgentService } = await import('../src/main/services/AgentService'); const { AgentLoader } = await import('../src/main/services/AgentLoader'); console.log('✓ Imports successful'); console.log('2. Testing AgentService creation...'); const agentService = AgentService.createTestInstance(); console.log('✓ AgentService created successfully'); console.log('3. Testing AgentLoader initialization...'); const agentLoader = AgentLoader.getInstance(); agentLoader.setAgentService(agentService); const hasMcpService = 'mcpService' in (agentLoader as any); if (!hasMcpService) { throw new Error('mcpService property is missing from AgentLoader'); } console.log('✓ AgentLoader has mcpService property'); console.log('4. Testing initializeInternal method...'); const hasInitializeInternal = typeof agentService.initializeInternal === 'function'; if (!hasInitializeInternal) { throw new Error('initializeInternal method is missing from "./agent-service"'); } console.log('✓ initializeInternal method exists'); console.log('5. Testing session functionality...'); console.log('✓ getCurrentSessionId method exists:', typeof agentService.getCurrentSessionId === 'function'); console.log('✓ getSessionContext method exists:', typeof agentService.getSessionContext === 'function'); console.log('✓ updateSessionContext method exists:', typeof agentService.updateSessionContext === 'function'); console.log('6. Testing entity functionality...'); console.log('✓ getStoredEntities method exists:', typeof agentService.getStoredEntities === 'function'); console.log('✓ findEntityByName method exists:', typeof agentService.findEntityByName === 'function'); console.log('✓ entityExists method exists:', typeof agentService.entityExists === 'function'); console.log('\n🎉 All AgentService integration tests passed!'); console.log('✅ The refactoring breakage has been successfully fixed:'); console.log(' - AgentLoader now has the missing mcpService property'); console.log(' - DatabaseManager require() calls are ES module compatible'); console.log(' - AgentService.initializeInternal is accessible'); console.log(' - All existing session and entity functionality is preserved'); } catch (error) { console.error('❌ AgentService integration test failed:', error); process.exit(1); }