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:

  1. Direct injection PreviewService → StudioGenerationListenerService (circular DI)
  2. New dedicated SSE channel for mutations (unnecessary infrastructure)
  3. 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


🔗 Related


Auto-generated by MCP Smart Consolidation