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:

  1. Keep interface in universe-canvas
  2. Move shared interface to core-angular + truly lazy imports
  3. Use separate interfaces per tool
  4. 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


🔗 Related


Auto-generated by MCP Smart Consolidation