Architecture: How to resolve circular dependency between universe-canvas a...
Documentation for Sessions
🏗️ Architecture: How to resolve circular dependency between universe-canvas a...
📋 Decision Context
Question:
How to resolve circular dependency between universe-canvas and vibe-universe?
Task: Fix circular dependency in unified builder
🎯 Decision Made
Chosen:
Move shared interface to core-angular + truly lazy imports
Options Considered:
- Keep interface in universe-canvas
- Move shared interface to core-angular + truly lazy imports
- Use separate interfaces per tool
- Remove dynamic loading
💭 Reasoning
Circular dependency occurred because: (1) universe-canvas/unified-builder imported from vibe-universe (ToolOrchestrationService), (2) vibe-universe-embeddable imported EmbeddableTool from universe-canvas. Fixed by: (1) Moving EmbeddableTool interface from universe-canvas/types to core-angular/types - this is the proper shared location for cross-library contracts. (2) Converting TOOL_COMPONENTS object literal with arrow functions to getToolComponent() method - this makes imports TRULY lazy (evaluated at call time, not module load time). (3) Updating all embeddables to import from @libs-foundational/core-angular instead of @libs-space/universe-canvas. Result: Zero circular dependencies, proper separation of concerns (contracts in core, implementations in features), dynamic imports don't block module evaluation.
📁 Files Involved
libs/libs-foundational/core-angular/src/lib/types/embeddable-tool.interface.tslibs/libs-space/universe-canvas/src/lib/components/unified-builder/unified-builder.component.ts
🔗 Related
- Decision ID:
dev_1768002891023_8fi4872 - Session: 35
- Workspace: editor2
Auto-generated by MCP Smart Consolidation