@agentic-ui-experience/ui-react 0.0.1-beta.3 → 0.0.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/catalog.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react.d.ts +3 -2
- package/dist/react.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
React adapter for `@agentic-ui-experience/ui-runtime`.
|
|
4
4
|
|
|
5
|
-
This package contains the React hooks, the default A2UI
|
|
5
|
+
This package is the React **Renderer** layer: it turns validated Surface models into UI. It contains the React hooks, the default A2UI-based Surface Renderer,
|
|
6
6
|
this package's `basicCatalog` wrapper, and `defineCatalog` for React component
|
|
7
7
|
implementations. Prompt descriptors live in
|
|
8
8
|
`@agentic-ui-experience/ui-core`, not in this React package. Import the
|
|
9
9
|
framework-agnostic runtime directly from
|
|
10
10
|
`@agentic-ui-experience/ui-runtime` when you do not need React.
|
|
11
11
|
|
|
12
|
+
See the [project glossary](../../docs/glossary.md) for the distinction between Runtime and Renderer.
|
|
13
|
+
|
|
12
14
|
## Quick start
|
|
13
15
|
|
|
14
16
|
```tsx
|
|
@@ -27,7 +29,11 @@ function FieldApp({ field }) {
|
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
`useUIRuntime` defaults to this package's `basicCatalog` wrapper. Pass
|
|
30
|
-
`
|
|
32
|
+
`catalog` when your app uses custom components. It takes one catalog, not a
|
|
33
|
+
list — merge vocabularies with `defineCatalog({ extends })`. Incoming messages
|
|
34
|
+
accept only `v0.9.1`; legacy wire version `v0.9` is rejected. The inherited
|
|
35
|
+
`protocolVersion` option controls only new client data-model messages and
|
|
36
|
+
supports only `v0.9.1`.
|
|
31
37
|
|
|
32
38
|
## User actions
|
|
33
39
|
|
|
@@ -51,7 +57,7 @@ or add a custom catalog component with an explicit action prop.
|
|
|
51
57
|
| `useUIAgent(runtime)` | Subscribe a component to a runtime via `useSyncExternalStore` and return `UIRuntimeState`. `UIAgentSurface` already calls this internally. |
|
|
52
58
|
|
|
53
59
|
`UseUIRuntimeOptions` ⊆ `UIRuntimeOptions` (from `ui-runtime`), but
|
|
54
|
-
`
|
|
60
|
+
`catalog` becomes optional (defaults to `basicCatalog`).
|
|
55
61
|
|
|
56
62
|
### Surface component
|
|
57
63
|
|
|
@@ -112,7 +118,7 @@ export const weatherCatalog = defineCatalog({
|
|
|
112
118
|
```
|
|
113
119
|
|
|
114
120
|
Build the prompt descriptor separately in `@agentic-ui-experience/ui-core`
|
|
115
|
-
and pass `weatherCatalog` to `useUIRuntime({
|
|
121
|
+
and pass `weatherCatalog` to `useUIRuntime({ catalog: weatherCatalog })`.
|
|
116
122
|
|
|
117
123
|
The component `schema` is the **single source of truth**. The same Zod
|
|
118
124
|
schema is reused three ways: the prompt descriptor turns it into JSON
|
package/dist/catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x348b(_0x2ea639,_0x216478){_0x2ea639=_0x2ea639-0x1b7;const _0x409dc0=_0x409d();let _0x348b0c=_0x409dc0[_0x2ea639];return _0x348b0c;}(function(_0x3d5f15,_0x558854){const _0x29ae17=_0x348b,_0x2b96cc=_0x3d5f15();while(!![]){try{const _0x4bc8df=-parseInt(_0x29ae17(0x1b9))/0x1*(-parseInt(_0x29ae17(0x1bc))/0x2)+parseInt(_0x29ae17(0x1c4))/0x3*(-parseInt(_0x29ae17(0x1c1))/0x4)+-parseInt(_0x29ae17(0x1c6))/0x5*(parseInt(_0x29ae17(0x1c0))/0x6)+parseInt(_0x29ae17(0x1b8))/0x7+-parseInt(_0x29ae17(0x1be))/0x8*(parseInt(_0x29ae17(0x1b7))/0x9)+-parseInt(_0x29ae17(0x1c2))/0xa*(parseInt(_0x29ae17(0x1bf))/0xb)+parseInt(_0x29ae17(0x1ba))/0xc;if(_0x4bc8df===_0x558854)break;else _0x2b96cc['push'](_0x2b96cc['shift']());}catch(_0xd61d72){_0x2b96cc['push'](_0x2b96cc['shift']());}}}(_0x409d,0x4aeff));import{basicCatalog as _0x406cea}from'@a2ui/react/v0_9';import{Catalog}from'@a2ui/web_core/v0_9';import{A2UI_BASIC_CATALOG_ID}from'@agentic-ui-experience/ui-core';function _0x409d(){const _0x1f0023=['9IEOHsM','343434Hsjoux','188197WseyBR','20862444HTCQoO','themeSchema','2INpTtg','values','2223856ZxtxGb','2101subrou','3488118RTKkeh','16iPRHRA','15820SFpjnb','components','380517YwLlZY','functions','5EViPXo'];_0x409d=function(){return _0x1f0023;};return _0x409d();}function defineCatalog(_0xc08932){const _0x4ae7af=_0x348b,_0x716921=_0xc08932['extends']??basicCatalog,_0x265e78=_0xc08932[_0x4ae7af(0x1c3)]??[],_0xf6213d=[..._0x716921[_0x4ae7af(0x1c3)]['values'](),..._0x265e78],_0x509be3=[..._0x716921[_0x4ae7af(0x1c5)]['values']()],_0x5678c7=new Catalog(_0xc08932['id'],_0xf6213d,_0x509be3,_0x716921[_0x4ae7af(0x1bb)]);return _0x5678c7;}const defineReactCatalog=defineCatalog;function cloneCatalog(_0x4a0d10,_0x11c418=_0x4a0d10['id']){const _0x31dfc2=_0x348b;return new Catalog(_0x11c418,[..._0x4a0d10['components'][_0x31dfc2(0x1bd)]()],[..._0x4a0d10[_0x31dfc2(0x1c5)][_0x31dfc2(0x1bd)]()],_0x4a0d10[_0x31dfc2(0x1bb)]);}const basicCatalog=cloneCatalog(_0x406cea,A2UI_BASIC_CATALOG_ID);export{basicCatalog,defineCatalog,defineReactCatalog};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x240b30,_0x4042b3){var _0x299622=_0x4879,_0x366c24=_0x240b30();while(!![]){try{var _0x58d79a=parseInt(_0x299622(0x1b0))/0x1*(-parseInt(_0x299622(0x1b8))/0x2)+parseInt(_0x299622(0x1b1))/0x3+parseInt(_0x299622(0x1b5))/0x4*(parseInt(_0x299622(0x1af))/0x5)+-parseInt(_0x299622(0x1b9))/0x6*(-parseInt(_0x299622(0x1b4))/0x7)+-parseInt(_0x299622(0x1ba))/0x8*(-parseInt(_0x299622(0x1b7))/0x9)+-parseInt(_0x299622(0x1b3))/0xa*(parseInt(_0x299622(0x1b2))/0xb)+parseInt(_0x299622(0x1b6))/0xc;if(_0x58d79a===_0x4042b3)break;else _0x366c24['push'](_0x366c24['shift']());}catch(_0x1c4212){_0x366c24['push'](_0x366c24['shift']());}}}(_0x57a8,0x89550));import{basicCatalog,defineCatalog,defineReactCatalog}from'./catalog.js';import{UIAgentSurface,useUIAgent,useUIRuntime}from'./react.js';function _0x4879(_0xfbe62,_0x74267b){_0xfbe62=_0xfbe62-0x1af;var _0x57a837=_0x57a8();var _0x4879e9=_0x57a837[_0xfbe62];return _0x4879e9;}import{createBinderlessComponentImplementation,createComponentImplementation}from'@a2ui/react/v0_9';import{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema}from'@a2ui/web_core/v0_9';import{z}from'zod';export{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema,UIAgentSurface,basicCatalog,createBinderlessComponentImplementation,createComponentImplementation,defineCatalog,defineReactCatalog,useUIAgent,useUIRuntime,z};function _0x57a8(){var _0x2d478b=['10290841kbFKgn','10GyMBya','128086jgnLaO','96GDGxnK','1909716kCCJSu','9SlzRGM','1626236HOFbkf','42YsgBrb','4746096RcUsIh','94235yEtWmJ','1ieolsp','2935026zKcqFR'];_0x57a8=function(){return _0x2d478b;};return _0x57a8();}
|
package/dist/react.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ type ReactUIRuntimeOptions = UIRuntimeOptions<ReactComponentImplementation>;
|
|
|
5
5
|
type ReactUIRuntimeState = UIRuntimeState<ReactComponentImplementation>;
|
|
6
6
|
type ReactUIRuntimeSurface = UIRuntimeSurface<ReactComponentImplementation>;
|
|
7
7
|
export declare function useUIAgent(runtime: ReactUIRuntime): ReactUIRuntimeState;
|
|
8
|
-
export interface UseUIRuntimeOptions extends Omit<ReactUIRuntimeOptions, "
|
|
9
|
-
|
|
8
|
+
export interface UseUIRuntimeOptions extends Omit<ReactUIRuntimeOptions, "catalog" | "onAction" | "onError"> {
|
|
9
|
+
/** Defaults to the A2UI basic catalog. */
|
|
10
|
+
catalog?: ReactUIRuntimeOptions["catalog"];
|
|
10
11
|
onAction?: (action: UIAction) => void;
|
|
11
12
|
onError?: (error: UIRuntimeError) => void;
|
|
12
13
|
}
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x39a805,_0x1bf8d7){const _0x586edd=_0x3020,_0x1ee8e8=_0x39a805();while(!![]){try{const _0x40501f=-parseInt(_0x586edd(0x150))/0x1+parseInt(_0x586edd(0x153))/0x2*(parseInt(_0x586edd(0x14e))/0x3)+parseInt(_0x586edd(0x14c))/0x4+-parseInt(_0x586edd(0x145))/0x5+parseInt(_0x586edd(0x148))/0x6*(-parseInt(_0x586edd(0x151))/0x7)+parseInt(_0x586edd(0x147))/0x8+-parseInt(_0x586edd(0x143))/0x9*(parseInt(_0x586edd(0x149))/0xa);if(_0x40501f===_0x1bf8d7)break;else _0x1ee8e8['push'](_0x1ee8e8['shift']());}catch(_0x1fd929){_0x1ee8e8['push'](_0x1ee8e8['shift']());}}}(_0x5a11,0x1f5c3));import{jsx}from'react/jsx-runtime';import{useSyncExternalStore,useRef,useState}from'react';import{MarkdownContext,A2uiSurface}from'@a2ui/react/v0_9';import{renderMarkdown}from'@a2ui/markdown-it';import{createUIRuntime}from'@agentic-ui-experience/ui-runtime';import{basicCatalog}from'./catalog.js';function useUIAgent(_0xe93b13){return useSyncExternalStore(_0xe93b13['subscribe'],_0xe93b13['getState'],_0xe93b13['getState']);}function useUIRuntime(_0x292ec2={}){const _0x43879c=_0x3020,_0x4dec71=useRef(_0x292ec2['onAction']),_0x1d3d2d=useRef(_0x292ec2[_0x43879c(0x14d)]);_0x4dec71['current']=_0x292ec2[_0x43879c(0x144)],_0x1d3d2d[_0x43879c(0x14b)]=_0x292ec2['onError'];const {catalog:catalog=basicCatalog,normalizeMode:_0x5529be,protocolVersion:_0x31dac5}=_0x292ec2,[_0x1d5fb8]=useState(()=>createUIRuntime({'catalog':catalog,..._0x5529be?{'normalizeMode':_0x5529be}:{},..._0x31dac5?{'protocolVersion':_0x31dac5}:{},'onAction':_0x39bfcd=>_0x4dec71[_0x43879c(0x14b)]?.(_0x39bfcd),'onError':_0x1fc907=>_0x1d3d2d[_0x43879c(0x14b)]?.(_0x1fc907)}));return _0x1d5fb8;}function _0x3020(_0x441f4f,_0x32d262){_0x441f4f=_0x441f4f-0x142;const _0x5a1188=_0x5a11();let _0x30206e=_0x5a1188[_0x441f4f];return _0x30206e;}function UIAgentSurface(_0x47381b){const _0x1feac7=_0x3020,_0x332468=useUIAgent(_0x47381b[_0x1feac7(0x14a)]);if(_0x332468[_0x1feac7(0x152)][_0x1feac7(0x14f)]===0x0)return _0x47381b[_0x1feac7(0x142)]?.()??null;return jsx(MarkdownContext['Provider'],{'value':renderMarkdown,'children':_0x332468['surfaces']['map'](_0x15b49c=>{const _0x45d51d=_0x1feac7;if(_0x47381b[_0x45d51d(0x146)])return jsx('div',{'data-a2ui-surface':_0x15b49c['id'],'children':_0x47381b[_0x45d51d(0x146)](_0x15b49c)},_0x15b49c['id']);return jsx(_0x45d51d(0x154),{'data-a2ui-surface':_0x15b49c['id'],'children':jsx(A2uiSurface,{'surface':_0x15b49c})},_0x15b49c['id']);})});}export{UIAgentSurface,useUIAgent,useUIRuntime};function _0x5a11(){const _0x215d6b=['div','renderEmpty','27lgUptY','onAction','1075770QKfsez','renderSurface','370992WlBkZc','69750vutNSz','38710EqZVfe','runtime','current','995836ovmZpP','onError','578463BmOMPu','length','51561loskcE','49KcPLbL','surfaces','2RrGKnv'];_0x5a11=function(){return _0x215d6b;};return _0x5a11();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-ui-experience/ui-react",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@a2ui/react": "0.9.0",
|
|
23
23
|
"@a2ui/web_core": "0.9.2",
|
|
24
24
|
"zod": "^3.25.76",
|
|
25
|
-
"@agentic-ui-experience/ui-core": "0.0.1-beta.
|
|
26
|
-
"@agentic-ui-experience/ui-runtime": "0.0.1-beta.
|
|
25
|
+
"@agentic-ui-experience/ui-core": "0.0.1-beta.5",
|
|
26
|
+
"@agentic-ui-experience/ui-runtime": "0.0.1-beta.5"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^18.0.0 || ^19.0.0",
|