A2uiCoreMessageProcessor


class A2uiCoreMessageProcessor : A2uiMessageProcessor


The central orchestration engine for the A2UI core data layer.

It receives parsed protocol messages from the host application, routes them to the appropriate sequential A2uiCoreSurfaceActor, and exposes the outbound network events back to the host framework.

Summary

Public constructors

A2uiCoreMessageProcessor(
    catalogs: List<A2uiCoreCatalog>,
    dataModelFactory: () -> A2uiCoreDataModel,
    componentRegistryFactory: () -> A2uiCoreComponentRegistry,
    actionInterceptors: List<A2uiActionInterceptor>
)

Public functions

open suspend Unit

Continuously consumes the inbound message queue and routes messages to surface actors.

open Unit

Enqueues a client error message to be transmitted back to the server via outboundEvents.

open Unit

Enqueues a parsed protocol message to be processed by the core engine.

Public properties

open StateFlow<List<A2uiSurfaceModel>>

A flow of the list of active surface ids currently managed by the processor.

A2uiClientCapabilities

The client capabilities supported by this processor instance, derived from the registered catalogs.

open Flow<A2uiClientToServerMessage>

A flow of user actions and error payloads to be transmitted to the server.

Public constructors

A2uiCoreMessageProcessor

A2uiCoreMessageProcessor(
    catalogs: List<A2uiCoreCatalog>,
    dataModelFactory: () -> A2uiCoreDataModel,
    componentRegistryFactory: () -> A2uiCoreComponentRegistry,
    actionInterceptors: List<A2uiActionInterceptor> = emptyList()
)
Parameters
catalogs: List<A2uiCoreCatalog>

The list of available component catalogs.

dataModelFactory: () -> A2uiCoreDataModel

Factory for creating new instances of A2uiCoreDataModel.

componentRegistryFactory: () -> A2uiCoreComponentRegistry

Factory for creating new instances of A2uiCoreComponentRegistry.

actionInterceptors: List<A2uiActionInterceptor> = emptyList()

A list of A2uiActionInterceptor instances to intercept UI actions.

Public functions

collectMessages

Added in 1.0.0-alpha01
open suspend fun collectMessages(): Unit

Continuously consumes the inbound message queue and routes messages to surface actors.

This function must be launched within the host application's lifecycle scope (e.g., a ViewModel scope). When the scope is cancelled, this loop and all child surface actors are naturally terminated.

processError

Added in 1.0.0-alpha01
open fun processError(error: A2uiClientErrorMessage): Unit

Enqueues a client error message to be transmitted back to the server via outboundEvents.

Parameters
error: A2uiClientErrorMessage

The client error message to transmit.

processMessage

Added in 1.0.0-alpha01
open fun processMessage(message: A2uiServerToClientMessage): Unit

Enqueues a parsed protocol message to be processed by the core engine.

This method is safe to call from any thread.

Public properties

activeSurfaces

Added in 1.0.0-alpha01
open val activeSurfacesStateFlow<List<A2uiSurfaceModel>>

A flow of the list of active surface ids currently managed by the processor.

clientCapabilities

Added in 1.0.0-alpha01
val clientCapabilitiesA2uiClientCapabilities

The client capabilities supported by this processor instance, derived from the registered catalogs. Host applications can query this directly during system initialization to send to the agent.

outboundEvents

Added in 1.0.0-alpha01
open val outboundEventsFlow<A2uiClientToServerMessage>

A flow of user actions and error payloads to be transmitted to the server.