MessageGenerativeUi

Unpublished development API. This package is under development and is not available as a published release.

Turns on generated UI inside the transcript. Each part is separate: an assistant message is rendered as a surface only for the kinds configured here, and every other message keeps its Markdown.

import type { MessageGenerativeUi } from '@threadplane/react/chat';

Declaration

export interface MessageGenerativeUi  {
  readonly fallback?: ComponentType<RenderViewProps>;
  readonly functions?: ReactRenderFunctions;
  readonly handlers?: ReactRenderHandlers;
  readonly onRenderEvent?: (event: MessageRenderEvent) => void;
  readonly registry?: ReactRenderRegistry;
  readonly renderA2ui?: (content: MessageA2uiContent) => ReactNode;
  readonly skeletonLabel?: string;
  readonly store?: RenderStore;
}

Members

fallback

Rendered for a spec component the registry lacks; see RenderSpecProps.fallback.

readonly fallback?: ComponentType<RenderViewProps>;

functions

Computed functions for spec props; see RenderSpecProps.functions.

readonly functions?: ReactRenderFunctions;

handlers

Actions a spec's on bindings may run; see RenderSpecProps.handlers. A binding that names an action missing here does nothing. Setting this makes spec trees interactive: views get emit, and set to write state.

readonly handlers?: ReactRenderHandlers;

onRenderEvent

Notified when a spec's action runs, its state changes, or a view reports a result.

readonly onRenderEvent?: (event: MessageRenderEvent) => void;

registry

Views by component name. With it, an assistant message whose content is a json-render spec ({ "root": …, "elements": … }) renders as that tree in place of its text. Elements appear as each one finishes streaming, and a placeholder stands in until the root element has. The tree is read-only unless handlers, store or onRenderEvent is set.

readonly registry?: ReactRenderRegistry;

renderA2ui

Renders an assistant message whose content starts with the ---a2ui_JSON--- marker, in place of its text. The application parses the envelopes, accumulates the surfaces and renders them, for example with A2uiSurface; return content.skeleton until one is ready.

readonly renderA2ui?: (content: MessageA2uiContent) => ReactNode;

skeletonLabel

Placeholder text while a surface is being built. Defaults to "Building UI…".

readonly skeletonLabel?: string;

store

One state owner shared by every spec in the transcript, in place of each spec's own state. Without it, an interactive spec keeps state of its own, seeded from its state and dropped with its row.

readonly store?: RenderStore;