@agents-js/a2ui-host
v0.4.0
Published
Browser-side A2UI v0.9 host and bridge for agents-js.
Readme
@agents-js/a2ui-host
Browser-side A2UI v0.9 host and bridge for agents-js.
Installation
bun add @agents-js/a2ui-hostAPI
Classes
A2uiBridge— Wires an {A2uiHost} onto a transport. The bridge owns no host state of its own — it is pure glue.A2uiHost— Renders a liveSurfaceGroupModelinto a DOM mount point, applying A2UI lifecycle messages as they arrive.SurfaceSession
Functions
createA2uiToolCallContentHandlercreateBridgeSurfaceAdapter— Build a {HostSurfaceAdapter} that forwards every incoming A2UI lifecycle message through the given bridge. Pass the returned adapter intocreateA2uiToolCallContentHandler({ surfaceAdapter })and ...
Interfaces
A2uiBridgeOptions— Options for constructing an {A2uiBridge}.A2uiHostOptions— Options for constructing an {A2uiHost}.CreateA2uiToolCallContentHandlerOptionsHostSurfaceAdapterSurfaceEventSink— Minimal shape of a sink that can ferry surface events back to the agent. The<P>generic narrows the payload envelope. Consumers that know their wire contract at the wiring site can narrow once h...SurfaceSessionOptions
Types
A2uiHostEventHandler— Callback invoked when a rendered ACP primitive emits an action. The<P>generic narrows the surface-event payload envelope so consumers that know their wire contract can typecheck payloads end-to...SurfaceRenderer— Renderer function matchingrenderSurfacefrom-js/a2ui-renderer. Injected so the host module stays renderer-agnostic (and unit-testable without a DOM-capablelitimport chain). The renderer's...
Exports
type SurfaceSessionOptions
Dependencies
@agentclientprotocol/sdk@agents-js/acp-host
Peer Dependencies
@agents-js/a2ui-types@agents-js/ui-components@agents-js/validationlit
License
MIT
