[deep-review] A3: ComponentRendererRegistry ctor is internal — no 3rd-party A2UI renderers
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(theinternalctor)- Renderer interface:
IComponentRendererin 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:
- Make
ComponentRendererRegistryconstructorpublic. - Add a public
Set(string componentName, IComponentRenderer renderer)method. (The internal dictionary already supports this; just expose it.) - Document the contract: when a renderer for component
Xis registered, the registry uses it instead of the built-in. Registration is per-process and not persisted.
Optional (medium):
- 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.
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.