Repository navigation
Conversation
… and dynamic values - `A2UI_BASIC_FUNCTIONS`: the names, short signatures and return types of the basic catalog functions (required, regex, length, numeric, email, formatString, formatNumber, formatCurrency, formatDate, pluralize, openUrl, and, or, not), with `openUrl` marked as needing a user gesture. - `child-refs`: the `ComponentId` / `ChildList` `$ref` markers of A2UI, `collectChildRefs` to find every component reference in a props schema at any depth, and `mapAtChildRef` to replace what sits at one. - The operation validator accepts a basic function value in a data prop, in an event context and as a userMessage (`@index` included), refuses app functions and `openUrl` there, lets an event binding call any basic function, refuses `openUrl` from the agent, and checks the ids at typed child references. - The markdown guideline explains function values, the formatString grammar, `checks`, and typed child references; a `checks` rule group is on when a component has a `checks` prop.
…erences in generative UI
Dynamic values: a prop, an event context, a userMessage or a function
argument can hold `{"@path"}` bindings and `{"@call"}` function values at
any depth. `resolve.ts` walks the value, reads the data model, runs the
basic functions (`functions.ts`, all 14 of the basic catalog plus
`@index`), interpolates `formatString` with its `${...}` grammar, and
reports the paths it read. A node subscribes to those paths and resolves
a prop again only when its raw value or a value it read has changed, so
literal props keep their identity. A validator result becomes a boolean
everywhere but under a check `condition`. A bad call is a prop problem
with the node fallback, never a crash.
The dispatcher runs a basic function when no app function has the name:
for an event binding (so a Button can `openUrl`) and for the agent's
`callRendererFunction`, which may not call a function that needs a user
gesture.
Typed child references: `child()` and `childList()` mark a prop as a
component reference, like the `ComponentId` and `ChildList` types of
A2UI 1.0, anywhere in the props schema. The JSON Schema carries the A2UI
`$ref`, the compact schema shows `componentId`, and the renderer puts the
rendered component in place of each id. `slots` stays for the top-level
case.
… with typed child ids
Every input and the Button take `checks`, the `Checkable` rules of A2UI
1.0. An input shows the first failed message once the user has been in
it or it has a value, and sets aria-invalid; a Button with checks is
disabled while one fails. Tabs takes `tabs: [{ title, child }]` with the
id of each panel, as in the basic catalog.
…ui-markdown catalog, and document them
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-10-19 07:08:00 PDT — 0 finding(s). |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 1
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
Size Change: +37.5 kB (+1.77%) Total Size: 2.16 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Superseded by #7879, which carries this work as one commit per feature against feat/generative-ui-prototype. |
…names, child references, dynamic values, checks, calc (#7879) ## Summary Brings `standardUI` and the generative UI engine to the **A2UI 1.0 basic catalog**, in seven commits, one per area: shared protocol pieces, the core prose lift, the react-core engine, the standard catalog, the runtime prompt, the demo, the docs. Additive to the engine: `createGenerativeUI`, `slots`, events and the surface model keep working as they are. ### 1. Catalog aligned with the 1.0 basic catalog The 18 basic components carry their A2UI names *and* props, no aliases, and the five we lacked are added (Video, AudioPlayer, Tabs, Modal, ChoicePicker). 73 components. | Component | Change | | --- | --- | | Row, Column, Box… | `justify`: `spaceBetween` / `spaceAround` / `spaceEvenly` (+ `stretch`) | | all basic components | `weight` = flex-grow in a Row/Column; font weight is `fontWeight`, Icon stroke `strokeWeight` | | Image | `url`, `description`; `fit` with the five object-fit values; `variant` (icon … header). Same for `CarouselMediaItem` and `ImageGrid` items | | Icon | the A2UI icon names (`arrowBack`, `shoppingCart`, …) map to Lucide; `{ svgPath }` | | Button | variants `default` / `primary` / `borderless` (+ `soft`); `child` slot | | TextField | `variant` (`shortText`, `longText`, `number`, `obscured`, `email`, `url`, `tel`) | | CheckBox | `value` is the boolean state | | Slider / DateTimeInput / Divider / Card / List | `steps`; `enableDate` / `enableTime` with ISO values; `axis`; `child` slot; `direction` + `align` | ### 2. Typed child references `child()` and `childList()` mark a prop as a component reference anywhere in the props schema, like A2UI's `ComponentId` / `ChildList` types. The JSON Schema carries the A2UI `$ref`, the compact schema shows `componentId`, and the engine renders every referenced id at any depth (lists and templates included) and hands the component the nodes. `slots` stays as top-level sugar. `Tabs` takes `tabs: [{ title, child }]` exactly as in 1.0. ### 3. Dynamic values, the whole 1.0 model - `{"@path"}` and `{"@call"}` resolve at any depth of props, event `context`, `userMessage` and function args. - All 14 basic functions are built in, plus `@index`: `required`, `regex`, `length`, `numeric`, `email`, `formatString` (`${/path}`, `${relative}`, `${fn(arg: value)}`, `\${` escape), `formatNumber`, `formatCurrency`, `formatDate` (TR35), `pluralize`, `and`, `or`, `not`, `openUrl`. - Reactive per prop: a node subscribes to the paths it read and re-resolves only the prop whose inputs changed; literals keep their identity. - `ValidationResult` coerces to a boolean except under a check `condition`. - `openUrl` runs only from an event binding; the agent's `callRendererFunction` gets `invalid_function_call` for it. Other basic functions are callable by the agent. - A bad call is a node fallback plus `reportError`, never a crash. The validator and the guideline know the rules, including that 1.0 has **no operators** in `${...}` (no arithmetic, no conditions): a derived number is the model's job. - Guideline nudge from the live runs: keep `dataModel` flat. With one wrapper object around everything the model dropped a closing brace twice in a row, which made the whole surface invisible. ### 4. `checks` Every input and `Button` take the `Checkable` rules. An input shows the first failed message once touched (or when it has a value) and sets `aria-invalid`; a Button with checks is disabled while one fails. ### 5. `calc` and `series`: arithmetic and computed lists 1.0 has no operators at all, so a price that follows a slider has no spelling in the basic catalog. A catalog may declare its own functions, so `standardUI` adds two, listed to the model like `formatCurrency`: - `calc`: one expression over named args (`"expression": "seats * 29 * (annual ? 0.8 : 1)"`, with `"seats": {"@path": "/seats"}`). Closed language: arithmetic, comparisons, `&& || !`, `?:`, `min/max/round/floor/ceil/abs`, text `+`. No property access, no code. - `series`: a list of `count` items from an `item` template with `${...}` expressions over a loop variable, for chart data and template lists. Both are reactive through the resolver. In the demo the model now writes `calc` for the monthly price and a `series` (with a nested `calc`) for the 12-month chart; moving the slider or toggling annual billing updates both with no round trip. ### 6. Fix: a generated event is sent only when the agent is idle A model-generated Button with an event binding sent its event on every click; a double click or a click during a streaming reply started a second run that interrupted the first. `forwardEvent` now drops an event while the agent runs or another event is on its way (`agent_busy` result to the component, nothing reported). Chat input and the chat's own suggestion pills are untouched. ### Deviations from 1.0 `calc` and `series` are CopilotKit catalog functions, not basic-catalog ones; a renderer without them rejects the call cleanly. `Button` keeps `onClick` (1.0: `action`); defaults differ where ours look better in chat (`Image.fit` → `cover`). ### Context cost Compact schema + run guideline: **13.2K tokens** (o200k), up from 11.0K on the base: four new components, `weight` on 18 components, the Icon names and the 14 function signatures. ### Demo suggestions Three pills in `examples/v2/a2ui-markdown` exercise the new features end to end: **Table booking** (a `formatString` sentence with `pluralize` and `formatDate` that updates live from a name field, a date picker and a slider), **Sign-up with validation** (per-field `checks`, Create account disabled until valid), and the sharpened **Team plan estimator** (`calc` price and `series` chart following the slider and the annual checkbox, plus a Request quote button gated by checks). All three were run against the built-in agent and rendered as intended. ## Review Nine rounds of `codex review` (gpt-6-astra, xhigh) against the base, each round's findings fixed and folded into the feature commit they belong to. Highlights: failed function values keep their subscriptions and recover; the prose lift follows typed child references, declared slots and a Card's `child`, and leaves bound references and horizontal lists alone; the resolution cache is scoped by template item and cleared on data notifications; `calc` short-circuits `?:`, `&&`, `||`; `formatDate` tokenizes TR35 fields; built-ins are in the forwarded catalog and never shadow a declared app function; `openUrl` is never a value and needs the browser's user activation; the Modal is portaled with its theme, keyboard-operable, respects disabled triggers and shares one Escape stack with the Lightbox; the tool-transport prompt matches the markdown guideline. Declined as disproportionate: detecting an in-place data-model mutation made by a layout effect in the window before a node subscribes. ## Verification Each commit was type-checked and tested on its own. At the head: shared 98/98, react-core generative-ui 526/526 (new suites: `resolve`, `functions`, `calc`, `child-refs`, `dynamic-values`, `checks`), react-ui 79/79; `tsc` clean for shared, react-core and the example. `/catalog` in `examples/v2/a2ui-markdown` renders every sample; Tabs from typed ids, the reactive formatString sample and the checks sample were exercised in the browser. Replaces #7873 and #7878.
…names, child references, dynamic values, checks, calc (#7879) ## Summary Brings `standardUI` and the generative UI engine to the **A2UI 1.0 basic catalog**, in seven commits, one per area: shared protocol pieces, the core prose lift, the react-core engine, the standard catalog, the runtime prompt, the demo, the docs. Additive to the engine: `createGenerativeUI`, `slots`, events and the surface model keep working as they are. ### 1. Catalog aligned with the 1.0 basic catalog The 18 basic components carry their A2UI names *and* props, no aliases, and the five we lacked are added (Video, AudioPlayer, Tabs, Modal, ChoicePicker). 73 components. | Component | Change | | --- | --- | | Row, Column, Box… | `justify`: `spaceBetween` / `spaceAround` / `spaceEvenly` (+ `stretch`) | | all basic components | `weight` = flex-grow in a Row/Column; font weight is `fontWeight`, Icon stroke `strokeWeight` | | Image | `url`, `description`; `fit` with the five object-fit values; `variant` (icon … header). Same for `CarouselMediaItem` and `ImageGrid` items | | Icon | the A2UI icon names (`arrowBack`, `shoppingCart`, …) map to Lucide; `{ svgPath }` | | Button | variants `default` / `primary` / `borderless` (+ `soft`); `child` slot | | TextField | `variant` (`shortText`, `longText`, `number`, `obscured`, `email`, `url`, `tel`) | | CheckBox | `value` is the boolean state | | Slider / DateTimeInput / Divider / Card / List | `steps`; `enableDate` / `enableTime` with ISO values; `axis`; `child` slot; `direction` + `align` | ### 2. Typed child references `child()` and `childList()` mark a prop as a component reference anywhere in the props schema, like A2UI's `ComponentId` / `ChildList` types. The JSON Schema carries the A2UI `$ref`, the compact schema shows `componentId`, and the engine renders every referenced id at any depth (lists and templates included) and hands the component the nodes. `slots` stays as top-level sugar. `Tabs` takes `tabs: [{ title, child }]` exactly as in 1.0. ### 3. Dynamic values, the whole 1.0 model - `{"@path"}` and `{"@call"}` resolve at any depth of props, event `context`, `userMessage` and function args. - All 14 basic functions are built in, plus `@index`: `required`, `regex`, `length`, `numeric`, `email`, `formatString` (`${/path}`, `${relative}`, `${fn(arg: value)}`, `\${` escape), `formatNumber`, `formatCurrency`, `formatDate` (TR35), `pluralize`, `and`, `or`, `not`, `openUrl`. - Reactive per prop: a node subscribes to the paths it read and re-resolves only the prop whose inputs changed; literals keep their identity. - `ValidationResult` coerces to a boolean except under a check `condition`. - `openUrl` runs only from an event binding; the agent's `callRendererFunction` gets `invalid_function_call` for it. Other basic functions are callable by the agent. - A bad call is a node fallback plus `reportError`, never a crash. The validator and the guideline know the rules, including that 1.0 has **no operators** in `${...}` (no arithmetic, no conditions): a derived number is the model's job. - Guideline nudge from the live runs: keep `dataModel` flat. With one wrapper object around everything the model dropped a closing brace twice in a row, which made the whole surface invisible. ### 4. `checks` Every input and `Button` take the `Checkable` rules. An input shows the first failed message once touched (or when it has a value) and sets `aria-invalid`; a Button with checks is disabled while one fails. ### 5. `calc` and `series`: arithmetic and computed lists 1.0 has no operators at all, so a price that follows a slider has no spelling in the basic catalog. A catalog may declare its own functions, so `standardUI` adds two, listed to the model like `formatCurrency`: - `calc`: one expression over named args (`"expression": "seats * 29 * (annual ? 0.8 : 1)"`, with `"seats": {"@path": "/seats"}`). Closed language: arithmetic, comparisons, `&& || !`, `?:`, `min/max/round/floor/ceil/abs`, text `+`. No property access, no code. - `series`: a list of `count` items from an `item` template with `${...}` expressions over a loop variable, for chart data and template lists. Both are reactive through the resolver. In the demo the model now writes `calc` for the monthly price and a `series` (with a nested `calc`) for the 12-month chart; moving the slider or toggling annual billing updates both with no round trip. ### 6. Fix: a generated event is sent only when the agent is idle A model-generated Button with an event binding sent its event on every click; a double click or a click during a streaming reply started a second run that interrupted the first. `forwardEvent` now drops an event while the agent runs or another event is on its way (`agent_busy` result to the component, nothing reported). Chat input and the chat's own suggestion pills are untouched. ### Deviations from 1.0 `calc` and `series` are CopilotKit catalog functions, not basic-catalog ones; a renderer without them rejects the call cleanly. `Button` keeps `onClick` (1.0: `action`); defaults differ where ours look better in chat (`Image.fit` → `cover`). ### Context cost Compact schema + run guideline: **13.2K tokens** (o200k), up from 11.0K on the base: four new components, `weight` on 18 components, the Icon names and the 14 function signatures. ### Demo suggestions Three pills in `examples/v2/a2ui-markdown` exercise the new features end to end: **Table booking** (a `formatString` sentence with `pluralize` and `formatDate` that updates live from a name field, a date picker and a slider), **Sign-up with validation** (per-field `checks`, Create account disabled until valid), and the sharpened **Team plan estimator** (`calc` price and `series` chart following the slider and the annual checkbox, plus a Request quote button gated by checks). All three were run against the built-in agent and rendered as intended. ## Review Nine rounds of `codex review` (gpt-6-astra, xhigh) against the base, each round's findings fixed and folded into the feature commit they belong to. Highlights: failed function values keep their subscriptions and recover; the prose lift follows typed child references, declared slots and a Card's `child`, and leaves bound references and horizontal lists alone; the resolution cache is scoped by template item and cleared on data notifications; `calc` short-circuits `?:`, `&&`, `||`; `formatDate` tokenizes TR35 fields; built-ins are in the forwarded catalog and never shadow a declared app function; `openUrl` is never a value and needs the browser's user activation; the Modal is portaled with its theme, keyboard-operable, respects disabled triggers and shares one Escape stack with the Lightbox; the tool-transport prompt matches the markdown guideline. Declined as disproportionate: detecting an in-place data-model mutation made by a layout effect in the window before a node subscribes. ## Verification Each commit was type-checked and tested on its own. At the head: shared 98/98, react-core generative-ui 526/526 (new suites: `resolve`, `functions`, `calc`, `child-refs`, `dynamic-values`, `checks`), react-ui 79/79; `tsc` clean for shared, react-core and the example. `/catalog` in `examples/v2/a2ui-markdown` renders every sample; Tabs from typed ids, the reactive formatString sample and the checks sample were exercised in the browser. Replaces #7873 and #7878.
Summary
Stacked on #7873. Closes the three gaps to the A2UI 1.0 basic catalog that the engine still had, without changing
createGenerativeUI's surface for existing catalogs:1. Typed child references (the elegant fix for
Tabs)A2UI 1.0 marks a prop that holds a component by its type (
ComponentId,ChildList), anywhere in the schema. This PR does the same:toJsonSchematurns the mark into the A2UI$ref(common_types.json#/$defs/ComponentId/ChildList), so the manifest is already the 1.0 shape and the compact schema showscomponentId.collectChildRefs, any depth, arrays included) and hands the component the rendered node in place of each id;childList()takes ids or a{ componentId, path }template.slotskeeps working as the top-level sugar.Tabsnow takestabs: [{ title, child }]exactly like 1.0.2. Dynamic values, the whole 1.0 model
{"@path"}and{"@call"}resolve at any depth of a prop, an eventcontext, auserMessage, and function args (before: top-level@pathonly,@callonly@index).functions.ts):required,regex,length,numeric,email,formatString,formatNumber,formatCurrency,formatDate(TR35 tokens),pluralize,and,or,not,openUrl, plus@index.formatStringimplements the${...}grammar:${/path},${relative},${fn(arg: value, …)}, literals,\${escape.ValidationResultcoerces to a boolean everywhere except under a checkcondition, as the spec says.openUrlonly runs from an event binding (user gesture); the dispatcher refuses it from the agent'scallRendererFunctionwithinvalid_function_call. Other basic functions are callable by the agent.reportError), never a crash; the validator rejects app functions andopenUrlin data props with a reason that lists what is allowed.functions; the guideline explains function values, theformatStringgrammar andchecks.3.
checks(Checkable)Every input and
Buttontakechecks: [{ condition, message? }]. The condition is a validator call or a boolean binding, resolved by the engine. An input shows the first failed message once touched (or when it has a value) and setsaria-invalid; a Button with checks is disabled while one fails, with the message as its title.Context cost
Compact schema + run guideline: 13.2K tokens (o200k), up from 12.5K, mostly the 14 function signatures.
Verification
resolve,functions,dynamic-values,checkssuites), react-ui 79/79;tscclean for shared, react-core and the example./cataloginexamples/v2/a2ui-markdown: Tabs from typed ids, a reactiveformatString/formatCurrency/pluralizesample driven by a Slider, and a checks sample where the Send button enables once name and email pass, all checked in the browser.