Infrastructure

Architectural Context

The Infrastructure Layer within the MILTON.DocumentGenerator service isolates external dependencies, I/O concerns, and outbound integrations from the pure business logic contained within the Cores and Sagas.

In a system governed by Wolverine sagas and pure AI orchestration cores, the infrastructure folder provides the specific adapters that bridge internal abstractions with physical transport layers.

Intent and Architecture

The primary responsibility of the Infrastructure layer currently is to broker real-time communication back to the user via Notifications. The Document Generator runs entirely asynchronously in the background. As sagas progress, generate LLM results, and spawn new blocks, the system needs to emit live telemetry to the user.

graph TD
    subgraph DocumentGenerator
        Saga[DocumentProcessingSaga]
        Core[AI Generation Core]
        Notifier[IUserNotifier Implementation]
    }
    
    Saga -->|Emits Status| Notifier
    Core -->|Emits Progress| Notifier
    
    subgraph Infrastructure Boundary
        Notifier -->|Wolverine Messages| RabbitMQ[(RabbitMQ)]
    end
    
    RabbitMQ -->|Consumes| NotificationService[MILTON.NotificationService]
    NotificationService -->|SignalR| Client((Web Client))
  • Notifications: Contains the infrastructure bindings for dispatching live user updates. Implementations here implement core interfaces (e.g., IUserNotifier) and translate internal domain status updates into Wolverine messages bound for the MILTON.NotificationService.

Strict Abstraction Rules

Code located within the pure generation cores or the orchestrating sagas must never reference specific RabbitMQ mechanisms or SignalR concepts directly. Instead, they interact entirely via abstract interfaces provided by this Infrastructure layer. This ensures that the Document Generator remains decoupled from the specific real-time delivery mechanism used by the wider MILTON ecosystem.