npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@a2ui-adaptive/react

v0.1.0

Published

A2UI runtime + AppCatalog React components: renderer, streaming client, validation, and the full domain component catalog.

Readme

@a2ui-adaptive/react

A2UI runtime for React: a streaming client, message validator, JSON-pointer data binding, and the full AppCatalog domain components (weather, news, shopping, movies, travel, finance, invoices and more), wrapped in a ready-to-use canvas.

The backend is a separate service. Point this package at it with setBackendBaseUrl and stream intents over SSE.

Install

npm install @a2ui-adaptive/react react react-dom zustand

react >= 18, react-dom >= 18, and zustand ^5 are peer dependencies. Everything else is bundled.

Quick start

import { A2uiCanvas, streamIntent, setBackendBaseUrl } from "@a2ui-adaptive/react";
import "@a2ui-adaptive/react/styles.css"; // required once

setBackendBaseUrl("http://localhost:8000"); // default; points at the A2UI backend

function App() {
  return <A2uiCanvas />;
}

// On submit:
const result = await streamIntent("Show popular movies", { /* userContext */ });
if (result.error) console.error(result.error);

streamIntent POSTs to {backendUrl}/api/stream, streams the A2UI messages into the store via applyMessage, and the canvas re-renders automatically.

API

Canvas

  • A2uiCanvas({ surfaceId?, className? }) — renders the most recent surface (or a specific one by id) using A2UIRenderer plus AppCatalog.
  • A2UIRenderer — lower-level renderer component; used internally by A2uiCanvas.

Streaming

  • streamIntent(text, userContext, history?){ domain, surfaceId, error, routing } — streams an intent to the backend. history is { role, content, state? }[] for multi-turn conversations.
  • setBackendBaseUrl(url) / getBackendBaseUrl() / backendUrl(path) — configure the backend origin.

Actions & validation

  • dispatchAction(comp, surfaceId, data, index?) — runs a component's action: local functionCalls (changeTab, toggleCompare, clearCompare) are executed in-app; events are POSTed to {backendUrl}/api/handle-action.
  • validateMessage(msg) / CatalogError — validate an A2UI message against COMPONENT_NAMES/LOCAL_FUNCTIONS before applying.

Data binding

  • getPointer(data, path) / setPointer(data, path, value) / parsePointer(path) — JSON-pointer helpers used for component bindings.
  • JsonPointerError — thrown on malformed pointers.

State & catalog

  • useA2UIStore — zustand store. useA2UIStore.getState().applyMessage(msg) applies raw A2UI messages; beginTurn(), patchData(surfaceId, path, value) are also available.
  • AppCatalogRecord<componentName, { component }>; extend or replace it to add custom components.
  • CATALOG_ID, COMPONENT_NAMES, LOCAL_FUNCTIONS — catalog metadata used by validation.

Types

  • A2UIMessage, CreateSurface, UpdateComponents, UpdateDataModel, SurfaceState, Bound, StreamResult, RoutingState.

Custom components

AppCatalog maps A2UI component names to React components. It is a plain exported object, so register your own components directly:

import { AppCatalog } from "@a2ui-adaptive/react";

function MyWidget(props: Record<string, unknown>) {
  return <div>MyWidget</div>;
}

AppCatalog.MyWidget = { component: MyWidget };

Update the backend's catalog (e.g. backend/app/a2ui/catalogs/AppCatalog.json) and COMPONENT_NAMES so the agent knows the component exists and validation accepts it.

Styles

The package ships compiled Tailwind CSS as dist/styles.css. Import @a2ui-adaptive/react/styles.css once in your app entry. If you use a different styling system, the components still work; only the Tailwind utility classes are missing.

Development

npm run build      # vite lib build → dist/{a2ui-react.js, a2ui-react.umd.cjs, styles.css, index.d.ts}
npm run typecheck  # tsc --noEmit