Architecture: How should Studio receive and handle Vitto-generated PE muta...
Documentation for Sessions
🏗️ Architecture: How should Studio receive and handle Vitto-generated PE muta...
Date: 2026-03-25
Time: 21:48:10 UTC
Session: gspace1-270.7
Agent: angular
Confidence: 92%
Status: ✅ Documented
📋 Decision Context
Question:
How should Studio receive and handle Vitto-generated PE mutations via SSE?
Task: S270 Platform Elements Evolution
🎯 Decision Made
Chosen:
StudioGenerationListenerService handles tool.called events where tool=platform_elements_edit. Parsed mutations are emitted on a peMutations$ Subject (decoupled from PreviewService to avoid circular DI). PreviewService subscribes in constructor, applies to DOMParser source doc, and updates peSourceHtml. Mutations sent to iframe via PreviewBridgeService.sendPviMessage().
Options Considered:
- Direct injection PreviewService → StudioGenerationListenerService (circular DI)
- New dedicated SSE channel for mutations (unnecessary infrastructure)
- Subject pattern decoupling with peMutations$ (chosen — follows existing pattern, no circular DI)
💭 Reasoning
Direct injection of PreviewService into StudioGenerationListenerService would create circular DI (PreviewService already injects StudioGenerationListenerService). The Subject pattern follows the existing convention — platformElementsHtml$ and filesReadyForReview$ already use this decoupling pattern in the same service. The iframe receives mutations via the existing postMessage infrastructure — the mutation receiver (auto-installed by editor.ts) handles PE_APPLY_MUTATIONS messages. No new SSE channels or WebSocket connections needed.
📁 Files Involved
libs/libs-structural/vitto-studio/src/lib/services/studio-generation-listener.service.tslibs/libs-structural/vitto-studio/src/lib/services/preview.service.tslibs/libs-structural/platform-preview/src/lib/services/preview-bridge.service.ts
🔗 Related
- Decision ID:
dev_1774475290697_zali0u4 - Session: 270
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation