-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Summary
Identify and resolve circular dependencies that require dynamic imports.
Current Problem
- Line 201 in LineHandlers.js uses dynamic import to break circular dependency:
const { getKeychainService } = await import('../../services/keychainService.js');
- AgentRouter instantiates ResolutionIntelligence and ContactUnifier internally
- MatterAgent instantiates ContextFusionEngine internally
- These patterns create tight coupling and make testing difficult
Implementation
Strategy
- Extract shared interfaces - Create interface files that both modules can depend on
- Use events - Decouple cross-service communication via EventBus
- Use DI - Inject dependencies instead of importing/instantiating
- Lazy initialization - Defer dependency resolution where needed
Files to Analyze
src/ipc/handlers/LineHandlers.js- Dynamic import workaroundsrc/services/agents/AgentRouter.js- Internal instantiationsrc/services/agents/MatterAgent.js- Internal instantiation
Tasks
- Audit all dynamic imports in codebase
- Extract shared interfaces
- Refactor to use EventBus for cross-service communication
- Replace dynamic imports with proper DI
- Update dependency graph documentation
Reactions are currently unavailable