@agentic-ui-experience/ui-react 0.0.1-beta.2 → 0.0.1-beta.4

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 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 surface renderer,
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,8 @@ function FieldApp({ field }) {
27
29
  ```
28
30
 
29
31
  `useUIRuntime` defaults to this package's `basicCatalog` wrapper. Pass
30
- `catalogs` when your app uses custom components.
32
+ `catalog` when your app uses custom components. It takes one catalog, not a
33
+ list — merge vocabularies with `defineCatalog({ extends })`.
31
34
 
32
35
  ## User actions
33
36
 
@@ -51,7 +54,7 @@ or add a custom catalog component with an explicit action prop.
51
54
  | `useUIAgent(runtime)` | Subscribe a component to a runtime via `useSyncExternalStore` and return `UIRuntimeState`. `UIAgentSurface` already calls this internally. |
52
55
 
53
56
  `UseUIRuntimeOptions` ⊆ `UIRuntimeOptions` (from `ui-runtime`), but
54
- `catalogs` becomes optional (defaults to `[basicCatalog]`).
57
+ `catalog` becomes optional (defaults to `basicCatalog`).
55
58
 
56
59
  ### Surface component
57
60
 
@@ -112,7 +115,7 @@ export const weatherCatalog = defineCatalog({
112
115
  ```
113
116
 
114
117
  Build the prompt descriptor separately in `@agentic-ui-experience/ui-core`
115
- and pass `weatherCatalog` to `useUIRuntime({ catalogs: [weatherCatalog] })`.
118
+ and pass `weatherCatalog` to `useUIRuntime({ catalog: weatherCatalog })`.
116
119
 
117
120
  The component `schema` is the **single source of truth**. The same Zod
118
121
  schema is reused three ways: the prompt descriptor turns it into JSON
package/dist/catalog.js CHANGED
@@ -1 +1 @@
1
- (function(_0x49dba3,_0x5aecf7){const _0x4c026b=_0x486b,_0x1a4667=_0x49dba3();while(!![]){try{const _0x4359b9=-parseInt(_0x4c026b(0x1f3))/0x1+-parseInt(_0x4c026b(0x1f9))/0x2+parseInt(_0x4c026b(0x1f7))/0x3*(-parseInt(_0x4c026b(0x1f1))/0x4)+parseInt(_0x4c026b(0x1f4))/0x5*(-parseInt(_0x4c026b(0x1ef))/0x6)+-parseInt(_0x4c026b(0x1fa))/0x7+-parseInt(_0x4c026b(0x1fb))/0x8*(parseInt(_0x4c026b(0x1f2))/0x9)+parseInt(_0x4c026b(0x1f6))/0xa;if(_0x4359b9===_0x5aecf7)break;else _0x1a4667['push'](_0x1a4667['shift']());}catch(_0x473c8d){_0x1a4667['push'](_0x1a4667['shift']());}}}(_0x394e,0xe7309));import{basicCatalog as _0x5d96a2}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 defineCatalog(_0x5c1864){const _0x8d6144=_0x486b,_0xec1ef=_0x5c1864[_0x8d6144(0x1ee)]??basicCatalog,_0x31def7=_0x5c1864['components']??[],_0x34d8c6=[..._0xec1ef['components']['values'](),..._0x31def7],_0xa62cae=[..._0xec1ef['functions']['values']()],_0x8412b0=new Catalog(_0x5c1864['id'],_0x34d8c6,_0xa62cae,_0xec1ef['themeSchema']);return _0x8412b0;}function _0x486b(_0xc15b5f,_0x24991b){_0xc15b5f=_0xc15b5f-0x1ee;const _0x394e20=_0x394e();let _0x486b11=_0x394e20[_0xc15b5f];return _0x486b11;}function _0x394e(){const _0xd0e288=['38915730mpRxmM','237828kbQaoc','themeSchema','772408FtTGOR','3539221buoUaC','1256zYlnSB','extends','1194234eKyylV','values','24RgLMqo','47682JxgwZh','148254DtGOPQ','15PBmBoI','functions'];_0x394e=function(){return _0xd0e288;};return _0x394e();}const defineReactCatalog=defineCatalog;function cloneCatalog(_0x37722f,_0x1bd701=_0x37722f['id']){const _0x7bd131=_0x486b;return new Catalog(_0x1bd701,[..._0x37722f['components']['values']()],[..._0x37722f[_0x7bd131(0x1f5)][_0x7bd131(0x1f0)]()],_0x37722f[_0x7bd131(0x1f8)]);}const basicCatalog=cloneCatalog(_0x5d96a2,A2UI_BASIC_CATALOG_ID);export{basicCatalog,defineCatalog,defineReactCatalog};
1
+ (function(_0x3edfb2,_0x12d473){const _0x2fadc2=_0x1c5e,_0x3eb20d=_0x3edfb2();while(!![]){try{const _0x2e05ca=-parseInt(_0x2fadc2(0x1cb))/0x1+parseInt(_0x2fadc2(0x1cf))/0x2*(parseInt(_0x2fadc2(0x1d4))/0x3)+parseInt(_0x2fadc2(0x1ce))/0x4+parseInt(_0x2fadc2(0x1d6))/0x5+-parseInt(_0x2fadc2(0x1d0))/0x6+parseInt(_0x2fadc2(0x1d2))/0x7+-parseInt(_0x2fadc2(0x1d1))/0x8;if(_0x2e05ca===_0x12d473)break;else _0x3eb20d['push'](_0x3eb20d['shift']());}catch(_0x4ac3fb){_0x3eb20d['push'](_0x3eb20d['shift']());}}}(_0x1aee,0xe2dd9));import{basicCatalog as _0xf9aa1}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 defineCatalog(_0x25c2fe){const _0x18d5cb=_0x1c5e,_0x588751=_0x25c2fe[_0x18d5cb(0x1cc)]??basicCatalog,_0x21e5ff=_0x25c2fe[_0x18d5cb(0x1cd)]??[],_0x80f854=[..._0x588751[_0x18d5cb(0x1cd)]['values'](),..._0x21e5ff],_0xc839a6=[..._0x588751['functions']['values']()],_0x2fc266=new Catalog(_0x25c2fe['id'],_0x80f854,_0xc839a6,_0x588751[_0x18d5cb(0x1d5)]);return _0x2fc266;}const defineReactCatalog=defineCatalog;function _0x1aee(){const _0x5bb3d6=['themeSchema','5401835jtXMpA','686403qMNYQv','extends','components','5061264CzPiNT','382xPasYO','6998730SBPXpA','11276832sMEbBU','7116886ibNkGY','values','13026kVtyIh'];_0x1aee=function(){return _0x5bb3d6;};return _0x1aee();}function cloneCatalog(_0x1f1d2d,_0x22b5cc=_0x1f1d2d['id']){const _0x31585c=_0x1c5e;return new Catalog(_0x22b5cc,[..._0x1f1d2d[_0x31585c(0x1cd)][_0x31585c(0x1d3)]()],[..._0x1f1d2d['functions']['values']()],_0x1f1d2d[_0x31585c(0x1d5)]);}const basicCatalog=cloneCatalog(_0xf9aa1,A2UI_BASIC_CATALOG_ID);function _0x1c5e(_0x69d252,_0x3fdfbf){_0x69d252=_0x69d252-0x1cb;const _0x1aeeb3=_0x1aee();let _0x1c5e7=_0x1aeeb3[_0x69d252];return _0x1c5e7;}export{basicCatalog,defineCatalog,defineReactCatalog};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x2b0075,_0x5df3a9){var _0x3fdad0=_0x4b3f,_0x3f3426=_0x2b0075();while(!![]){try{var _0x3e6dfb=parseInt(_0x3fdad0(0x185))/0x1+parseInt(_0x3fdad0(0x17f))/0x2*(parseInt(_0x3fdad0(0x17c))/0x3)+-parseInt(_0x3fdad0(0x181))/0x4+-parseInt(_0x3fdad0(0x182))/0x5*(-parseInt(_0x3fdad0(0x17e))/0x6)+parseInt(_0x3fdad0(0x17d))/0x7+parseInt(_0x3fdad0(0x183))/0x8*(-parseInt(_0x3fdad0(0x184))/0x9)+parseInt(_0x3fdad0(0x180))/0xa;if(_0x3e6dfb===_0x5df3a9)break;else _0x3f3426['push'](_0x3f3426['shift']());}catch(_0x1d4f1a){_0x3f3426['push'](_0x3f3426['shift']());}}}(_0x201d,0x707c4));import{basicCatalog,defineCatalog,defineReactCatalog}from'./catalog.js';import{UIAgentSurface,useUIAgent,useUIRuntime}from'./react.js';function _0x4b3f(_0x14c26f,_0x2d1ce3){_0x14c26f=_0x14c26f-0x17c;var _0x201db0=_0x201d();var _0x4b3fe2=_0x201db0[_0x14c26f];return _0x4b3fe2;}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';function _0x201d(){var _0x2c848b=['9AFKyei','3533404ZHaIxz','12dFsIVk','75898aMtPNy','876330toCxjK','112340qvAyFZ','215565tMGaqk','227408WGKEYA','171OnwaWZ','236441tuxiEE'];_0x201d=function(){return _0x2c848b;};return _0x201d();}export{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema,UIAgentSurface,basicCatalog,createBinderlessComponentImplementation,createComponentImplementation,defineCatalog,defineReactCatalog,useUIAgent,useUIRuntime,z};
1
+ (function(_0x2cc8ca,_0x125415){var _0x56e154=_0x5ef0,_0x3f76d9=_0x2cc8ca();while(!![]){try{var _0x40444b=parseInt(_0x56e154(0x16f))/0x1+parseInt(_0x56e154(0x169))/0x2*(-parseInt(_0x56e154(0x16b))/0x3)+-parseInt(_0x56e154(0x16c))/0x4*(parseInt(_0x56e154(0x16a))/0x5)+-parseInt(_0x56e154(0x16e))/0x6+-parseInt(_0x56e154(0x167))/0x7+parseInt(_0x56e154(0x16d))/0x8+parseInt(_0x56e154(0x168))/0x9;if(_0x40444b===_0x125415)break;else _0x3f76d9['push'](_0x3f76d9['shift']());}catch(_0x597d5b){_0x3f76d9['push'](_0x3f76d9['shift']());}}}(_0x1b0e,0x948dc));import{basicCatalog,defineCatalog,defineReactCatalog}from'./catalog.js';import{UIAgentSurface,useUIAgent,useUIRuntime}from'./react.js';function _0x1b0e(){var _0x460dbf=['1970876fJwwfX','69690qBJvfu','3bqcYwe','140cncklS','2369376kcIqhK','1631478quaqSv','537083inTmjv','8489768vuejbj','24599034vuAZoC'];_0x1b0e=function(){return _0x460dbf;};return _0x1b0e();}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';function _0x5ef0(_0x246b6f,_0x1adb1c){_0x246b6f=_0x246b6f-0x167;var _0x1b0ebb=_0x1b0e();var _0x5ef031=_0x1b0ebb[_0x246b6f];return _0x5ef031;}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};
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, "catalogs" | "onAction" | "onError"> {
9
- catalogs?: ReactUIRuntimeOptions["catalogs"];
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 _0x48d5(){const _0x1f7ee6=['onAction','current','86IVNGcg','map','427SOQGMB','onError','4592140MbjYRJ','runtime','88765RhnouC','23928DPktWJ','1158008RXcFGw','subscribe','4BkaapY','getState','36JBEgeJ','16253875anRpjo','Provider','7221sVevsa','236223RJQDFY'];_0x48d5=function(){return _0x1f7ee6;};return _0x48d5();}(function(_0x52d58c,_0x2c0efa){const _0x4f5d7d=_0x2312,_0x43bb71=_0x52d58c();while(!![]){try{const _0x3bfe84=-parseInt(_0x4f5d7d(0x161))/0x1+parseInt(_0x4f5d7d(0x151))/0x2*(-parseInt(_0x4f5d7d(0x160))/0x3)+parseInt(_0x4f5d7d(0x15b))/0x4*(parseInt(_0x4f5d7d(0x157))/0x5)+-parseInt(_0x4f5d7d(0x158))/0x6*(-parseInt(_0x4f5d7d(0x153))/0x7)+parseInt(_0x4f5d7d(0x159))/0x8*(-parseInt(_0x4f5d7d(0x15d))/0x9)+-parseInt(_0x4f5d7d(0x155))/0xa+parseInt(_0x4f5d7d(0x15e))/0xb;if(_0x3bfe84===_0x2c0efa)break;else _0x43bb71['push'](_0x43bb71['shift']());}catch(_0x1fd842){_0x43bb71['push'](_0x43bb71['shift']());}}}(_0x48d5,0x58100));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 _0x2312(_0x104d3f,_0x6cb3d4){_0x104d3f=_0x104d3f-0x150;const _0x48d54e=_0x48d5();let _0x231290=_0x48d54e[_0x104d3f];return _0x231290;}function useUIAgent(_0x49a59b){const _0x35e126=_0x2312;return useSyncExternalStore(_0x49a59b[_0x35e126(0x15a)],_0x49a59b['getState'],_0x49a59b[_0x35e126(0x15c)]);}function useUIRuntime(_0x53c0a8={}){const _0x3a2ae0=_0x2312,_0x194a0a=useRef(_0x53c0a8[_0x3a2ae0(0x162)]),_0x4dc27e=useRef(_0x53c0a8[_0x3a2ae0(0x154)]);_0x194a0a[_0x3a2ae0(0x150)]=_0x53c0a8[_0x3a2ae0(0x162)],_0x4dc27e[_0x3a2ae0(0x150)]=_0x53c0a8['onError'];const {catalogs:catalogs=[basicCatalog],normalizeMode:_0x34083f}=_0x53c0a8,[_0x335f56]=useState(()=>createUIRuntime({'catalogs':catalogs,..._0x34083f?{'normalizeMode':_0x34083f}:{},'onAction':_0x557000=>_0x194a0a['current']?.(_0x557000),'onError':_0x3b40e2=>_0x4dc27e['current']?.(_0x3b40e2)}));return _0x335f56;}function UIAgentSurface(_0x5e0d14){const _0x5944ff=_0x2312,_0x215f68=useUIAgent(_0x5e0d14[_0x5944ff(0x156)]);if(_0x215f68['surfaces']['length']===0x0)return _0x5e0d14['renderEmpty']?.()??null;return jsx(MarkdownContext[_0x5944ff(0x15f)],{'value':renderMarkdown,'children':_0x215f68['surfaces'][_0x5944ff(0x152)](_0x2c67c2=>{if(_0x5e0d14['renderSurface'])return jsx('div',{'data-a2ui-surface':_0x2c67c2['id'],'children':_0x5e0d14['renderSurface'](_0x2c67c2)},_0x2c67c2['id']);return jsx('div',{'data-a2ui-surface':_0x2c67c2['id'],'children':jsx(A2uiSurface,{'surface':_0x2c67c2})},_0x2c67c2['id']);})});}export{UIAgentSurface,useUIAgent,useUIRuntime};
1
+ (function(_0xe3995e,_0xd6bc8c){const _0x257661=_0x51d4,_0x2d9ea7=_0xe3995e();while(!![]){try{const _0xeb074c=parseInt(_0x257661(0x1e2))/0x1+parseInt(_0x257661(0x1da))/0x2+parseInt(_0x257661(0x1db))/0x3+parseInt(_0x257661(0x1d7))/0x4*(-parseInt(_0x257661(0x1e0))/0x5)+-parseInt(_0x257661(0x1dd))/0x6*(parseInt(_0x257661(0x1d6))/0x7)+parseInt(_0x257661(0x1df))/0x8*(-parseInt(_0x257661(0x1e1))/0x9)+parseInt(_0x257661(0x1e4))/0xa*(parseInt(_0x257661(0x1de))/0xb);if(_0xeb074c===_0xd6bc8c)break;else _0x2d9ea7['push'](_0x2d9ea7['shift']());}catch(_0x340958){_0x2d9ea7['push'](_0x2d9ea7['shift']());}}}(_0x3b80,0x6d358));import{jsx}from'react/jsx-runtime';import{useSyncExternalStore,useRef,useState}from'react';import{MarkdownContext,A2uiSurface}from'@a2ui/react/v0_9';function _0x3b80(){const _0x3a68a8=['surfaces','current','1634614qeWjdT','928587KUJeDM','length','1222488zOEKGV','11ZUyyMH','6021544FhkfhQ','5IUinII','9lFRsYl','529893azGGsg','onAction','362890NyLSQQ','map','14ncNgQl','342036nIhXHw'];_0x3b80=function(){return _0x3a68a8;};return _0x3b80();}import{renderMarkdown}from'@a2ui/markdown-it';import{createUIRuntime}from'@agentic-ui-experience/ui-runtime';import{basicCatalog}from'./catalog.js';function useUIAgent(_0x3452da){return useSyncExternalStore(_0x3452da['subscribe'],_0x3452da['getState'],_0x3452da['getState']);}function useUIRuntime(_0x4e3c88={}){const _0x160aeb=_0x51d4,_0x2e3ca9=useRef(_0x4e3c88['onAction']),_0x371086=useRef(_0x4e3c88['onError']);_0x2e3ca9['current']=_0x4e3c88[_0x160aeb(0x1e3)],_0x371086['current']=_0x4e3c88['onError'];const {catalog:catalog=basicCatalog,normalizeMode:_0x5f0396}=_0x4e3c88,[_0x712892]=useState(()=>createUIRuntime({'catalog':catalog,..._0x5f0396?{'normalizeMode':_0x5f0396}:{},'onAction':_0x2435f1=>_0x2e3ca9[_0x160aeb(0x1d9)]?.(_0x2435f1),'onError':_0x3fa944=>_0x371086[_0x160aeb(0x1d9)]?.(_0x3fa944)}));return _0x712892;}function UIAgentSurface(_0x32d42d){const _0x13b587=_0x51d4,_0x539907=useUIAgent(_0x32d42d['runtime']);if(_0x539907['surfaces'][_0x13b587(0x1dc)]===0x0)return _0x32d42d['renderEmpty']?.()??null;return jsx(MarkdownContext['Provider'],{'value':renderMarkdown,'children':_0x539907[_0x13b587(0x1d8)][_0x13b587(0x1e5)](_0x490f02=>{if(_0x32d42d['renderSurface'])return jsx('div',{'data-a2ui-surface':_0x490f02['id'],'children':_0x32d42d['renderSurface'](_0x490f02)},_0x490f02['id']);return jsx('div',{'data-a2ui-surface':_0x490f02['id'],'children':jsx(A2uiSurface,{'surface':_0x490f02})},_0x490f02['id']);})});}function _0x51d4(_0x259011,_0x27d6fc){_0x259011=_0x259011-0x1d6;const _0x3b8036=_0x3b80();let _0x51d4ee=_0x3b8036[_0x259011];return _0x51d4ee;}export{UIAgentSurface,useUIAgent,useUIRuntime};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-ui-experience/ui-react",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.4",
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-runtime": "0.0.1-beta.2",
26
- "@agentic-ui-experience/ui-core": "0.0.1-beta.2"
25
+ "@agentic-ui-experience/ui-core": "0.0.1-beta.4",
26
+ "@agentic-ui-experience/ui-runtime": "0.0.1-beta.4"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^18.0.0 || ^19.0.0",