Repository navigation
Conversation
… overlay components
…components and export standardCatalog
… LangGraph agents
… stop nested action dispatch
…al data model, single createSurface
… export standardRenderers
…lose, resolve button labels, compact context
…ormed operations from real model output
…cursor in markdown mode
…restore the chat cursor
…ad item swallow the rest
…ale, controls, cards and tables
…s bindable; clamp grid spans
…context builders A minimal catalog object (components only) crashed buildCatalogContextValue and extractCatalogComponentSchemas once they started checking the functions map size; guard both reads and cover it with a test.
AlemTuzlak
added a commit
that referenced
this pull request
Oct 16, 2026
… fence parser addScopedProperties registers forwarded props for the runs of named agents, and getPropertiesForAgent merges them into each run. The a2ui-markdown module (from PR #7829) splits assistant text into prose and a2ui fences, reads a target=<id> info string, parses the operations with JSON repair, and lifts prose out of a surface.
AlemTuzlak
added a commit
that referenced
this pull request
Oct 16, 2026
buildActionMessageText turns an event that no function matches into the text of a visible user message, as in PR #7829. createComponentLabelResolver finds the label of the component that sent the event.
AlemTuzlak
added a commit
that referenced
this pull request
Oct 16, 2026
…media components Port the PR #7829 standard catalog tokens and styles, and its layout (16) and media (6) components, to createGenerativeUI. Containers take children through a "multiple" slot, so a template list works. Add recharts as a dependency and maplibre-gl as an optional peer for the chart and map components that come next.
AlemTuzlak
added a commit
that referenced
this pull request
Oct 16, 2026
…mponents Port the rest of the PR #7829 standard catalog to createGenerativeUI: text (12, with streamdown markdown and katex math), inputs (12, writable values and onClick/onSubmit events), feedback (9), and data (8, with a recharts Chart and a lazily loaded maplibre Map that falls back to a list of places).
AlemTuzlak
added a commit
that referenced
this pull request
Oct 16, 2026
…I and standardUI
The example uses generativeUI={{ ui: standardUI, transport }}, with ?transport=tool|markdown
and ?agent=langgraph. It keeps the built-in agent, the LangGraph Python agent, and the 6
suggestion pills. The /catalog page renders every standard component from sample
operations through a scripted agent, with its description, props, and events.
1 of 4 tasks
…m; engine SVG prompt The lightbox takes a list of images with a selected index and offers prev/next arrows, a counter and arrow-key navigation. ImageGrid passes its whole set; CarouselMediaItem becomes clickable and opens every media slide of its carousel (href or action on the slide take over the click). The example app gains a prompt that uses the Svg component for an interactive four-stroke engine drawing.
This was referenced Oct 18, 2026
mme
added a commit
that referenced
this pull request
Oct 19, 2026
…n-mode behaviour onto createGenerativeUI (#7848) Ports the standard catalog work of #7829 onto the `createGenerativeUI` engine, so nothing that branch had is lost in #7819. Stacked on `feat/generative-ui-prototype` and rebased onto its A2UI v1.0 head (`ae485ca8bf`); no change to the engine's design, only additions. The ported tests, samples and docs write v1.0 operations with `{"@path"}` bindings and `userMessage` events. ## What this PR does **Standard components (`standardUI`, 63 → 69)** - New: `Italic`, `Underline`, `Strikethrough`, `Blockquote`, `CarouselMediaItem`, `LinkCard`, `Citation`, `FollowUp`, `EntityCard`, `ImageGrid`. - A multi-image `Lightbox` (arrows, counter, arrow keys) on `Image`, `ImageGrid` and `CarouselMediaItem`. `href` and `copy` on `Button`, `href` on `Pressable`: ChatGPT's `openUrl` and `copy` verbs, client-side. `Carousel` gets arrows and a writable `activeIndex`. Every container sends `onVisible` once. - The prop gaps against ChatGPT's catalog: layout `role`, `flush`, `minSize`, `maxSize`, `disableAutoSpacing`; Card `size`, `shadowStyle`; Text `fontSize`, `lineHeight`, `minLines`; Select `clearLabel`, `icon`, `block`; DateTimeInput `block`; Pressable `tooltip`, `ariaPressed`, `insetBorder`; Chart `layout: "horizontal"`, `yAxis`, `showDots`, `barRadius` and the pie geometry; Image `fallback`, `hoverZoom`, `position`, `minWidth`, `minHeight`, `actionOverlay`; YouTube poster first (`showThumbnail`); Svg stroke props; Popover `hoverOpenDelay`, `PopoverContent.sideOffset`, `PopoverTrigger.block` (and a Button child works); LoadingBlock `reducedMotion`; PulseIndicator `endScale`, `startOpacity`; TableRow `label` as a `th scope=row` with `labelColSpan`; List `maxMarkerSize`, ListItem `markerSize`, `disabled`. - `Text`, `Caption` and `Label` show a bound number as text (a price bound to a slider no longer fails the schema). **Engine, additive** - `GenerativeUISurfaceManager.linkSurfaces`: the parts of a chat surface that the prose lift split share their data model. The markdown source links them, and a user write to one part is written and owned in all of them. Closes the first known gap of #7819. - A child that has not streamed yet renders nothing (no grey placeholder), the chat card has no "Generating…" line, and the markdown transport wraps a chat surface without a box. Streamed components fade in once (SVG internals excluded); the fade is opacity only and runs under reduced motion too, since it moves nothing. - A chat surface belongs to the reply that wrote it, as in #7829: a later reply that reuses a `surfaceId` gets a surface of its own (`<id>@<messageId>`) instead of replacing the earlier reply's content. A page target is still updated from any reply. (Before: "five more flashcards" replaced the first five and the new reply showed nothing.) - `MarkdownSurfaces` and `useGenerativeUIRuntime` are exported from `@copilotkit/react-core/v2/generative-ui`, so the v1 chat (`@copilotkit/react-ui`) renders a2ui fences when the v1 provider gets a `generativeUI` prop with the markdown transport. - `FollowUp` pills send even when the model bound no `onFollowUp`: the pill forwards a `follow_up` event with its message, which becomes a visible user message. A `List` item with a `value` and no action is a key and value row (Price: $1,599); with an action the value stays the pick payload. - `Animate`, `AnimateGroup`, `AnimateItem` and `Transition` are removed. They were pass-through containers on both branches that did nothing, and a pass-through the model can reach for is noise in the schema. 73 → 69 components. - `Tooltip` hugs its trigger: as a flex item it stretched across the column and the tip centred far from the text. - The compact schema of the markdown transport hoists the props that many components share verbatim (the layout props of the containers) into `commonProps`, as the a2ui-renderer compact schema did. For `standardUI` that takes the context entry from 58K to 39K characters. One line in the guideline explains the flag. **Example and docs** - Catalog page: samples for the composites, the inline text components, the Button verbs and a horizontal chart (50 samples, every component covered). A "How an engine works" suggestion drives the `Svg` component. - The catalog page says when the browser asks for reduced motion, since the shimmer, spinners and animations stop then by design. - `?layout=chat`: the chat alone in one centered column, with a Layout switch in the header. The page-target suggestions are left out there, and the manifest lists only the chat as a target. - `generative-ui/a2ui/markdown-mode.mdx` rewritten for `generativeUI`, `standardUI` and `createGenerativeUI`. ## Verification that nothing was lost - **Inventory diff.** Every component and prop of the a2ui-renderer catalog (73 components, 428 props) was dumped from its compact schema and diffed against `standardUI.manifestComponents`. The only components missing are the four motion pass-throughs, removed on purpose. 8 props have no counterpart, all renames into the engine's event and slot model: `action` → `onClick`/`onSubmit`/`onAction`, `Carousel.ariaLabel` → `label`, `Tooltip.children` → the `trigger` and `content` slots. - **Test tally.** The 155 tests of the a2ui-renderer catalog were matched against this tree: 55 exist verbatim, 58 are covered by an existing standardUI test under another title, 2 were ported under a new title, 7 test engine behaviour the generative UI engine covers with its own tests, 24 have no counterpart by design (compact schema, `filterCatalog`, host markdown renderer, `themeToCssVariables`), and 9 test the A2UI reference catalogs that stay in a2ui-renderer. The full mapping is in the PR comment below. - **Catalog page** at `/catalog`: 33 sections, 69 components, no missing sample, no render error, no placeholder. - **Browser**: the estimator and the engine prompts on the built-in agent with the markdown transport. ## Not in this PR - The protocol version flip (v0.9 → v1) and the guideline: on the base branch. - Removing the `standard` catalog from `packages/a2ui-renderer`: once this is merged, so one source of truth remains. - Re-recording the real-model fixtures: after the version flip, once. ## Testing ``` pnpm nx run-many -t test --projects=@copilotkit/react-core,@copilotkit/react-ui ``` react-core: 2246 tests pass (the standard components alone have 197). react-ui: 79 tests pass, including the new Markdown test. `tsc --noEmit` passes in react-core, react-ui and `examples/v2/a2ui-markdown`.
mme
added a commit
that referenced
this pull request
Oct 21, 2026
…lebration; keep a fade under reduced motion (#7898) ## Summary Catalog decisions from the review of the feedback group. ### Drop `Loading`, `LoadingIndicator`, `LoadingBlock` With the agent unable to call renderer functions (#7890), nothing fills a placeholder later: a model that renders one leaves a spinner that never stops, and the prompt invites it to. `PulseIndicator` stays as a status dot ("Live"). The `Button` keeps its own `loading` prop. ### Drop `Celebration` A confetti burst is a flourish the model reaches for on its own, not UI. It came in with the feedback wave of #7829 and was ported unchanged; nothing depends on it. ### Reduced motion is not no motion Under `prefers-reduced-motion: reduce` the catalog switched every animation off, so on a Mac with Reduce Motion on, `PulseIndicator` was just a dot. Now the pulse ring keeps fading without growing (`a2ui-pulse-fade`, `!important` because the ring sets its animation inline). 69 model-visible components; docs counts, the catalog samples and the fixture follow. ## Verification `tsc --noEmit` in react-core and the demo example; react-core generative UI suite 551 green (30 skipped behind the agent-call flag). Codex reviewed the first version and found the cascade problem that `!important` fixes.
mme
pushed a commit
that referenced
this pull request
Oct 21, 2026
… fence parser addScopedProperties registers forwarded props for the runs of named agents, and getPropertiesForAgent merges them into each run. The a2ui-markdown module (from PR #7829) splits assistant text into prose and a2ui fences, reads a target=<id> info string, parses the operations with JSON repair, and lifts prose out of a surface.
mme
force-pushed
the
feat/a2ui-markdown-mode
branch
from
October 21, 2026 10:47
a7cb3fd to
6196444
Compare
mme
pushed a commit
that referenced
this pull request
Oct 21, 2026
buildActionMessageText turns an event that no function matches into the text of a visible user message, as in PR #7829. createComponentLabelResolver finds the label of the component that sent the event.
mme
pushed a commit
that referenced
this pull request
Oct 21, 2026
…media components Port the PR #7829 standard catalog tokens and styles, and its layout (16) and media (6) components, to createGenerativeUI. Containers take children through a "multiple" slot, so a template list works. Add recharts as a dependency and maplibre-gl as an optional peer for the chart and map components that come next.
mme
pushed a commit
that referenced
this pull request
Oct 21, 2026
…mponents Port the rest of the PR #7829 standard catalog to createGenerativeUI: text (12, with streamdown markdown and katex math), inputs (12, writable values and onClick/onSubmit events), feedback (9), and data (8, with a recharts Chart and a lazily loaded maplibre Map that falls back to a list of places).
mme
pushed a commit
that referenced
this pull request
Oct 21, 2026
…I and standardUI
The example uses generativeUI={{ ui: standardUI, transport }}, with ?transport=tool|markdown
and ?agent=langgraph. It keeps the built-in agent, the LangGraph Python agent, and the 6
suggestion pills. The /catalog page renders every standard component from sample
operations through a scripted agent, with its description, props, and events.
mme
added a commit
that referenced
this pull request
Oct 21, 2026
…n-mode behaviour onto createGenerativeUI (#7848) Ports the standard catalog work of #7829 onto the `createGenerativeUI` engine, so nothing that branch had is lost in #7819. Stacked on `feat/generative-ui-prototype` and rebased onto its A2UI v1.0 head (`3b3f16ff4a`); no change to the engine's design, only additions. The ported tests, samples and docs write v1.0 operations with `{"@path"}` bindings and `userMessage` events. ## What this PR does **Standard components (`standardUI`, 63 → 69)** - New: `Italic`, `Underline`, `Strikethrough`, `Blockquote`, `CarouselMediaItem`, `LinkCard`, `Citation`, `FollowUp`, `EntityCard`, `ImageGrid`. - A multi-image `Lightbox` (arrows, counter, arrow keys) on `Image`, `ImageGrid` and `CarouselMediaItem`. `href` and `copy` on `Button`, `href` on `Pressable`: client-side verbs, client-side. `Carousel` gets arrows and a writable `activeIndex`. Every container sends `onVisible` once. - The remaining props: layout `role`, `flush`, `minSize`, `maxSize`, `disableAutoSpacing`; Card `size`, `shadowStyle`; Text `fontSize`, `lineHeight`, `minLines`; Select `clearLabel`, `icon`, `block`; DateTimeInput `block`; Pressable `tooltip`, `ariaPressed`, `insetBorder`; Chart `layout: "horizontal"`, `yAxis`, `showDots`, `barRadius` and the pie geometry; Image `fallback`, `hoverZoom`, `position`, `minWidth`, `minHeight`, `actionOverlay`; YouTube poster first (`showThumbnail`); Svg stroke props; Popover `hoverOpenDelay`, `PopoverContent.sideOffset`, `PopoverTrigger.block` (and a Button child works); LoadingBlock `reducedMotion`; PulseIndicator `endScale`, `startOpacity`; TableRow `label` as a `th scope=row` with `labelColSpan`; List `maxMarkerSize`, ListItem `markerSize`, `disabled`. - `Text`, `Caption` and `Label` show a bound number as text (a price bound to a slider no longer fails the schema). **Engine, additive** - `GenerativeUISurfaceManager.linkSurfaces`: the parts of a chat surface that the prose lift split share their data model. The markdown source links them, and a user write to one part is written and owned in all of them. Closes the first known gap of #7819. - A child that has not streamed yet renders nothing (no grey placeholder), the chat card has no "Generating…" line, and the markdown transport wraps a chat surface without a box. Streamed components fade in once (SVG internals excluded); the fade is opacity only and runs under reduced motion too, since it moves nothing. - A chat surface belongs to the reply that wrote it, as in #7829: a later reply that reuses a `surfaceId` gets a surface of its own (`<id>@<messageId>`) instead of replacing the earlier reply's content. A page target is still updated from any reply. (Before: "five more flashcards" replaced the first five and the new reply showed nothing.) - `MarkdownSurfaces` and `useGenerativeUIRuntime` are exported from `@copilotkit/react-core/v2/generative-ui`, so the v1 chat (`@copilotkit/react-ui`) renders a2ui fences when the v1 provider gets a `generativeUI` prop with the markdown transport. - `FollowUp` pills send even when the model bound no `onFollowUp`: the pill forwards a `follow_up` event with its message, which becomes a visible user message. A `List` item with a `value` and no action is a key and value row (Price: $1,599); with an action the value stays the pick payload. - `Animate`, `AnimateGroup`, `AnimateItem` and `Transition` are removed. They were pass-through containers on both branches that did nothing, and a pass-through the model can reach for is noise in the schema. 73 → 69 components. - `Tooltip` hugs its trigger: as a flex item it stretched across the column and the tip centred far from the text. - The compact schema of the markdown transport hoists the props that many components share verbatim (the layout props of the containers) into `commonProps`, as the a2ui-renderer compact schema did. For `standardUI` that takes the context entry from 58K to 39K characters. One line in the guideline explains the flag. **Example and docs** - Catalog page: samples for the composites, the inline text components, the Button verbs and a horizontal chart (50 samples, every component covered). A "How an engine works" suggestion drives the `Svg` component. - The catalog page says when the browser asks for reduced motion, since the shimmer, spinners and animations stop then by design. - `?layout=chat`: the chat alone in one centered column, with a Layout switch in the header. The page-target suggestions are left out there, and the manifest lists only the chat as a target. - `generative-ui/a2ui/markdown-mode.mdx` rewritten for `generativeUI`, `standardUI` and `createGenerativeUI`. ## Verification that nothing was lost - **Inventory diff.** Every component and prop of the a2ui-renderer catalog (73 components, 428 props) was dumped from its compact schema and diffed against `standardUI.manifestComponents`. The only components missing are the four motion pass-throughs, removed on purpose. 8 props have no counterpart, all renames into the engine's event and slot model: `action` → `onClick`/`onSubmit`/`onAction`, `Carousel.ariaLabel` → `label`, `Tooltip.children` → the `trigger` and `content` slots. - **Test tally.** The 155 tests of the a2ui-renderer catalog were matched against this tree: 55 exist verbatim, 58 are covered by an existing standardUI test under another title, 2 were ported under a new title, 7 test engine behaviour the generative UI engine covers with its own tests, 24 have no counterpart by design (compact schema, `filterCatalog`, host markdown renderer, `themeToCssVariables`), and 9 test the A2UI reference catalogs that stay in a2ui-renderer. The full mapping is in the PR comment below. - **Catalog page** at `/catalog`: 33 sections, 69 components, no missing sample, no render error, no placeholder. - **Browser**: the estimator and the engine prompts on the built-in agent with the markdown transport. ## Not in this PR - The protocol version flip (v0.9 → v1) and the guideline: on the base branch. - Removing the `standard` catalog from `packages/a2ui-renderer`: once this is merged, so one source of truth remains. - Re-recording the real-model fixtures: after the version flip, once. ## Testing ``` pnpm nx run-many -t test --projects=@copilotkit/react-core,@copilotkit/react-ui ``` react-core: 2246 tests pass (the standard components alone have 197). react-ui: 79 tests pass, including the new Markdown test. `tsc --noEmit` passes in react-core, react-ui and `examples/v2/a2ui-markdown`.
mme
added a commit
that referenced
this pull request
Oct 21, 2026
…lebration; keep a fade under reduced motion (#7898) ## Summary Catalog decisions from the review of the feedback group. ### Drop `Loading`, `LoadingIndicator`, `LoadingBlock` With the agent unable to call renderer functions (#7890), nothing fills a placeholder later: a model that renders one leaves a spinner that never stops, and the prompt invites it to. `PulseIndicator` stays as a status dot ("Live"). The `Button` keeps its own `loading` prop. ### Drop `Celebration` A confetti burst is a flourish the model reaches for on its own, not UI. It came in with the feedback wave of #7829 and was ported unchanged; nothing depends on it. ### Reduced motion is not no motion Under `prefers-reduced-motion: reduce` the catalog switched every animation off, so on a Mac with Reduce Motion on, `PulseIndicator` was just a dot. Now the pulse ring keeps fading without growing (`a2ui-pulse-fade`, `!important` because the ring sets its animation inline). 69 model-visible components; docs counts, the catalog samples and the fixture follow. ## Verification `tsc --noEmit` in react-core and the demo example; react-core generative UI suite 551 green (30 skipped behind the agent-call flag). Codex reviewed the first version and found the cascade problem that `!important` fixes.
Contributor
Author
|
Superseded by the generative UI port in #7819. |
NathanTarbert
pushed a commit
to vvlrff/CopilotKit
that referenced
this pull request
Oct 27, 2026
…nsports, standard catalog, inspector pane) (CopilotKit#7819) Try it: run `examples/v2/generative-ui-shop` (setup in its README) and ask the chat for "Top rated" products. The home row on the page changes to what the agent picked. This PR makes generative UI one feature: an agent streams React components into the chat or into named areas of the page, with the `render_ui` tool (tool transport) or with a2ui code fences in its reply (markdown transport). It includes a standard catalog of 69 components (the A2UI 1.0 basic catalog, from CopilotKit#7879, with the follow-ups of CopilotKit#7888, CopilotKit#7890 and CopilotKit#7898), the work of CopilotKit#7829 and CopilotKit#7848, two new examples, and a Generative UI pane in the inspector. ## What does this PR do? ### Catalog (`@copilotkit/react-core/v2/generative-ui`) - `createGenerativeUI({ id, extends, state, functions, overrides, components })` declares the components, the app state, and the functions. Schemas can be any Standard Schema (zod 3, zod 4.2+, Valibot, ArkType). Props need a JSON Schema, and props and state must validate synchronously. - Binding: a prop with the name of a state key, or a `bind` selector, gets its value from app state. An event with the name of a function (or `onX` for `x`) calls it. An event that no function matches becomes a visible user message. - `writable: ["value"]` gives a component a typed `setValue`. A path that the user wrote becomes user-owned: later agent writes to it are ignored. - `extends` merges catalogs, with full types for every component. `overrides: { Card: { component: MyCard } }` replaces the React component of a base component and keeps what the model sees. `standardUI.omit(["Map"])` drops components, also from the prompt. - `useGenerativeUIState(ui, key, value)` and `useGenerativeUIFunction(ui, name, handler)` connect app state and handlers, with types from `ui`. ### Surfaces - `<GenerativeUISurface id description ui components fallback />` is a named area of the page. The fallback shows until the agent renders into it. - The `ui` prop types `components`, so a wrong component name is a `tsc` error. `components` needs `ui`. - `components` limits the area to those components. Other components are rejected, and the model gets the reason. - The page scrolls to a surface when the agent starts to render into it, unless the surface is already on screen. `autoScroll={false}` turns this off for one surface. ### Standard catalog and theme - `standardUI`: 69 components for layout, text, inputs, feedback, data, media, and composites (the a2ui-renderer catalog, ported in CopilotKit#7848). Chart uses `recharts`. Map loads `maplibre-gl` (an optional peer). - Built-in dark mode: the components switch to dark values under a `.dark` class, like the CopilotKit chat. The map uses a dark basemap. - `theme` keys are the exact `--a2ui-*` variables, so a wrong name is a type error. Top-level values apply in both modes, and `dark: { … }` replaces them in dark mode. The theme is a stylesheet on the surface root. ### Wire and runtime (`@copilotkit/shared`, `@copilotkit/core`, runtime) - A2UI v1.0 only, in both transports: `createSurface` with inline `components` and `dataModel`, `{"@path"}` bindings, `{"@call"}` function calls in events, `{"@call":"@index"}` in templates, `userMessage` on events, and `"value": null` deletes. `catalogId` is optional. - `supportedCatalogIds` lists the id of the UI first, then the id of every catalog in its `extends`. An operation can name any of these ids in `catalogId`, and the surface keeps that id. An unknown id on a component or a function call is rejected with a reason. An unknown id on `createSurface` is replaced with the id of the UI. - `callRendererFunction` is off for now (CopilotKit#7890): the prompts do not mention it, and the validator rejects it with a reason. The code and its tests stay behind `GENERATIVE_UI_AGENT_FUNCTION_CALLS`. - The manifest goes to `forwardedProps.copilotkit.ui` (format 3, the v1.0 renderer capabilities shape), only to the agents in `agentIds`. The guide sends only the rules that the catalog needs (about 575 tokens for a small catalog, 930 with all rules). - `CopilotRuntime({ generativeUI: true })` gives tool-transport runs `render_ui` through `GenerativeUIMiddleware`. A markdown-transport run never gets it. - Markdown transport: the fence parser from CopilotKit#7829 streams operations component by component. A fence with `target=<id>` renders in that surface, and the v1 chat (`@copilotkit/react-ui`) renders a2ui fences too. ### Inspector (`@copilotkit/web-inspector`) A new **Generative UI** pane, with three tabs: - **Surfaces**: each surface with its status, target, rejected operations, data model, and user values. A tree shows the rendered components and their props. It follows `slots` and the `child()` / `childList()` refs at any depth. Hover over the card of a page surface to outline it on the page and scroll to it. - **Catalog**: the components, split by the catalog that declared them. The provider catalog comes first. A base catalog from `extends` has an "extended" tag and starts closed. A small search filters components and functions. - **Prompt**: what the last run sent and what the next run will send: the envelope and the `render_ui` guide. The large text is drawn only when you open it. React-core gives core an internal debug source (`ɵGenerativeUIDebugSource`), and the pane reads it. The prompt builder moved from runtime to `@copilotkit/shared`, so the pane shows the same guide that the runtime builds. ### Examples - `examples/v2/generative-ui-shop` (new, React Router): the shop from the AI-powered apps workshop, with Prisma and SQLite. A TanStack AI agent with server tools fills four page surfaces: the home row, the product recommendations, the cart items, and the cart suggestions. - `examples/v2/a2ui-markdown` (Next.js): both transports, page surfaces with pills, and `/catalog` with every standard component. - `examples/v2/react/demo` `/generative-ui`: a storefront with `bind`, `writable`, and a limited surface. ### Known gaps - Agent-called functions (`callRendererFunction`) are off. Their result goes back as a developer message, and not every backend keeps that message where the model reads it in order. - In markdown mode, a surface cannot be created again after `deleteSurface`. - `HtmlView` content stays light-styled in dark mode: it is a sandboxed iframe that the theme cannot reach. - From A2UI v1.0, not supported yet: catalogs by id (without an inline catalog), and `sendDataModel`. `extends` merges catalogs into one namespace, and overrides replace by name. - Several catalogs in one surface work only in part. A component is not checked against the catalog that the surface names, and the prompt does not tell the agent to set `catalogId`. - `callAgentFunction` and `agentFunctionResponse` are not implemented. A user event starts a new run instead. - `@a2ui/web_core` stays 0.10.4: the engine uses its `v0_9` surface and data models. Version 0.14 has `v1_0` models, and the move is a separate integration task. - `@ag-ui/a2ui-toolkit` 0.0.5 writes v0.9 operations, so agent tools built with it do not work with this engine. The `render_ui` route does not use the toolkit, and it works with a LangGraph Python agent (see Testing). - The standard catalog keeps each React component and its schema in one entry. `exportA2UICatalog` gives the portable JSON, but definitions without React are not split out yet. ## Related PRs and Issues - Contains the work of CopilotKit#7829 (A2UI markdown mode), ported to this engine. CopilotKit#7829 itself is not changed. - Contains CopilotKit#7848 by @mme: the a2ui-renderer standard catalog and markdown-mode behavior on `createGenerativeUI`. - Contains CopilotKit#7879: the A2UI 1.0 basic catalog names, typed child references, dynamic values, checks, and `calc`. - Contains CopilotKit#7888: A2UI 1.0 follow-ups: action events, function permissions, the component envelope, checks severity, Video, `exportA2UICatalog`, and an adoption guide. - Contains CopilotKit#7890: no agent-called renderer functions for now, the A2UI default for `allowedCallers`, the experimental callout, and two prompt rules. - Contains CopilotKit#7898: drops `Loading`, `LoadingIndicator`, `LoadingBlock` and `Celebration`. ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [ ] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) Docs: a new "Components and surfaces" section under Generative UI, in the Declarative group (`showcase/shell-docs/src/content/docs/generative-ui/components/`), with 9 pages, and an adoption guide from the `a2ui` renderer is one of them. Its support matrix lists these limits. The quickstart has a "When something does not render" table that points to the tab of the inspector pane to open. The Inspector page, `surfaces.mdx`, and `catalogs.mdx` link to the pane too. Reference pages for `createGenerativeUI`, `GenerativeUISurface`, and the hooks come in a later PR. There is no breaking change for users: none of these APIs is on `main`. ## Testing **Commands run** - `tsc --noEmit` passes in react-core and in the three examples (`generative-ui-shop`, `a2ui-markdown`, `react/demo`), after a rebuild of react-core. - The generative UI tests of react-core pass: 457 tests in 29 files. They include tests for Standard Schema with a non-zod schema, the theme stylesheet, overrides, `omit`, and the type rules. - `pnpm install --frozen-lockfile --lockfile-only` passes for all 86 workspace projects. - The lefthook pre-commit hook ran on every commit, except the package test step of three lockfile commits (`032d695e21`, `89ec79e649`, `ae485ca8bf`). A lockfile change makes that step run the Go and Ruby runtime tests, which cannot run on the author's machine. CI runs them. - Inspector pane and its merge with CopilotKit#7879: builds of shared, core, react-core, and web-inspector, then `tsc --noEmit` in those four and in runtime. These tests pass: `generative-ui-view.spec.ts` and `hud-conformance.test.ts` (69), `use-generative-ui-root.test.tsx` and `catalog.test.tsx` (46), `generative-ui-debug.test.ts` (2), `generative-ui-middleware.test.ts` (44), and `shared/src/generative-ui` (76). - The inspector commits skipped the package test step of the pre-commit hook. In the full hook run, 3 react-core chart tests and 1 vue SSR test timed out under load. They are not in changed files, and all 4 pass alone. CI runs the full suites. - Merge of CopilotKit#7888 into this branch: builds of shared, core, react-core, and web-inspector, `tsc --noEmit` in web-inspector, and the 69 inspector tests pass. The docs commit has no code. - Real backend: the LangGraph Python agent of `examples/v2/a2ui-markdown` (`CopilotKitMiddleware`, `uv sync` from its `uv.lock`) with an OpenAI model, on both transports. With the tool transport, it rendered a dashboard into a page target, then updated the same surface in place. A sign-up form showed its checks, and Create account stayed disabled until every field was valid. The submit event started a new run, and the agent repeated the 4 values. The inspector showed 2 surfaces and no rejected operations. With the markdown transport, a fence rendered a checklist in the `notes` target, and no fence text appeared in the chat. The agent and the runtime logged no errors. - The catalog ids of `extends` (`2ac89b6e67`), after a rebase on CopilotKit#7898: builds of shared and core, then `tsc --noEmit` in shared, core, react-core and runtime. The touched test files pass: `validate-operation.test.ts` and `a2ui-envelope.test.ts` (102), `a2ui-markdown-operations.test.ts` (74), `catalog.test.tsx`, `markdown-source.test.ts`, `surface-manager.test.ts` and `use-generative-ui-root.test.tsx` (130), and `generative-ui-middleware.test.ts` (42). The full pre-commit hook passed. In one earlier hook run, the react-core `Chart` test in `standard/__tests__/data.test.tsx` timed out under load. It passes alone. - Not run locally: full package suites and e2e. CI runs them. **Manual test** 1. Follow the setup in `examples/v2/generative-ui-shop/README.md`, then run `pnpm example-dev` and open http://localhost:3012. 2. On the home page, click **Top rated**. The Featured Products row changes, and the page scrolls to it. Click **Featured again** to bring the original row back. 3. Open a product and click **Cheaper alternatives**. The "You Might Also Like" row changes. 4. Add a product to the cart, open the cart, and click **Show my cart differently**. The cart items change to detailed cards. 5. Add the `dark` class to `<html>` in the devtools of `examples/v2/a2ui-markdown` `/catalog`. Every standard component switches to dark. 6. In the shop, open the CopilotKit inspector and click **Generative UI**. Open **Catalog**, and type `button` in the search: the standard catalog opens with its matches. On **Surfaces**, hover over a page surface card: the surface gets an outline on the page. 7. Run the LangGraph agent of `examples/v2/a2ui-markdown` (see `agent/README.md`), then open http://localhost:3011/?agent=langgraph&transport=tool. Click **Dashboard on the page**, then **Update the dashboard**: the same surface changes. Click **Sign-up with validation**, fill the form, and submit it: the agent repeats what you entered. **How this PR makes testing easy** - Unit and type tests in `packages/web-inspector/src/components/generative-ui-view.spec.ts`, `packages/react-core/src/v2/generative-ui/**/__tests__`, `packages/shared/src/__tests__/a2ui-*.test.ts`, `packages/core/src/__tests__/a2ui-markdown-*.test.ts`, and `packages/runtime/src/v2/runtime/__tests__/generative-ui-*.test.ts`. - Three example apps (see Examples above). The shop and a2ui-markdown were tested with a real model, and `/catalog` renders with no model. - The docs section walks through each feature with copyable code: surfaces, catalogs, the standard catalog, state and actions, theming, transports, markdown mode, and the adoption guide from A2UI. ## Risk / rollback Low risk for current users. All new APIs are experimental and opt-in, and the `a2ui` prop path does not change. react-core gets `recharts` as a dependency and `maplibre-gl` as an optional peer; apps that do not import the subpath do not bundle them. The new shop example adds Prisma, TanStack AI React, and Faker to the lockfile. To undo, revert the PR. ## Public API change New experimental exports. Nothing that exists on `main` changes. **Before** ```tsx <CopilotKitProvider runtimeUrl="/api/copilotkit" a2ui={{ catalog }}> <CopilotChat /> </CopilotKitProvider> ``` **After** ```tsx import { createGenerativeUI, GenerativeUISurface, standardUI } from "@copilotkit/react-core/v2/generative-ui"; const ui = createGenerativeUI({ id: "acme/app@1", extends: [standardUI.omit(["Map"])], overrides: { Card: { component: MyCard } }, components: { ProductCard: { component: ProductCard, props: productSchema } }, }); <CopilotKitProvider runtimeUrl="/api/copilotkit" generativeUI={{ ui, theme: { "--a2ui-color-accent": "#d97706", dark: { "--a2ui-color-panel": "#1f2937" } } }} > <GenerativeUISurface id="featured" ui={ui} components={["ProductCard"]} fallback={<Featured />} /> <CopilotChat /> </CopilotKitProvider> // Server new CopilotRuntime({ agents, generativeUI: true }); ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added v2 Generative UI with interactive surfaces, custom catalogs, state bindings, actions, theming, validation, charts, maps, media, and responsive standard components. * Added tool and Markdown transports with streamed `a2ui` content, targeted surfaces, inline rendering, and chat integration. * Added Generative UI inspection in the web Inspector, showing catalogs, surfaces, prompts, state, and rejected operations. * Added generative UI examples, including a Markdown demo, storefront, catalog gallery, shopping assistant, cart, and product comparison experience. * **Documentation** * Added setup and reference guides for catalogs, surfaces, transports, theming, state, actions, and Inspector workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Laptopmini
pushed a commit
to Laptopmini/CopilotKit
that referenced
this pull request
Oct 27, 2026
…ed strings through labels (CopilotKit#7867) ## What does this PR do? Routes the prebuilt chat's remaining hard-coded strings through the `labels` config, so apps can translate them. | Key | Default | Where | | --- | --- | --- | | `reasoningMessageThinkingLabel` | "Thinking…" | reasoning header while the model reasons (React, Vue, Angular) | | `chatInputSlashMenuLabel` | "Slash commands" | name of the slash-command menu (React, Vue) | | `chatInputSlashMenuEmptyText` | "No commands found" | its empty state (React, Vue) | | `attachmentRemoveButtonLabel` | "Remove attachment" | queued attachment (React, Vue, Angular) | | `attachmentPlayVideoButtonLabel` | "Play video" | queued video (React, Vue) | | `attachmentPreviewCloseButtonLabel` | "Close preview" | attachment preview (React, Vue) | | `modalHeaderCloseButtonLabel` | "Close" | popup and sidebar header (React, Vue) | | `modalHeaderThreadsButtonLabel` | "Open threads" | threads drawer launcher (React, Vue) | | `sidebarLabel` | "Copilot chat sidebar" | name of the sidebar region (React, Vue) | **"Thought for N seconds"** carries a number and plural rules, which a plain string label can't express. Its English default stays as it is. The reasoning header slot now also receives `elapsedSeconds` (React; Vue's `header` and `layout` slots), so an app can render its own text with correct plurals: ```tsx <CopilotChat messageView={{ reasoningMessage: { header: ({ isStreaming, elapsedSeconds, ...props }) => ( <CopilotChatReasoningMessage.Header {...props} isStreaming={isStreaming} label={isStreaming ? "Denkt nach…" : `${Math.round(elapsedSeconds)} Sekunden nachgedacht`} /> ), }, }} /> ``` The change is additive: same English defaults, and no visual change unless an app sets the new labels. The reference pages for `useCopilotChatConfiguration` (React, Vue) and `provideCopilotChatLabels` list the new keys, and the reasoning-messages guide documents `elapsedSeconds`. Not included: - Angular's popup and sidebar close buttons keep their own names ("Close Copilot chat", "Close Copilot sidebar"). Angular's reasoning message has no header slot to pass `elapsedSeconds` to. - The A2UI renderer's own strings ("Building interface", "Retrying generation…", "Filter options...") are left out, since the A2UI catalog is being reworked in CopilotKit#7819 / CopilotKit#7829. ## Related PRs and Issues - Closes CopilotKit#7864 - Same pattern as CopilotKit#6771. Independent of CopilotKit#7865 (the icon-only button names): the two touch different keys and lines. ## Testing New tests. Each fails against `main` and passes here: - React: `CopilotChat.labels.test.tsx` (7). Covers every string above, plus `elapsedSeconds` reaching a custom header (fake timers: 0, then 3 after three seconds). - Vue: `CopilotChat.labels.test.ts` (6). - Angular: `copilot-chat-labels.spec.ts` (2). Checks: - `nx run-many -t check-types,test` for `react-core`, `vue` and `angular`, run one after another: react-core 1905 tests, vue 1186, angular 543 (1 skipped), all passing, and type checks clean. - `nx run-many -t build,publint,attw` for the same three: passing. - `oxlint` and `oxfmt --check` on the changed files: no new warnings. Browser check: a page built against `@copilotkit/react-core` packed from this branch, with German `labels`, in Chromium 149 via Playwright. Repro and capture script: https://github.com/Mordris/copilotkit-ui-repro | | 1.79.1 | This branch | | --- | --- | --- | | Reasoning header (streaming) | "Thinking…" | "Denkt nach…" | | Slash menu, no matches | `listbox "Slash commands": No commands found` | `listbox "Befehle": Keine Befehle gefunden` | | Attachment buttons | "Remove attachment", "Play video" | "Anhang entfernen", "Video abspielen" | | Preview close button | "Close preview" | "Vorschau schließen" | | Same page, English labels | | identical to 1.79.1 (byte-identical screenshot in light mode) | ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) (not a breaking change) - [x] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Chat labels can now be customized across Angular, React, and Vue for reasoning status, slash-command menus, attachment controls, modal buttons, and sidebar accessibility names. * Reasoning headers can access elapsed reasoning time to create localized labels. * Default labels are provided when custom labels are not set. * **Documentation** * Updated configuration references and customization guides to cover the new labels and elapsed-time information. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Laptopmini
pushed a commit
to Laptopmini/CopilotKit
that referenced
this pull request
Oct 27, 2026
…rk mode (CopilotKit#7866) ## What does this PR do? Makes the A2UI basic catalog follow the chat's dark mode in React and Vue, the way it already does in Angular. The React and Vue basic catalogs painted the card, modal, chips and buttons with inline white backgrounds, while their text inherits the chat's foreground. Under `.dark` the card stayed white and its text turned light. Host CSS couldn't override the inline colours, and `a2ui={{ theme }}` doesn't reach them. 1. **Catalog colours read variables** (`@copilotkit/a2ui-renderer` and `@copilotkit/vue`). They use the same names as the Angular basic catalog, with the previous colours as fallbacks, so light mode is unchanged: - `--a2ui-color-surface`: card, modal, chip and button backgrounds (fallback `#fff`) - `--a2ui-color-border`: card, chip and button borders, tab rule, divider (fallback `#ccc`) - `--a2ui-color-muted`: captions, audio and slider values (fallback `CopilotKit#666`) - `--a2ui-color-error`: checkbox and text-field errors: the message, the checkbox outline and the text-field border (fallback `red`) 2. **Dark values** (`@copilotkit/react-core/v2/styles.css` and the Vue stylesheet). The `.dark [data-copilotkit]` block sets the variables from the chat's own tokens: `--a2ui-color-surface: var(--card)`, `--a2ui-color-muted: var(--muted-foreground)`, and two of Angular's dark values: `--a2ui-color-border: oklch(0.371 0 0)` (`rgb(64, 64, 64)`) and `--a2ui-color-error: #f87171`. The chat's `--border` would have given chip and button outlines only 1.31 : 1 against the card. This mirrors `packages/angular/src/styles/globals.css`. Primary colours are untouched (`--a2ui-primary-color` as before). Apps can also set the `--a2ui-color-*` variables themselves. ## Related PRs and Issues - Fixes CopilotKit#7863 - The standard catalog in the drafts CopilotKit#7829 / CopilotKit#7848 also uses `--a2ui-color-*` variables; this lines the basic catalog up with it. ## Testing New tests. Each fails against `main` and passes here, except the light-theme guard, which passes on both by design: - `a2ui-renderer`: `basic-catalog-colors.test.tsx`. - A card with a caption, chip, divider and button reads the variables with the previous fallbacks. - A text field and a checkbox with a failing check use `--a2ui-color-error` for the message and the outline. - `react-core`: `styles/__tests__/a2ui-dark-colors.test.ts`. The dark block sets the four variables, and the light block sets none (same approach as `streamdown-styles.test.ts`). - `vue`: `A2UIBasicCatalogColors.test.ts`. The same checks for the Vue catalog and stylesheet. Checks: - `nx run-many -t check-types,test,build` for `a2ui-renderer`, `react-core` and `vue`, run one after another: a2ui-renderer 24 tests, react-core 1900, vue 1183, all passing, and type checks clean. - `publint` and `attw`: passing. - `oxlint` and `oxfmt --check` on the changed files: no new warnings. Browser check: a page built against `@copilotkit/react-core` and `@copilotkit/a2ui-renderer` packed from this branch, in Chromium 149 via Playwright `getComputedStyle`. Repro and capture script: https://github.com/Mordris/copilotkit-ui-repro | | Card background | Title and chip text | Contrast | | --- | --- | --- | --- | | 1.79.1, light | `rgb(255, 255, 255)` | `rgb(10, 10, 10)` | 19.8 : 1 | | 1.79.1, dark | `rgb(255, 255, 255)` | `rgb(250, 250, 250)` | 1.04 : 1 | | this branch, light | `rgb(255, 255, 255)` | `rgb(10, 10, 10)` | 19.8 : 1 (screenshot byte-identical to 1.79.1) | | this branch, dark | `rgb(10, 10, 10)` | `rgb(250, 250, 250)` | **18.97 : 1** | Chip and button outlines on this branch: `rgb(64, 64, 64)` on the dark card, at 1.91 : 1. Light mode keeps `#ccc` on white, at 1.61 : 1. | 1.79.1, dark | This branch, dark | | --- | --- | |  |  | The Vue page gives the same numbers (`vue/a2ui-dark-fix-en` in the repro). ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) (not a breaking change) - [x] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * A2UI components now use theme-aware colors for surfaces, borders, muted text, and errors, with existing colors as fallbacks. * Dark mode now provides A2UI color values across React and Vue. * **Documentation** * Added guidance on A2UI colors, dark mode, and customizing color variables. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
<CopilotKit a2ui={{ mode: "markdown" }}>makes the agent render interactive A2UI surfaces inline by writing A2UI v0.9 operations inside```a2uifences in an ordinary markdown reply. The chat renders each fence as a streaming surface. It works with any AG-UI agent that streams text: no tool, no runtime middleware, no agent-side A2UI code. The legacy tool mode (render_a2ui+@ag-ui/a2ui-middleware) is untouched and stays the default.It ships with
standardCatalog, a 67-component catalog (layout, text, inputs, table, list, chart, map, media, feedback), styled through--a2ui-*CSS variables.Docs page:
showcase/shell-docs/src/content/docs/generative-ui/a2ui/markdown-mode.mdx.Run it
LangGraph Python agent, in a second terminal (needs
uv):then open
http://localhost:3011/?agent=langgraph. Six suggestion pills under the input cover the catalog: estimator (slider, checkbox, table, chart, form), laptop table with badge and buttons, trip chart, workout planner (select, radios, slider, action), cafés on a map, flashcards.After changing a package, rebuild it and restart
next devwith.nextremoved; the example consumes the packages'dist, and Next caches it.Catalog additions
Added:
LinkCard,Citation,FollowUppills,EntityCard,ImageGrid,CarouselMediaItem;hrefandcopyverbs onButton/Pressable; image lightbox; and per-component props (layoutrole/flush/minSize/maxSize/disableAutoSpacing/onVisible, Cardsize/shadowStyle, Carousel arrows +activeIndex, TextfontSize/lineHeight/minLines, Chart horizontal layout +yAxis+ pie geometry, Imagefallback/hoverZoom/position/actionOverlay, YouTube poster-first, PopoverhoverOpenDelay/sideOffset, and more).Image,ImageGridandCarouselMediaItemopen a lightbox; the grid and the carousel put all of their images into it with arrows, a counter and arrow-key navigation. The example app has a "How an engine works" prompt that drives theSvgcomponent: a cross-section of one cylinder with four stroke buttons, each redrawing the piston, valves and crank via a round trip.Catalog page and tool mode
http://localhost:3011/catalogrenders all 67 standard components from the operations a model would write, with each component's description and props as the model sees them, the raw operations, and a coverage check for components without a sample. Use it to eyeball a renderer change without a model run.http://localhost:3011/?mode=toolruns the samestandardCatalogthrough the legacy tool path (a2ui={{ catalog: standardCatalog }}, nomode): the runtime injectsrender_a2uiand surfaces arrive as activity messages. The header links switch agent and mode.Where things live
packages/core/src/a2ui-markdown/fence-parser.ts,operations.tspackages/core/src/a2ui-markdown/operations.ts(prepareSurfaceOperations,segmentSurfaceProse,flattenInformationalCards)packages/react-core/src/v2/a2ui/markdown/A2UIMarkdownSurface.tsx,A2UIMarkdownRenderer.tsx,action-message.tscopilotkit.uienvelopepackages/react-core/src/v2/a2ui/A2UICatalogContext.tsxmode,catalog,sendContext,includeCatalog,agentIds,onAction,actionMode,theme)packages/react-core/src/v2/providers/CopilotKitProvider.tsx(thea2uiprop)packages/core/src/core/core.ts(addScopedProperties)packages/shared/src/a2ui-envelope.tspackages/shared/src/a2ui-prompts.ts(A2UI_MARKDOWN_GENERATION_GUIDELINES, ~2.7 KB)packages/a2ui-renderer/src/react-renderer/a2ui-react/catalog/standard/(definitions/zod + descriptions,renderers/React,tokens.ts,styles.ts)examples/v2/a2ui-markdown/app/catalog/(samples.tsis the list to extend when adding a component)packages/a2ui-renderer/src/react-renderer/catalog-utils.ts(buildCompactCatalogSchema)packages/runtime/src/v2/runtime/handlers/handle-run.ts,shared/agent-utils.ts@copilotkit/react-ui) fence routingpackages/react-ui/src/components/chat/Markdown.tsxpackages/core/src/__tests__/fixtures/a2ui-markdown/How the model learns the format
Every run carries two context entries (compact component schema ≈ 6k tokens, fence guideline ≈ 700 tokens) and a structured envelope at
forwardedProps.copilotkit.ui(method,version,mode,catalogas A2UI JSON Schema,instructions,contextSent). The built-in agent andCopilotKitMiddleware(LangGraph) paste context entries into the system prompt. A backend that builds its own prompt setssendContext: falseand reads the envelope.includeCatalog: falsesends only the catalog id;agentIdsscopes both to named agents.The guideline asks for
createSurface, thenupdateDataModel, thenupdateComponents(root first), so bound values are known before components paint.How to modify it
descriptionindefinitions/*.ts(the description is what the model sees, so put placement and style rules there) and a renderer inrenderers/*.tsx. Usetokens.tshelpers for colours, radius and type; never literal colours. Tests:packages/a2ui-renderer/src/react-renderer/__tests__/standard-*.test.tsx, run withpnpm exec vitest runin the package.A2UI_MARKDOWN_GENERATION_GUIDELINESinpackages/shared/src/a2ui-prompts.ts; its tests pin the wording that live models got wrong. Visual-style rules belong in the component descriptions, not here.segmentSurfaceProseinpackages/core/src/a2ui-markdown/operations.tsdecides what counts as prose (literalTitle/Text/Caption/Markdown, text-onlyList,Divider). Tests inpackages/core/src/__tests__/a2ui-markdown-operations.test.ts.createCatalog({ ...standardDefinitions, ...mine }, { ...standardRenderers, ...mine }, { catalogId })and pass it asa2ui.catalog.--a2ui-*variables in CSS or pass them asa2ui.theme;theme.mapStyleswaps the basemap.fixtures/a2ui-markdown/<name>.txt, add it toa2ui-markdown-real-output.test.ts.Verify
Known flake:
packages/react-core/src/v2/__tests__/dist-context-singleton.test.tsxfails only in the six-package parallel run because react-ui's test target rebuilds react-core'sdistconcurrently.nx run @copilotkit/react-core:testalone is green. The react-core test target also checks thatsrc/v2/external-reexports.tsis current; regenerate withpnpm run generate:external-reexportsin the package after adding imports from@copilotkit/sharedor@copilotkit/a2ui-renderer.Commits on this branch were made with
--no-verifybecause lefthook runs every downstream suite; the suites above were run by hand after each step.Open points
includeCatalog: falseis the workaround untilag_ui_langgraphstops persisting it (outside this repo).colorprop would make the palette (--a2ui-chart-N) deterministic.