Architecture: How should the PhaseOrchestrator SSE output reach the fronte...

Documentation for Sessions

🏗️ Architecture: How should the PhaseOrchestrator SSE output reach the fronte...

Date: 2026-02-06
Time: 02:18:31 UTC
Session: editor2-95.4
Agent: backend
Confidence: 92%
Status: ✅ Documented


📋 Decision Context

Question:

How should the PhaseOrchestrator SSE output reach the frontend Module Workbench?

Task: P0-A: Wire PhaseOrchestrator → adapter → API → frontend


🎯 Decision Made

Chosen:

Enrich the orchestration_complete SSE event with full moduleContext + generatedFiles inline. Also add 3 REST endpoints (GET /modules/:id/context, GET /modules/:id/files, GET /modules/recent) as fallback. Create AIModuleReceiverService on frontend that handles both inline and fetch-based reception, saves to ModuleStorageService, exposes lastReceivedModuleId signal.

Options Considered:

  1. Enrich SSE + REST fallback + dedicated receiver service
  2. WebSocket push only
  3. Polling from frontend

💭 Reasoning

The SSE event already fires but was empty. By enriching it with the adapted ModuleContext inline, the frontend can process it immediately without a second round-trip. The REST endpoints serve as fallback for page reloads, loading recent modules, and the case where the SSE event was missed. The AIModuleReceiverService decouples the SSE transport from the Workbench UI — it handles reception, persistence, and signaling independently.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation