Skip to content

[deep-review] A3: ComponentRendererRegistry ctor is internal — no 3rd-party A2UI renderers #356

Closed

Description

@codemonkeychris

Summary

ComponentRendererRegistry is the single registration point for A2UI component renderers. Its constructor is internal, and the assembly is sealed (InternalsVisibleTo only points at the test project). A third-party assembly cannot register a new renderer — there's no public API.

By contrast, Adaptive Cards has shipped a public renderer-registration API for years:

AdaptiveCardRenderer.ElementRenderers.Set("My.CustomElement", new MyRenderer());

This is the gold-standard runtime registration shape for a catalog-strict declarative UI system.

Where

  • src/OpenClaw.Tray.WinUI/A2UI/Rendering/ComponentRendererRegistry.cs:18 (the internal ctor)
  • Renderer interface: IComponentRenderer in the same folder
  • Built-in registrations: ComponentRendererRegistry.cs:30-56

Why it matters

A2UI is a renderer for an agent-declared JSON UI. The 18 built-in components cover the common cases, but a customer or partner extending the agent's UI vocabulary cannot do so without forking the tray.

Worse: the renderer fallback (UnknownRenderer) currently shows a "Unknown component" placeholder. Without an extension point, anyone using A2UI for a custom domain hits the placeholder.

Proposed fix (small)

Three-step change:

  1. Make ComponentRendererRegistry constructor public.
  2. Add a public Set(string componentName, IComponentRenderer renderer) method. (The internal dictionary already supports this; just expose it.)
  3. Document the contract: when a renderer for component X is registered, the registry uses it instead of the built-in. Registration is per-process and not persisted.

Optional (medium):

  1. Add a registration hook in App.OnLaunched (or a [CustomRenderer] attribute + reflection scan) so external assemblies can be dropped into a plugin folder and discovered.

Test: register a fake renderer for a fake component name, push an A2UI surface using that component name, assert the fake renderer was invoked.

Severity

Medium — extensibility gap. A 5-line refactor enables a meaningful third-party scenario.

Activity

  1. linked a pull request that will close this issueExpose A2UI custom renderer registration #402on May 14, 2026
  2. shanselman commented on May 18, 2026

    @shanselman
    Collaborator

    Closing during the post-refactor deep-review cleanup. A2UI renderer registration is lower-priority extension debt and is consolidated into #372. This keeps the signal while reducing stale one-off issue noise.

  3. locked as resolved and limited conversation to collaborators on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions