Skip to content

Conversation

@abalmush
Copy link

Summary

#195

  • Extract framework-agnostic data processing, types, guards, and message handling from @a2ui/lit into a new @a2ui/core package
  • Enable React, Vue, and other framework developers to integrate A2UI without reimplementing core functionality
  • Maintain backwards compatibility by re-exporting core types from @a2ui/lit and @a2ui/angular

Problem

External developers who want to integrate A2UI with their existing component libraries (React, Vue, or custom design systems) currently have to rebuild core functionality from scratch. The data processing, path resolution, and message handling logic lives inside @a2ui/lit, which means:

  • React teams must reimplement A2uiMessageProcessor and all the JSON Pointer utilities
  • Vue teams do the same
  • Anyone not using Lit or Angular starts from zero

Solution

Create a new @a2ui/core package containing:

Export Description
A2uiMessageProcessor Processes server-to-client messages, manages surfaces and data model
Types All A2UI component types (Text, Button, Card, etc.)
Primitives StringValue, NumberValue, BooleanValue types
Guards Runtime type checking functions (isResolvedText, isResolvedButton, etc.)
Events Event type definitions

Changes

New package: renderers/core/

  • src/processor/model-processor.ts - Message processor implementation
  • src/types/ - All type definitions
  • src/guards/ - Type guard functions
  • src/events/ - Event definitions

Modified: renderers/lit/

  • Now depends on @a2ui/core
  • Re-exports core types for backwards compatibility
  • Removed duplicated code (~1800 lines)

Modified: renderers/angular/

  • Now depends on @a2ui/core
  • Added @a2ui/core to allowedNonPeerDependencies

@google-cla
Copy link

google-cla bot commented Jan 22, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a great refactoring that extracts the framework-agnostic logic into a new @a2ui/core package. This will significantly improve reusability for other frameworks. The new package is well-structured and comes with a comprehensive test suite.

My review focuses on the new core logic and I've identified a few areas for improvement:

  • A potential bug in a regex used for path resolution.
  • An inconsistency between a type definition and its corresponding type guard.
  • Opportunities to refactor repetitive code and clarify the public API of the new package.

Overall, this is a solid piece of work. Addressing these points will improve the robustness and maintainability of the new core package.

Extract the data processing, type definitions, guards, and message
handling logic from @a2ui/lit into a new @a2ui/core package. This
enables React, Vue, and other framework developers to integrate A2UI
without reimplementing core functionality.

The new @a2ui/core package includes:
- A2uiMessageProcessor for processing server-to-client messages
- Type definitions for all A2UI components and primitives
- Type guards for runtime type checking
- Event type definitions

The @a2ui/lit and @a2ui/angular packages now depend on @a2ui/core
and re-export its types for backwards compatibility.
- Fix regex path stripping: escape dot and simplify replacement chain
- Refactor buildNodeRecursive: replace switch with type guard map
- Fix ResolvedCard: use union type for mutually exclusive properties
- Consolidate exports: remove duplicate top-level exports, keep namespaces
@abalmush abalmush force-pushed the abalmus/feature/extract-core-package branch from 6dfefc7 to 5169383 Compare January 22, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant