Prometheus Entity Management API
    Preparing search index...

    Class SurfaceModel<T, F>

    State model for a single UI surface.

    Coordinates data binding, component state, and action dispatching.

    Type Parameters

    • T extends ComponentApi = ComponentApi

      Concrete type of the ComponentApi from the catalog.

    • F extends FunctionApi = FunctionImplementation

      The catalog's function kind. Every state and messaging capability of the surface works with a schema-only catalog (SurfaceModel<T, FunctionApi>); only node-tree resolution needs implementations.

    Index
    • Initializes a new SurfaceModel instance.

      Type Parameters

      • T extends ComponentApi<ZodTypeAny> = ComponentApi<ZodTypeAny>

        Concrete type of the ComponentApi from the catalog.

      • F extends FunctionApi = FunctionImplementation

        The catalog's function kind. Every state and messaging capability of the surface works with a schema-only catalog (SurfaceModel<T, FunctionApi>); only node-tree resolution needs implementations.

      Parameters

      • id: string

        Unique identifier for this surface.

      • defaultCatalog: Catalog<T, F>

        Catalog that resolves components and functions that do not name a catalog explicitly.

      • OptionalavailableCatalogs: ReadonlyMap<string, Catalog<T, F>> | null

        Every catalog a payload on this surface may select by catalogId, keyed by that identifier. The message processor populates it with the catalogs whose protocol version is compatible with the surface's own.

      • Optionaltheme: any

        Theme to apply to this surface.

      • OptionalsendDataModel: boolean

        Whether the renderer sends the full data model with actions.

      • OptionaldataModel: DataModel

        Optional custom DataModel instance. If provided, the SurfaceModel assumes full ownership of its lifecycle and will dispose it when dispose() is called.

      • OptionalrootId: string

        Identifier of the root component on this surface (defaults to 'root').

      Returns SurfaceModel<T, F>

    availableCatalogs: ReadonlyMap<string, Catalog<T, F>>

    Catalogs available to this surface, keyed by catalog ID.

    Payloads on this surface may select any of these catalogs by catalogId. Includes the surface's defaultCatalog under its identifier.

    componentsModel: SurfaceComponentsModel

    Collection of component models for this surface.

    dataModel: DataModel

    Data model for this surface.

    defaultCatalog: Catalog<T, F>

    Catalog that resolves components and functions that do not name a catalog explicitly.

    id: string
    onAction: EventSource<ActionPayload>

    Event source firing whenever an action is dispatched from this surface.

    onError: EventSource<A2uiErrorPayload>

    Event source firing whenever an error occurs on this surface.

    onWarning: EventSource<A2uiWarningPayload>

    Event source firing whenever a non-fatal warning occurs on this surface.

    rootId: string

    Identifier of the root component on this surface (defaults to 'root').

    sendDataModel: boolean
    theme: any
    • get catalog(): Catalog<T, F>

      The surface's default catalog.

      Returns Catalog<T, F>

      Use defaultCatalog. Renamed for symmetry with the other SDKs now that a surface can carry more than one catalog. This alias will be removed in a future release.

    • Dispatches an action from this surface to registered listeners.

      Resolves event action payload details, propagates any explicit catalogId, and emits an ActionPayload via onAction. Local function actions (functionCall) are executed locally and are not emitted as agent actions.

      Parameters

      • payload: any

        Action payload (name and context) to dispatch.

      • sourceComponentId: string

        Identifier of the component that triggered the action.

      Returns Promise<void>

      A promise that resolves once all registered listeners have processed the action.

    • Dispatches an error from this surface to registered listeners.

      Parameters

      • error: A2uiErrorPayload

        Error payload to dispatch, conforming to the renderer-to-agent schema.

      Returns Promise<void>

      A promise that resolves once all registered listeners have processed the error.

    • Dispatches a non-fatal warning from this surface to registered listeners.

      Parameters

      • warning: A2uiWarningPayload

        The warning payload to dispatch.

      Returns Promise<void>

      Promise that resolves once listeners have handled the warning.

    • Disposes the surface, data model, components, and event emitters.

      Returns void