@agentic-ui-experience/ui-runtime 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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # @agentic-ui-experience/ui-runtime
2
2
 
3
- `@agentic-ui-experience/ui-runtime` is the runtime state layer for UI messages: it accepts the UI messages emitted by an agent, parses and validates components against the catalogs registered by the host, maintains subscribable UI state, and dispatches the actions the user triggers in the UI back to the host.
3
+ `@agentic-ui-experience/ui-runtime` is the runtime state layer for UI messages: it accepts the UI messages emitted by an agent, parses and validates components against the catalog configured by the host, maintains subscribable UI state, and dispatches the actions the user triggers in the UI back to the host.
4
4
 
5
- It does not build prompts and does not render components; React hosts usually use `@agentic-ui-experience/ui-react` directly.
5
+ Here **Runtime** means the frontend layer that consumes UI messages and maintains Surface state. It does not build prompts or render components; React Host apps usually use the Renderer binding in `@agentic-ui-experience/ui-react` directly. See the [project glossary](../../docs/glossary.md) for the related definitions.
6
6
 
7
7
  ```text
8
8
  Agent output
@@ -22,7 +22,7 @@ Create a runtime instance:
22
22
  import { createUIRuntime } from "@agentic-ui-experience/ui-runtime";
23
23
 
24
24
  const runtime = createUIRuntime({
25
- catalogs: [appCatalog],
25
+ catalog: appCatalog,
26
26
  onAction: (action) => {
27
27
  // Send the user action back to the agent or business logic.
28
28
  },
@@ -32,7 +32,9 @@ const runtime = createUIRuntime({
32
32
  });
33
33
  ```
34
34
 
35
- `catalogs` is required: the runtime uses it to recognize component names and to validate the props emitted by the agent against each component's own Zod schema. `normalizeMode` defaults to `"repair"`, which drops invalid components or messages and keeps as much valid content as possible; `"strict"` stops at the first error and exposes it through `onError` / `errors`.
35
+ `catalog` is required: the runtime uses it to recognize component names and to validate the props emitted by the agent against each component's own Zod schema. It is a single catalog, not a list — A2UI fixes a surface's catalog at `createSurface` time and never composes two catalogs into one component tree, so combine vocabularies with `defineCatalog({ extends })` instead. `normalizeMode` defaults to `"repair"`, which drops invalid components or messages and keeps as much valid content as possible; `"strict"` stops at the first error and exposes it through `onError` / `errors`.
36
+
37
+ Incoming messages accept only `v0.9.1`; legacy wire version `v0.9` is rejected. `protocolVersion` affects only client data-model messages generated by this runtime and supports only `v0.9.1`.
36
38
 
37
39
  ### `ingest()`
38
40
 
@@ -44,6 +46,38 @@ runtime.ingest(modelOutput);
44
46
 
45
47
  `modelOutput` can be a full assistant text response, a `<a2ui-json>` envelope, a UI message array, or an object containing `uiMessages` / `messages`. The runtime calls `normalizeUIResponse()` internally, so the host usually does not need to parse first.
46
48
 
49
+ ### `ingestTransaction()`
50
+
51
+ Publish a prevalidated batch and synchronize host-owned state before subscribers
52
+ observe it:
53
+
54
+ ```ts
55
+ const accepted = runtime.ingestTransaction(messages, () => {
56
+ commitHostState();
57
+ });
58
+ ```
59
+
60
+ The runtime applies the batch to an isolated copy of the current processor,
61
+ calls the optional commit synchronously, and adopts the candidate processor only
62
+ after that callback returns. Code inside the callback may call `getState()` to
63
+ validate the candidate, while subscribers continue to see the prior state until
64
+ the atomic adoption and single notification. If the callback throws,
65
+ `ingestTransaction()` returns `false` without publishing the candidate, changing
66
+ assistant text or errors, notifying subscribers, or reporting the callback as a
67
+ runtime UI error. Runtime mutations other than `getState()` and other read APIs
68
+ are not allowed from inside the callback.
69
+
70
+ A successful transaction adopts a new processor snapshot. Subscribers should
71
+ read `getState()` after the notification instead of retaining a previous
72
+ `SurfaceModel` reference and expecting that object to be mutated in place.
73
+
74
+ It also returns `false` and does not call the commit when the runtime is
75
+ disposed, the batch contains no UI messages, or normalization/processing rejects
76
+ the candidate. A normalization or processing rejection may still be reported in
77
+ `errors`, but partially processed candidate messages never mutate live surfaces.
78
+ Use this for host-generated data bindings that must become visible atomically
79
+ with a surface replacement; keep `ingest()` for ordinary one-shot model output.
80
+
47
81
  ### `ingestStreaming()` / `endStream()`
48
82
 
49
83
  Process a streaming output:
@@ -103,6 +137,8 @@ const surface = {
103
137
 
104
138
  In short, a `SurfaceModel` represents one renderable UI region: `componentsModel` holds the component tree / component set, and `dataModel` holds the input state. The rendering layer usually consumes the whole `surface` object instead of assembling components by hand.
105
139
 
140
+ A `surfaceId` must be unique among active surfaces. A duplicate active `createSurface` is an error; once `deleteSurface` removes that surface, the ID may be reused.
141
+
106
142
  ### Action dispatch
107
143
 
108
144
  User interaction with a surface falls into two kinds; only the first triggers `onAction`:
@@ -133,7 +169,7 @@ The full loop is: the agent emits a button with an `action` in a UI message →
133
169
 
134
170
  ```ts
135
171
  const runtime = createUIRuntime({
136
- catalogs,
172
+ catalog,
137
173
  onAction: (action) => {
138
174
  action.name; // "submitForm"
139
175
  action.context; // { source: "signup" }
@@ -1 +1 @@
1
- (function(_0x2184d0,_0x3e3243){var _0x3ebbdc=_0x2b08,_0xe19aff=_0x2184d0();while(!![]){try{var _0x3ab040=parseInt(_0x3ebbdc(0x1bf))/0x1*(parseInt(_0x3ebbdc(0x1c1))/0x2)+-parseInt(_0x3ebbdc(0x1b6))/0x3*(-parseInt(_0x3ebbdc(0x1be))/0x4)+-parseInt(_0x3ebbdc(0x1b9))/0x5+-parseInt(_0x3ebbdc(0x1b8))/0x6*(-parseInt(_0x3ebbdc(0x1c0))/0x7)+parseInt(_0x3ebbdc(0x1b7))/0x8*(-parseInt(_0x3ebbdc(0x1ba))/0x9)+-parseInt(_0x3ebbdc(0x1bd))/0xa*(parseInt(_0x3ebbdc(0x1bc))/0xb)+parseInt(_0x3ebbdc(0x1bb))/0xc;if(_0x3ab040===_0x3e3243)break;else _0xe19aff['push'](_0xe19aff['shift']());}catch(_0x15b491){_0xe19aff['push'](_0xe19aff['shift']());}}}(_0x1722,0x56fab));export*from'@a2ui/web_core/v0_9/basic_catalog';function _0x2b08(_0x36071a,_0x2c5064){_0x36071a=_0x36071a-0x1b6;var _0x17220f=_0x1722();var _0x2b088a=_0x17220f[_0x36071a];return _0x2b088a;}function _0x1722(){var _0x4b2d05=['3IPHpCx','242382UbUvCT','282292xSlnVq','8583cFTWvg','126448qPHlkJ','54WInFHg','2861975lJBwLX','171ikyCQl','5395428FoaOTU','5995891LAFvqE','10RyHRQI','824QFIxdI'];_0x1722=function(){return _0x4b2d05;};return _0x1722();}
1
+ function _0x4e43(){var _0x52a0bc=['494886VsQUJW','12717lpiGjg','1640595qovxCE','1528275tGfFYc','12oosvPS','19129260eyVENh','4063352sHovIH','239154RoPmJt','4976txistD','3tOWqSO'];_0x4e43=function(){return _0x52a0bc;};return _0x4e43();}(function(_0x39c674,_0x368d74){var _0x14b023=_0x5392,_0x56ce1f=_0x39c674();while(!![]){try{var _0x5eee2b=-parseInt(_0x14b023(0xed))/0x1+-parseInt(_0x14b023(0xf0))/0x2*(-parseInt(_0x14b023(0xef))/0x3)+parseInt(_0x14b023(0xec))/0x4+-parseInt(_0x14b023(0xe8))/0x5*(-parseInt(_0x14b023(0xea))/0x6)+parseInt(_0x14b023(0xe9))/0x7+parseInt(_0x14b023(0xee))/0x8*(parseInt(_0x14b023(0xf1))/0x9)+-parseInt(_0x14b023(0xeb))/0xa;if(_0x5eee2b===_0x368d74)break;else _0x56ce1f['push'](_0x56ce1f['shift']());}catch(_0x3a433c){_0x56ce1f['push'](_0x56ce1f['shift']());}}}(_0x4e43,0xd318a));function _0x5392(_0x4f9e79,_0x2a7c1e){_0x4f9e79=_0x4f9e79-0xe8;var _0x4e4370=_0x4e43();var _0x539277=_0x4e4370[_0x4f9e79];return _0x539277;}export*from'@a2ui/web_core/v0_9/basic_catalog';
package/dist/catalog.js CHANGED
@@ -1 +1 @@
1
- (function(_0x339af3,_0x4bb9c8){const _0x5827d0=_0x4aa9,_0x52b48f=_0x339af3();while(!![]){try{const _0x1d2dd8=-parseInt(_0x5827d0(0xa7))/0x1+-parseInt(_0x5827d0(0xa8))/0x2*(-parseInt(_0x5827d0(0xa9))/0x3)+-parseInt(_0x5827d0(0x9f))/0x4+-parseInt(_0x5827d0(0xa5))/0x5*(parseInt(_0x5827d0(0xa0))/0x6)+parseInt(_0x5827d0(0xa3))/0x7*(parseInt(_0x5827d0(0xab))/0x8)+-parseInt(_0x5827d0(0xa2))/0x9*(-parseInt(_0x5827d0(0xa6))/0xa)+parseInt(_0x5827d0(0xac))/0xb;if(_0x1d2dd8===_0x4bb9c8)break;else _0x52b48f['push'](_0x52b48f['shift']());}catch(_0x2dbb99){_0x52b48f['push'](_0x52b48f['shift']());}}}(_0xe660,0xde021));import{Catalog}from'@a2ui/web_core/v0_9';import{BASIC_COMPONENTS,BASIC_FUNCTIONS}from'@a2ui/web_core/v0_9/basic_catalog';import{A2UI_BASIC_CATALOG_ID}from'@agentic-ui-experience/ui-core';function defineCatalog(_0x35e741){const _0x2a1bb8=_0x4aa9,_0x110616=_0x35e741['extends']??basicCatalog,_0x5629fa=_0x35e741['components']??[],_0x1d9db9=_0x35e741[_0x2a1bb8(0xa4)]??[];return new Catalog(_0x35e741['id'],[..._0x110616['components'][_0x2a1bb8(0xa1)](),..._0x5629fa],[..._0x110616[_0x2a1bb8(0xa4)][_0x2a1bb8(0xa1)](),..._0x1d9db9],_0x110616[_0x2a1bb8(0xaa)]);}const basicCatalog=new Catalog(A2UI_BASIC_CATALOG_ID,BASIC_COMPONENTS,BASIC_FUNCTIONS);function _0x4aa9(_0x43c7d8,_0x87d293){_0x43c7d8=_0x43c7d8-0x9f;const _0xe6605e=_0xe660();let _0x4aa97e=_0xe6605e[_0x43c7d8];return _0x4aa97e;}function _0xe660(){const _0x535908=['8AuJFgc','25034823bSmsJB','4467116oRKUph','8288310vbbHNJ','values','9xSQZUW','200459ZYFyKa','functions','5FccGDS','9323090bDDuoH','1337515bbcUiU','86182xoGsoD','105sJZLkj','themeSchema'];_0xe660=function(){return _0x535908;};return _0xe660();}export{basicCatalog,defineCatalog};
1
+ (function(_0x390f70,_0x4cf24c){const _0x434635=_0x40d9,_0x2e7963=_0x390f70();while(!![]){try{const _0xa244d2=parseInt(_0x434635(0x147))/0x1*(parseInt(_0x434635(0x140))/0x2)+parseInt(_0x434635(0x149))/0x3+-parseInt(_0x434635(0x146))/0x4*(-parseInt(_0x434635(0x14a))/0x5)+parseInt(_0x434635(0x145))/0x6+-parseInt(_0x434635(0x14b))/0x7*(parseInt(_0x434635(0x144))/0x8)+parseInt(_0x434635(0x142))/0x9*(-parseInt(_0x434635(0x14c))/0xa)+parseInt(_0x434635(0x143))/0xb;if(_0xa244d2===_0x4cf24c)break;else _0x2e7963['push'](_0x2e7963['shift']());}catch(_0xdb6837){_0x2e7963['push'](_0x2e7963['shift']());}}}(_0x2011,0x457b9));import{Catalog}from'@a2ui/web_core/v0_9';function _0x2011(){const _0x15b443=['16DsFwSF','565075EJayzE','components','933753yUvOmp','318335eCFqhh','455gcCvox','10nrUebw','2WZWyZU','values','4900113gjOeBr','1747592MkacVv','61896awiSIF','252582KcbJTD'];_0x2011=function(){return _0x15b443;};return _0x2011();}import{BASIC_COMPONENTS,BASIC_FUNCTIONS}from'@a2ui/web_core/v0_9/basic_catalog';import{A2UI_BASIC_CATALOG_ID}from'@agentic-ui-experience/ui-core';function defineCatalog(_0x44cdf1){const _0x453f67=_0x40d9,_0x488175=_0x44cdf1['extends']??basicCatalog,_0x122ca6=_0x44cdf1[_0x453f67(0x148)]??[],_0x342d29=_0x44cdf1['functions']??[];return new Catalog(_0x44cdf1['id'],[..._0x488175['components']['values'](),..._0x122ca6],[..._0x488175['functions'][_0x453f67(0x141)](),..._0x342d29],_0x488175['themeSchema']);}const basicCatalog=new Catalog(A2UI_BASIC_CATALOG_ID,BASIC_COMPONENTS,BASIC_FUNCTIONS);function _0x40d9(_0xc15f76,_0x597613){_0xc15f76=_0xc15f76-0x140;const _0x201102=_0x2011();let _0x40d9d5=_0x201102[_0xc15f76];return _0x40d9d5;}export{basicCatalog,defineCatalog};
@@ -1,3 +1,3 @@
1
1
  import type { Catalog, ComponentApi } from "@a2ui/web_core/v0_9";
2
2
  import type { ComponentValidator } from "@agentic-ui-experience/ui-core";
3
- export declare function createCatalogComponentValidator<TComp extends ComponentApi = ComponentApi>(catalogs: readonly Catalog<TComp>[]): ComponentValidator;
3
+ export declare function createCatalogComponentValidator<TComp extends ComponentApi = ComponentApi>(catalog: Catalog<TComp>): ComponentValidator;
@@ -1 +1 @@
1
- (function(_0x127a5d,_0x2a699e){const _0x2d5292=_0x1a09,_0x20f75e=_0x127a5d();while(!![]){try{const _0x3b82b2=parseInt(_0x2d5292(0x143))/0x1*(-parseInt(_0x2d5292(0x141))/0x2)+-parseInt(_0x2d5292(0x137))/0x3+parseInt(_0x2d5292(0x147))/0x4+parseInt(_0x2d5292(0x138))/0x5*(-parseInt(_0x2d5292(0x140))/0x6)+parseInt(_0x2d5292(0x13b))/0x7+-parseInt(_0x2d5292(0x144))/0x8*(-parseInt(_0x2d5292(0x139))/0x9)+-parseInt(_0x2d5292(0x13e))/0xa*(-parseInt(_0x2d5292(0x13a))/0xb);if(_0x3b82b2===_0x2a699e)break;else _0x20f75e['push'](_0x20f75e['shift']());}catch(_0xfedc24){_0x20f75e['push'](_0x20f75e['shift']());}}}(_0x885f,0x4fba0));function createCatalogComponentValidator(_0x266299){const _0x211e88=_0x1a09,_0x359b2d=new Map();for(const _0x2a84cc of _0x266299){for(const [_0x3b3311,_0x7dbdc3]of _0x2a84cc['components']){if(!_0x359b2d['has'](_0x3b3311))_0x359b2d[_0x211e88(0x13c)](_0x3b3311,_0x7dbdc3['schema']);}}return(_0x53d747,_0x1a09bf)=>{const _0x116570=_0x211e88,_0x1cac27=_0x359b2d['get'](_0x53d747);if(!_0x1cac27)return[_0x116570(0x13f)+_0x53d747+'\x22'];const _0xa3d404={..._0x1a09bf};delete _0xa3d404['id'],delete _0xa3d404['component'],delete _0xa3d404[_0x116570(0x142)],delete _0xa3d404['weight'];const _0xfe7d22=_0x1cac27['safeParse'](_0xa3d404);if(_0xfe7d22[_0x116570(0x146)])return[];return _0xfe7d22[_0x116570(0x145)]['issues'][_0x116570(0x13d)](_0x48ecb1=>{const _0x457743=_0x116570,_0x287757=_0x48ecb1['path'][_0x457743(0x148)]('.');return _0x287757?_0x287757+':\x20'+_0x48ecb1['message']:_0x48ecb1['message'];});};}function _0x1a09(_0x35505e,_0x2238bb){_0x35505e=_0x35505e-0x137;const _0x885f6b=_0x885f();let _0x1a0915=_0x885f6b[_0x35505e];return _0x1a0915;}export{createCatalogComponentValidator};function _0x885f(){const _0x2e011b=['15154980sUGGNT','unknown\x20component\x20\x22','105486UibIgf','32MPfiVE','accessibility','24964iDaLUv','1025208ONXaHn','error','success','89892TMaDgv','join','1851285xqkRXt','165VhFtJc','27OLajLK','11GtOGPr','5796UtyMKb','set','map'];_0x885f=function(){return _0x2e011b;};return _0x885f();}
1
+ (function(_0xee7e9e,_0x56d4cd){const _0xb4ff24=_0x5eaf,_0x11cf3c=_0xee7e9e();while(!![]){try{const _0x3968f6=parseInt(_0xb4ff24(0x1a1))/0x1*(-parseInt(_0xb4ff24(0x1a0))/0x2)+-parseInt(_0xb4ff24(0x1b1))/0x3+-parseInt(_0xb4ff24(0x1ac))/0x4*(-parseInt(_0xb4ff24(0x1ae))/0x5)+parseInt(_0xb4ff24(0x1ad))/0x6*(parseInt(_0xb4ff24(0x1a7))/0x7)+parseInt(_0xb4ff24(0x1a5))/0x8*(parseInt(_0xb4ff24(0x1aa))/0x9)+-parseInt(_0xb4ff24(0x1a4))/0xa*(parseInt(_0xb4ff24(0x1a6))/0xb)+-parseInt(_0xb4ff24(0x1af))/0xc;if(_0x3968f6===_0x56d4cd)break;else _0x11cf3c['push'](_0x11cf3c['shift']());}catch(_0x184430){_0x11cf3c['push'](_0x11cf3c['shift']());}}}(_0x5433,0x90eb2));function _0x5433(){const _0x17ecf3=['accessibility','join','4221CNKent','message','4AeYSkM','110094kkNVuV','5252870OqYnLo','5517648URFupi','safeParse','1511349PidYET','weight','error','components','122308tnxJJq','1JBLxkZ','success','unknown\x20component\x20\x22','470EkjTWV','11288lVgKgE','95007gbfIBN','119ygQKhi'];_0x5433=function(){return _0x17ecf3;};return _0x5433();}function _0x5eaf(_0x437604,_0x6f33f5){_0x437604=_0x437604-0x19f;const _0x5433e1=_0x5433();let _0x5eafc4=_0x5433e1[_0x437604];return _0x5eafc4;}function createCatalogComponentValidator(_0x3c7a41){const _0x496335=_0x5eaf,_0x2c240f=new Map();for(const [_0x2f2f27,_0xfd40c]of _0x3c7a41[_0x496335(0x19f)]){_0x2c240f['set'](_0x2f2f27,_0xfd40c['schema']);}return(_0x41a7f5,_0x3b9fe0)=>{const _0x5e69ce=_0x496335,_0x3b5826=_0x2c240f['get'](_0x41a7f5);if(!_0x3b5826)return[_0x5e69ce(0x1a3)+_0x41a7f5+'\x22'];const _0x2e4649={..._0x3b9fe0};delete _0x2e4649['id'],delete _0x2e4649['component'],delete _0x2e4649[_0x5e69ce(0x1a8)],delete _0x2e4649[_0x5e69ce(0x1b2)];const _0x22f71e=_0x3b5826[_0x5e69ce(0x1b0)](_0x2e4649);if(_0x22f71e[_0x5e69ce(0x1a2)])return[];return _0x22f71e[_0x5e69ce(0x1b3)]['issues']['map'](_0x9b37b2=>{const _0x42dbaf=_0x5e69ce,_0x3eeadb=_0x9b37b2['path'][_0x42dbaf(0x1a9)]('.');return _0x3eeadb?_0x3eeadb+':\x20'+_0x9b37b2['message']:_0x9b37b2[_0x42dbaf(0x1ab)];});};}export{createCatalogComponentValidator};
package/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export { createCatalogComponentValidator } from "./component-validator.js";
4
4
  export { Catalog } from "@a2ui/web_core/v0_9";
5
5
  export type { ComponentApi, FunctionImplementation } from "@a2ui/web_core/v0_9";
6
6
  export { ActionSchema, CheckableSchema, CommonSchemas, DataBindingSchema, DynamicBooleanSchema, DynamicNumberSchema, DynamicStringListSchema, DynamicStringSchema, DynamicValueSchema, FunctionCallSchema } from "@a2ui/web_core/v0_9";
7
- export { z } from "zod";
7
+ export { z } from "zod/v3";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x1172f4,_0x26ba62){var _0x5004e=_0x23e8,_0x13d284=_0x1172f4();while(!![]){try{var _0x5b208e=-parseInt(_0x5004e(0x1c5))/0x1+-parseInt(_0x5004e(0x1c4))/0x2+parseInt(_0x5004e(0x1c0))/0x3*(-parseInt(_0x5004e(0x1be))/0x4)+parseInt(_0x5004e(0x1c3))/0x5+parseInt(_0x5004e(0x1bf))/0x6*(parseInt(_0x5004e(0x1c1))/0x7)+-parseInt(_0x5004e(0x1c6))/0x8+parseInt(_0x5004e(0x1bd))/0x9*(parseInt(_0x5004e(0x1c2))/0xa);if(_0x5b208e===_0x26ba62)break;else _0x13d284['push'](_0x13d284['shift']());}catch(_0x1454be){_0x13d284['push'](_0x13d284['shift']());}}}(_0x2a03,0x75c45));import{basicCatalog,defineCatalog}from'./catalog.js';import{createUIRuntime}from'./runtime.js';import{createCatalogComponentValidator}from'./component-validator.js';function _0x23e8(_0x2c48a1,_0x2cf836){_0x2c48a1=_0x2c48a1-0x1bd;var _0x2a03c7=_0x2a03();var _0x23e8b0=_0x2a03c7[_0x2c48a1];return _0x23e8b0;}function _0x2a03(){var _0x67229f=['962223ezhOUe','409962drdidd','16342030XMBRuO','325495BVeIGj','626030JNWozU','491379QisYwm','3076992FtIZis','9bkNZFy','4aAizvy','30kbCxfG'];_0x2a03=function(){return _0x67229f;};return _0x2a03();}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,basicCatalog,createCatalogComponentValidator,createUIRuntime,defineCatalog,z};
1
+ function _0x5524(_0x423259,_0x3d84c9){_0x423259=_0x423259-0x1ce;var _0x10bcee=_0x10bc();var _0x55242d=_0x10bcee[_0x423259];return _0x55242d;}(function(_0x32c4bd,_0x31b14f){var _0x1db386=_0x5524,_0x567906=_0x32c4bd();while(!![]){try{var _0x1c5c7c=-parseInt(_0x1db386(0x1ce))/0x1+parseInt(_0x1db386(0x1d5))/0x2*(-parseInt(_0x1db386(0x1d3))/0x3)+-parseInt(_0x1db386(0x1d1))/0x4+-parseInt(_0x1db386(0x1d4))/0x5*(parseInt(_0x1db386(0x1cf))/0x6)+-parseInt(_0x1db386(0x1d0))/0x7*(parseInt(_0x1db386(0x1d7))/0x8)+-parseInt(_0x1db386(0x1d8))/0x9+-parseInt(_0x1db386(0x1d2))/0xa*(-parseInt(_0x1db386(0x1d6))/0xb);if(_0x1c5c7c===_0x31b14f)break;else _0x567906['push'](_0x567906['shift']());}catch(_0x14c0f7){_0x567906['push'](_0x567906['shift']());}}}(_0x10bc,0xe935f));import{basicCatalog,defineCatalog}from'./catalog.js';import{createUIRuntime}from'./runtime.js';import{createCatalogComponentValidator}from'./component-validator.js';function _0x10bc(){var _0x257ffd=['676844BRCeKt','10oVcTWO','27TXqNBe','6927535gfVOvV','67910gAwoPs','63827005KKmcWp','24QoAleF','4454937AAGoWY','945235GzLzts','6DzDTku','3608927ajGcYN'];_0x10bc=function(){return _0x257ffd;};return _0x10bc();}import{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema}from'@a2ui/web_core/v0_9';import{z}from'zod/v3';export{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema,basicCatalog,createCatalogComponentValidator,createUIRuntime,defineCatalog,z};
package/dist/runtime.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type CapabilitiesOptions, type Catalog, type ComponentApi, type SurfaceModel } from "@a2ui/web_core/v0_9";
2
- import type { A2uiClientAction, A2uiClientCapabilities, A2uiClientDataModel } from "@a2ui/web_core/v0_9";
3
- import { type NormalizeUIResponseOptions } from "@agentic-ui-experience/ui-core";
2
+ import type { A2uiClientAction, A2uiClientCapabilities } from "@a2ui/web_core/v0_9";
3
+ import { type A2UIProtocolVersion, type NormalizeUIResponseOptions, type SpecA2UIClientDataModel } from "@agentic-ui-experience/ui-core";
4
4
  export type UIRuntimeCatalog<TComp extends ComponentApi = ComponentApi> = Catalog<TComp>;
5
5
  export type UIRuntimeSurface<TComp extends ComponentApi = ComponentApi> = SurfaceModel<TComp>;
6
6
  export type UIAction = A2uiClientAction;
@@ -10,8 +10,19 @@ export type UIRuntimeError = {
10
10
  message: string;
11
11
  };
12
12
  export interface UIRuntimeOptions<TComp extends ComponentApi = ComponentApi> {
13
- catalogs: UIRuntimeCatalog<TComp>[];
13
+ /**
14
+ * The single catalog this runtime renders. A2UI fixes a surface's catalog at
15
+ * `createSurface` time and never composes two catalogs into one component
16
+ * tree, so a runtime that renders more than one vocabulary has no way to
17
+ * express that; combine catalogs at definition time with `defineCatalog`.
18
+ */
19
+ catalog: UIRuntimeCatalog<TComp>;
14
20
  normalizeMode?: NormalizeUIResponseOptions["mode"];
21
+ /**
22
+ * Version used only for client data-model messages generated by this runtime.
23
+ * Incoming server messages always accept every supported protocol version.
24
+ */
25
+ protocolVersion?: A2UIProtocolVersion;
15
26
  onAction?: (action: UIAction) => void;
16
27
  onError?: (error: UIRuntimeError) => void;
17
28
  }
@@ -46,6 +57,12 @@ export interface UIRuntimeState<TComp extends ComponentApi = ComponentApi> {
46
57
  */
47
58
  export interface UIRuntime<TComp extends ComponentApi = ComponentApi> {
48
59
  ingest(payload: unknown): void;
60
+ /**
61
+ * Processes one prevalidated host transaction and invokes `commit` after all
62
+ * messages are accepted but before subscribers observe the new snapshot.
63
+ * Returns false without invoking `commit` when disposed, empty, or rejected.
64
+ */
65
+ ingestTransaction(payload: unknown, commit?: () => void): boolean;
49
66
  ingestStreaming(accumulatedText: string): void;
50
67
  endStream(): void;
51
68
  reset(): void;
@@ -54,6 +71,6 @@ export interface UIRuntime<TComp extends ComponentApi = ComponentApi> {
54
71
  getState(): UIRuntimeState<TComp>;
55
72
  subscribe(listener: () => void): () => void;
56
73
  getClientCapabilities(options?: CapabilitiesOptions): A2uiClientCapabilities;
57
- getClientDataModel(): A2uiClientDataModel | undefined;
74
+ getClientDataModel(): SpecA2UIClientDataModel | undefined;
58
75
  }
59
76
  export declare function createUIRuntime<TComp extends ComponentApi = ComponentApi>(options: UIRuntimeOptions<TComp>): UIRuntime<TComp>;
package/dist/runtime.js CHANGED
@@ -1 +1 @@
1
- (function(_0x171439,_0x507862){const _0x3fc1bc=_0x4e33,_0x2d0488=_0x171439();while(!![]){try{const _0x347407=-parseInt(_0x3fc1bc(0x1db))/0x1*(parseInt(_0x3fc1bc(0x1d4))/0x2)+-parseInt(_0x3fc1bc(0x1ef))/0x3*(parseInt(_0x3fc1bc(0x1cf))/0x4)+-parseInt(_0x3fc1bc(0x1cd))/0x5+-parseInt(_0x3fc1bc(0x1e3))/0x6+-parseInt(_0x3fc1bc(0x1d8))/0x7*(-parseInt(_0x3fc1bc(0x1de))/0x8)+-parseInt(_0x3fc1bc(0x1f0))/0x9*(parseInt(_0x3fc1bc(0x1ca))/0xa)+parseInt(_0x3fc1bc(0x1ce))/0xb*(parseInt(_0x3fc1bc(0x1d6))/0xc);if(_0x347407===_0x507862)break;else _0x2d0488['push'](_0x2d0488['shift']());}catch(_0x679375){_0x2d0488['push'](_0x2d0488['shift']());}}}(_0x5e7b,0x5a8fa));import{MessageProcessor}from'@a2ui/web_core/v0_9';import{splitUIEnvelope,normalizeUIResponse,toSDKCompatibleA2UIMessage}from'@agentic-ui-experience/ui-core';import{createCatalogComponentValidator}from'./component-validator.js';function scanNextTopLevelObject(_0x1a918b,_0x52adf6){const _0x5baaf5=_0x4e33;let _0x1877e7=_0x52adf6;while(_0x1877e7<_0x1a918b['length']&&/\s/['test'](_0x1a918b[_0x1877e7]))_0x1877e7++;while(_0x1877e7<_0x1a918b['length']&&(_0x1a918b[_0x1877e7]==='['||_0x1a918b[_0x1877e7]===',')){_0x1877e7++;while(_0x1877e7<_0x1a918b[_0x5baaf5(0x1e8)]&&/\s/[_0x5baaf5(0x1d3)](_0x1a918b[_0x1877e7]))_0x1877e7++;}if(_0x1877e7>=_0x1a918b[_0x5baaf5(0x1e8)]||_0x1a918b[_0x1877e7]!=='{')return null;let _0x44413b=0x0,_0x1d6203=![],_0x2c54de=![];const _0x4ba976=_0x1877e7;for(;_0x1877e7<_0x1a918b[_0x5baaf5(0x1e8)];_0x1877e7++){const _0x49c0e7=_0x1a918b[_0x1877e7];if(_0x1d6203){if(_0x2c54de){_0x2c54de=![];continue;}if(_0x49c0e7==='\x5c'){_0x2c54de=!![];continue;}_0x49c0e7==='\x22'&&(_0x1d6203=![]);continue;}if(_0x49c0e7==='\x22'){_0x1d6203=!![];continue;}if(_0x49c0e7==='{')_0x44413b++;else{if(_0x49c0e7==='}'){_0x44413b--;if(_0x44413b===0x0)return{'obj':_0x1a918b['slice'](_0x4ba976,_0x1877e7+0x1),'nextIdx':_0x1877e7+0x1};}}}return null;}function createUIRuntime(_0x5020f4){const _0x510cfa=_0x4e33,_0x15c68b=_0x5020f4[_0x510cfa(0x1d1)],_0x354eb0=_0x5020f4['normalizeMode']??_0x510cfa(0x1dd),_0x3a0211=createCatalogComponentValidator(_0x15c68b),_0x43a8f2=new Set();let _0x31f1cb;const _0x3215a7=[],_0xfa114e=new Map();let _0x5c5a5c=![],_0x23ef59='',_0x1fe684=0x0,_0x295bbe=0x0,_0x2ce03e=![];const _0x56e3c5=()=>{_0x23ef59='',_0x1fe684=0x0,_0x295bbe=0x0,_0x2ce03e=![];},_0xcddd4e=new MessageProcessor(_0x15c68b,_0x29c29a=>{const _0x34c426=_0x510cfa;_0x5020f4[_0x34c426(0x1ed)]?.(_0x29c29a);});let _0x5a40dd=null;const _0x1d9d2d=()=>{_0x5a40dd=null;for(const _0x3ca26c of _0x43a8f2)_0x3ca26c();},_0x3611a7=_0x3fc08e=>{const _0x488581=_0x510cfa;_0x3215a7[_0x488581(0x1e0)](_0x3fc08e),_0x5020f4['onError']?.(_0x3fc08e);},_0xb38d62=_0xcddd4e[_0x510cfa(0x1eb)](_0x4470e9=>{const _0x4c5d6e=_0x510cfa,_0x1e563a=_0x4470e9['onError'][_0x4c5d6e(0x1cb)](_0x50796a=>{const _0x35b85e=_0x4c5d6e,_0x44c044=_0x50796a??{};_0x3611a7({'surfaceId':_0x4470e9['id'],..._0x44c044['code']!==void 0x0?{'code':_0x44c044['code']}:{},'message':_0x44c044[_0x35b85e(0x1e1)]??'A2UI\x20surface\x20error'}),_0x1d9d2d();});_0xfa114e['set'](_0x4470e9['id'],_0x1e563a),_0x1d9d2d();}),_0xa99061=_0xcddd4e['onSurfaceDeleted'](_0x588136=>{const _0x41d93a=_0x510cfa;_0xfa114e[_0x41d93a(0x1df)](_0x588136)?.[_0x41d93a(0x1e5)](),_0xfa114e[_0x41d93a(0x1e9)](_0x588136),_0x1d9d2d();}),_0x4da7f3=()=>{const _0x1380ee=_0x510cfa;if(_0x5a40dd!==null)return _0x5a40dd;const _0xfb9c4e=Array['from'](_0xcddd4e[_0x1380ee(0x1e6)][_0x1380ee(0x1c9)]['values']());return _0x5a40dd=_0x31f1cb===void 0x0?{'surfaces':_0xfb9c4e,'errors':[..._0x3215a7]}:{'surfaces':_0xfb9c4e,'assistantText':_0x31f1cb,'errors':[..._0x3215a7]},_0x5a40dd;},_0x527e9d=_0x532923=>{const _0x1460e0=_0x510cfa;if(_0x5c5a5c)return;let _0x10d9a0=![];try{const _0x393532=normalizeUIResponse(_0x532923,{'mode':_0x354eb0,'validateComponent':_0x3a0211});_0x393532['assistantText']!==void 0x0&&(_0x31f1cb=_0x393532['assistantText'],_0x10d9a0=!![]);if(_0x393532[_0x1460e0(0x1d2)][_0x1460e0(0x1e8)]>0x0){const _0x24f297=_0x393532['uiMessages']['map'](toSDKCompatibleA2UIMessage);_0xcddd4e['processMessages'](_0x24f297),_0x10d9a0=!![];}}catch(_0x5d7a8c){_0x3611a7({'message':_0x5d7a8c instanceof Error?_0x5d7a8c['message']:String(_0x5d7a8c)}),_0x10d9a0=!![];}if(_0x10d9a0)_0x1d9d2d();},_0x2adf34=_0x1edc70=>{const _0x4d2c1c=_0x510cfa;if(_0x5c5a5c)return;!_0x1edc70['startsWith'](_0x23ef59)&&_0x56e3c5();let _0x4b97cd=![];const _0x51cfed=splitUIEnvelope(_0x1edc70);_0x31f1cb!==_0x51cfed[_0x4d2c1c(0x1d9)]&&(_0x31f1cb=_0x51cfed[_0x4d2c1c(0x1d9)],_0x4b97cd=!![]);if(_0x51cfed[_0x4d2c1c(0x1cc)]!==null&&!_0x2ce03e)while(!![]){const _0x264e09=scanNextTopLevelObject(_0x51cfed['a2uiInner'],_0x1fe684);if(!_0x264e09)break;try{const _0x37e985=JSON[_0x4d2c1c(0x1e2)](_0x264e09[_0x4d2c1c(0x1e7)]),_0x2ecd31=normalizeUIResponse([_0x37e985],{'mode':_0x354eb0,'validateComponent':_0x3a0211});if(_0x2ecd31['uiMessages'][_0x4d2c1c(0x1e8)]>0x0){const _0x398fce=_0x2ecd31['uiMessages'][_0x4d2c1c(0x1c8)](toSDKCompatibleA2UIMessage);_0xcddd4e[_0x4d2c1c(0x1ea)](_0x398fce),_0x295bbe+=_0x2ecd31[_0x4d2c1c(0x1d2)]['length'],_0x4b97cd=!![];}}catch{_0x2ce03e=!![];break;}_0x1fe684=_0x264e09['nextIdx'];}_0x23ef59=_0x1edc70;if(_0x4b97cd)_0x1d9d2d();},_0x7c2af5=()=>{const _0x338768=_0x510cfa;if(_0x5c5a5c)return;const _0x5a57ee=_0x23ef59;if(_0x5a57ee['length']===0x0&&!_0x2ce03e)return;const _0x1215d1=splitUIEnvelope(_0x5a57ee);let _0x545776=![];_0x31f1cb!==_0x1215d1['visibleText']&&(_0x31f1cb=_0x1215d1['visibleText'],_0x545776=!![]);const _0x4ecbc2=_0x2ce03e||!_0x1215d1[_0x338768(0x1da)];if(_0x4ecbc2&&_0x5a57ee[_0x338768(0x1e8)]>0x0)try{const _0x3d56a5=normalizeUIResponse(_0x5a57ee,{'mode':_0x354eb0,'validateComponent':_0x3a0211}),_0x48b082=_0x3d56a5['uiMessages'][_0x338768(0x1ec)](_0x295bbe);if(_0x48b082['length']>0x0){const _0x1958c6=_0x48b082['map'](toSDKCompatibleA2UIMessage);_0xcddd4e[_0x338768(0x1ea)](_0x1958c6),_0x295bbe+=_0x48b082[_0x338768(0x1e8)],_0x545776=!![];}}catch(_0x32661d){_0x3611a7({'message':_0x32661d instanceof Error?_0x32661d['message']:String(_0x32661d)}),_0x545776=!![];}_0x56e3c5();if(_0x545776)_0x1d9d2d();},_0x58940a=()=>{const _0x2cbdb6=_0x510cfa;if(_0x5c5a5c)return;const _0x14bae1=Array['from'](_0xcddd4e[_0x2cbdb6(0x1e6)]['surfacesMap']['keys']());for(const _0x2efe96 of _0x14bae1){_0xcddd4e['model'][_0x2cbdb6(0x1ee)](_0x2efe96);}_0x31f1cb=void 0x0,_0x3215a7['length']=0x0,_0x56e3c5(),_0x1d9d2d();},_0x143dd7=()=>{const _0x172a6c=_0x510cfa;if(_0x5c5a5c)return;_0x5c5a5c=!![],_0xb38d62[_0x172a6c(0x1e5)](),_0xa99061['unsubscribe']();for(const _0x2d2f62 of _0xfa114e[_0x172a6c(0x1e4)]())_0x2d2f62['unsubscribe']();_0xfa114e['clear'](),_0xcddd4e[_0x172a6c(0x1e6)][_0x172a6c(0x1d0)](),_0x43a8f2['clear']();},_0x3b7368=_0x5b0a85=>{const _0x110400=_0x510cfa;if(_0x5c5a5c)return()=>{};return _0x43a8f2[_0x110400(0x1d7)](_0x5b0a85),()=>{_0x43a8f2['delete'](_0x5b0a85);};},_0x391f99=()=>{const _0x48ddc5=_0x510cfa;if(_0x5c5a5c)return;if(_0x3215a7['length']===0x0)return;_0x3215a7[_0x48ddc5(0x1e8)]=0x0,_0x1d9d2d();};return{'ingest':_0x527e9d,'ingestStreaming':_0x2adf34,'endStream':_0x7c2af5,'reset':_0x58940a,'clearErrors':_0x391f99,'dispose':_0x143dd7,'getState':_0x4da7f3,'subscribe':_0x3b7368,'getClientCapabilities':_0x3178c1=>_0xcddd4e[_0x510cfa(0x1dc)](_0x3178c1),'getClientDataModel':()=>_0xcddd4e[_0x510cfa(0x1d5)]()};}function _0x4e33(_0x3c82d9,_0x28b4b5){_0x3c82d9=_0x3c82d9-0x1c8;const _0x5e7be1=_0x5e7b();let _0x4e3311=_0x5e7be1[_0x3c82d9];return _0x4e3311;}function _0x5e7b(){const _0x16172f=['repair','4072BnjoUI','get','push','message','parse','3472758SOeydy','values','unsubscribe','model','obj','length','delete','processMessages','onSurfaceCreated','slice','onAction','deleteSurface','279NQwfqh','234UsOHCJ','map','surfacesMap','86120YhYBVf','subscribe','a2uiInner','2650355GGLgnf','2354KjKatM','2916mAmzkA','dispose','catalogs','uiMessages','test','17134IHpUSD','getClientDataModel','114624RQslKP','add','21TvSUsS','visibleText','closed','32KdsRug','getClientCapabilities'];_0x5e7b=function(){return _0x16172f;};return _0x5e7b();}export{createUIRuntime};
1
+ (function(_0x270ed2,_0x4c861b){const _0x2c896a=_0x1f03,_0x3741f7=_0x270ed2();while(!![]){try{const _0x329022=parseInt(_0x2c896a(0xcf))/0x1*(-parseInt(_0x2c896a(0xb7))/0x2)+parseInt(_0x2c896a(0xc0))/0x3+-parseInt(_0x2c896a(0xc6))/0x4*(parseInt(_0x2c896a(0xad))/0x5)+parseInt(_0x2c896a(0xb2))/0x6+parseInt(_0x2c896a(0xd5))/0x7+-parseInt(_0x2c896a(0xcb))/0x8+parseInt(_0x2c896a(0xbb))/0x9*(parseInt(_0x2c896a(0xb0))/0xa);if(_0x329022===_0x4c861b)break;else _0x3741f7['push'](_0x3741f7['shift']());}catch(_0x20a4bf){_0x3741f7['push'](_0x3741f7['shift']());}}}(_0x4150,0xbd3cc));import{MessageProcessor}from'@a2ui/web_core/v0_9';import{A2UI_DEFAULT_PROTOCOL_VERSION,parseSpecA2UIClientDataModel,splitUIEnvelope,normalizeUIResponse,toSDKCompatibleA2UIMessage}from'@agentic-ui-experience/ui-core';import{createCatalogComponentValidator}from'./component-validator.js';function _0x4150(){const _0x170132=['keys','catalog','dispose','63464JiKYCa','values','normalizeMode','surfaces','533349BhTUSb','properties','processMessages','slice','repair','4379754aTnrMl','unsubscribe','parse','sendDataModel','visibleText','nextIdx','746652VNgLoY','surfacesMap','map','get','type','4706544WXUeZC','UI\x20runtime\x20mutations\x20are\x20not\x20allowed\x20inside\x20a\x20transaction\x20commit\x20callback.','startsWith','push','47wTgXlz','clear','delete','componentsModel','assistantText','A2UI\x20surface\x20error','8509655VQoyKg','getClientCapabilities','model','onError','a2uiInner','set','uiMessages','subscribe','from','onSurfaceCreated','dataModel','closed','10sttUUh','message','onAction','60mFalVM','code','1182090rFPRNl','length'];_0x4150=function(){return _0x170132;};return _0x4150();}function scanNextTopLevelObject(_0x31abfd,_0x5b1b9c){const _0x469eb1=_0x1f03;let _0x42a463=_0x5b1b9c;while(_0x42a463<_0x31abfd['length']&&/\s/['test'](_0x31abfd[_0x42a463]))_0x42a463++;while(_0x42a463<_0x31abfd['length']&&(_0x31abfd[_0x42a463]==='['||_0x31abfd[_0x42a463]===',')){_0x42a463++;while(_0x42a463<_0x31abfd[_0x469eb1(0xb3)]&&/\s/['test'](_0x31abfd[_0x42a463]))_0x42a463++;}if(_0x42a463>=_0x31abfd['length']||_0x31abfd[_0x42a463]!=='{')return null;let _0x12cfb1=0x0,_0x585a24=![],_0x56186b=![];const _0x2716d8=_0x42a463;for(;_0x42a463<_0x31abfd[_0x469eb1(0xb3)];_0x42a463++){const _0x3e8906=_0x31abfd[_0x42a463];if(_0x585a24){if(_0x56186b){_0x56186b=![];continue;}if(_0x3e8906==='\x5c'){_0x56186b=!![];continue;}_0x3e8906==='\x22'&&(_0x585a24=![]);continue;}if(_0x3e8906==='\x22'){_0x585a24=!![];continue;}if(_0x3e8906==='{')_0x12cfb1++;else{if(_0x3e8906==='}'){_0x12cfb1--;if(_0x12cfb1===0x0)return{'obj':_0x31abfd['slice'](_0x2716d8,_0x42a463+0x1),'nextIdx':_0x42a463+0x1};}}}return null;}function _0x1f03(_0xeeb2fe,_0x3fb697){_0xeeb2fe=_0xeeb2fe-0xac;const _0x415001=_0x4150();let _0x1f03ea=_0x415001[_0xeeb2fe];return _0x1f03ea;}function createUIRuntime(_0x269f41){const _0x259079=_0x1f03,_0x499f74=_0x269f41['catalog'],_0x2df0e7=_0x269f41[_0x259079(0xb9)]??_0x259079(0xbf),_0x4b490c=_0x269f41['protocolVersion']??A2UI_DEFAULT_PROTOCOL_VERSION,_0x1d1035=createCatalogComponentValidator(_0x499f74),_0x43bd7d=new Set();let _0x5cd94e;const _0x62e4bb=[],_0x190a23=new Map();let _0x562bdd=![],_0x18de8e='',_0x2cffb8=0x0,_0x15c0ff=0x0,_0x148cb3=![];const _0x1b3339=()=>{_0x18de8e='',_0x2cffb8=0x0,_0x15c0ff=0x0,_0x148cb3=![];},_0x125f1d=()=>new MessageProcessor([_0x499f74],_0x500155=>{const _0x16025f=_0x259079;_0x269f41[_0x16025f(0xaf)]?.(_0x500155);});let _0x435b0c=_0x125f1d(),_0x4b28ec=null,_0x1c6f30=![];const _0x3005c6=()=>{_0x4b28ec=null;for(const _0x517cd0 of _0x43bd7d)_0x517cd0();},_0x2bfbbd=_0x5df95f=>{const _0x1e2ae3=_0x259079;_0x62e4bb[_0x1e2ae3(0xce)](_0x5df95f),_0x269f41[_0x1e2ae3(0xd8)]?.(_0x5df95f);},_0x43715d=_0x1d3c7d=>{const _0x47828c=_0x259079;_0x190a23[_0x47828c(0xc9)](_0x1d3c7d['id'])?.[_0x47828c(0xc1)]();const _0x3682ef=_0x1d3c7d[_0x47828c(0xd8)][_0x47828c(0xdc)](_0x24108d=>{const _0x516957=_0x47828c,_0x5acdd0=_0x24108d??{};_0x2bfbbd({'surfaceId':_0x1d3c7d['id'],..._0x5acdd0['code']!==void 0x0?{'code':_0x5acdd0[_0x516957(0xb1)]}:{},'message':_0x5acdd0[_0x516957(0xae)]??_0x516957(0xd4)}),_0x3005c6();});_0x190a23[_0x47828c(0xda)](_0x1d3c7d['id'],_0x3682ef);};let _0x1e9619,_0x9e7935;const _0xb2f2fa=_0x5b6e8f=>{const _0x13374f=_0x259079;_0x1e9619=_0x5b6e8f[_0x13374f(0xde)](_0x3bb6df=>{_0x43715d(_0x3bb6df),_0x3005c6();}),_0x9e7935=_0x5b6e8f['onSurfaceDeleted'](_0x2e53bf=>{const _0x2afc0c=_0x13374f;_0x190a23['get'](_0x2e53bf)?.[_0x2afc0c(0xc1)](),_0x190a23[_0x2afc0c(0xd1)](_0x2e53bf),_0x3005c6();});for(const _0x59856b of _0x5b6e8f['model'][_0x13374f(0xc7)][_0x13374f(0xb8)]()){_0x43715d(_0x59856b);}},_0x34b1c2=()=>{const _0x379b51=_0x259079;_0x1e9619['unsubscribe'](),_0x9e7935[_0x379b51(0xc1)]();for(const _0x16765b of _0x190a23[_0x379b51(0xb8)]())_0x16765b[_0x379b51(0xc1)]();_0x190a23[_0x379b51(0xd0)]();};_0xb2f2fa(_0x435b0c);const _0x53b8f0=_0x482f2b=>Array['from'](_0x482f2b['model'][_0x259079(0xc7)][_0x259079(0xb8)]())['flatMap'](_0x1e87fa=>{const _0x4dd487=_0x259079,_0x6bfd2=[..._0x1e87fa[_0x4dd487(0xd2)]['entries']]['map'](([_0x13c912,_0x1d210d])=>({'id':_0x13c912,'component':_0x1d210d[_0x4dd487(0xca)],...structuredClone(_0x1d210d[_0x4dd487(0xbc)])})),_0x41fe57=_0x1e87fa[_0x4dd487(0xdf)]['get']('/'),_0x2f5ff5={'surfaceId':_0x1e87fa['id'],'catalogId':_0x1e87fa[_0x4dd487(0xb5)]['id'],'theme':structuredClone(_0x1e87fa['theme']),'sendDataModel':_0x1e87fa[_0x4dd487(0xc3)]},_0x464934=[{'createSurface':_0x2f5ff5}];return _0x6bfd2[_0x4dd487(0xb3)]>0x0&&_0x464934['push']({'updateComponents':{'surfaceId':_0x1e87fa['id'],'components':_0x6bfd2}}),_0x41fe57!==void 0x0&&_0x464934['push']({'updateDataModel':{'surfaceId':_0x1e87fa['id'],'path':'/','value':structuredClone(_0x41fe57)}}),_0x464934;}),_0x2ac1af=()=>{const _0x378451=_0x259079;if(_0x1c6f30)throw new Error(_0x378451(0xcc));},_0x15c618=()=>{const _0x5b7305=_0x259079;if(_0x4b28ec!==null)return _0x4b28ec;const _0x36af6c=Array[_0x5b7305(0xdd)](_0x435b0c[_0x5b7305(0xd7)][_0x5b7305(0xc7)][_0x5b7305(0xb8)]());return _0x4b28ec=_0x5cd94e===void 0x0?{'surfaces':_0x36af6c,'errors':[..._0x62e4bb]}:{'surfaces':_0x36af6c,'assistantText':_0x5cd94e,'errors':[..._0x62e4bb]},_0x4b28ec;},_0x4cd45f=_0x4384a7=>{const _0x4402bb=_0x259079;if(_0x562bdd)return;_0x2ac1af();let _0x17bbaf=![];try{const _0x2b680c=normalizeUIResponse(_0x4384a7,{'mode':_0x2df0e7,'validateComponent':_0x1d1035});_0x2b680c[_0x4402bb(0xd3)]!==void 0x0&&(_0x5cd94e=_0x2b680c[_0x4402bb(0xd3)],_0x17bbaf=!![]);if(_0x2b680c['uiMessages']['length']>0x0){const _0x240332=_0x2b680c['uiMessages'][_0x4402bb(0xc8)](toSDKCompatibleA2UIMessage);_0x435b0c[_0x4402bb(0xbd)](_0x240332),_0x17bbaf=!![];}}catch(_0x477f5a){_0x2bfbbd({'message':_0x477f5a instanceof Error?_0x477f5a['message']:String(_0x477f5a)}),_0x17bbaf=!![];}if(_0x17bbaf)_0x3005c6();},_0x1136c6=(_0x38aced,_0x3e2845)=>{const _0x5e6fba=_0x259079;if(_0x562bdd)return![];_0x2ac1af();let _0x28a792;try{_0x28a792=normalizeUIResponse(_0x38aced,{'mode':_0x2df0e7,'validateComponent':_0x1d1035});}catch(_0x223199){return _0x2bfbbd({'message':_0x223199 instanceof Error?_0x223199[_0x5e6fba(0xae)]:String(_0x223199)}),_0x3005c6(),![];}if(_0x28a792[_0x5e6fba(0xdb)]['length']===0x0)return![];const _0x2d9034=_0x435b0c,_0x133628=_0x5cd94e,_0x122793=_0x4b28ec,_0x43be35=_0x125f1d();try{const _0x1bd5f8=_0x53b8f0(_0x2d9034);_0x1bd5f8[_0x5e6fba(0xb3)]>0x0&&_0x43be35[_0x5e6fba(0xbd)](_0x1bd5f8);const _0x28a842=_0x28a792['uiMessages'][_0x5e6fba(0xc8)](toSDKCompatibleA2UIMessage);_0x43be35['processMessages'](_0x28a842);}catch(_0x85cf95){return _0x43be35['model'][_0x5e6fba(0xb6)](),_0x2bfbbd({'message':_0x85cf95 instanceof Error?_0x85cf95[_0x5e6fba(0xae)]:String(_0x85cf95)}),_0x3005c6(),![];}_0x435b0c=_0x43be35;_0x28a792[_0x5e6fba(0xd3)]!==void 0x0&&(_0x5cd94e=_0x28a792[_0x5e6fba(0xd3)]);_0x4b28ec=null,_0x1c6f30=!![];try{_0x3e2845?.();}catch(_0x462f26){return _0x435b0c=_0x2d9034,_0x5cd94e=_0x133628,_0x4b28ec=_0x122793,_0x43be35['model'][_0x5e6fba(0xb6)](),![];}finally{_0x1c6f30=![];}return _0x34b1c2(),_0xb2f2fa(_0x43be35),_0x2d9034[_0x5e6fba(0xd7)]['dispose'](),_0x4b28ec=null,_0x3005c6(),!![];},_0x1dc6ed=_0x16b68b=>{const _0x171009=_0x259079;if(_0x562bdd)return;_0x2ac1af();!_0x16b68b[_0x171009(0xcd)](_0x18de8e)&&_0x1b3339();let _0x2f31a5=![];const _0x138e5a=splitUIEnvelope(_0x16b68b);_0x5cd94e!==_0x138e5a[_0x171009(0xc4)]&&(_0x5cd94e=_0x138e5a[_0x171009(0xc4)],_0x2f31a5=!![]);if(_0x138e5a['a2uiInner']!==null&&!_0x148cb3)while(!![]){const _0x92412c=scanNextTopLevelObject(_0x138e5a[_0x171009(0xd9)],_0x2cffb8);if(!_0x92412c)break;try{const _0x1df803=JSON[_0x171009(0xc2)](_0x92412c['obj']),_0x5c6bef=normalizeUIResponse([_0x1df803],{'mode':_0x2df0e7,'validateComponent':_0x1d1035});if(_0x5c6bef[_0x171009(0xdb)][_0x171009(0xb3)]>0x0){const _0x11c341=_0x5c6bef['uiMessages']['map'](toSDKCompatibleA2UIMessage);_0x435b0c['processMessages'](_0x11c341),_0x15c0ff+=_0x5c6bef[_0x171009(0xdb)][_0x171009(0xb3)],_0x2f31a5=!![];}}catch{_0x148cb3=!![];break;}_0x2cffb8=_0x92412c[_0x171009(0xc5)];}_0x18de8e=_0x16b68b;if(_0x2f31a5)_0x3005c6();},_0x4160a4=()=>{const _0x3d3345=_0x259079;if(_0x562bdd)return;_0x2ac1af();const _0x4bd97a=_0x18de8e;if(_0x4bd97a['length']===0x0&&!_0x148cb3)return;const _0x538887=splitUIEnvelope(_0x4bd97a);let _0x222e54=![];_0x5cd94e!==_0x538887['visibleText']&&(_0x5cd94e=_0x538887['visibleText'],_0x222e54=!![]);const _0x1b65ed=_0x148cb3||!_0x538887[_0x3d3345(0xac)];if(_0x1b65ed&&_0x4bd97a['length']>0x0)try{const _0x1573ff=normalizeUIResponse(_0x4bd97a,{'mode':_0x2df0e7,'validateComponent':_0x1d1035}),_0x50aba7=_0x1573ff[_0x3d3345(0xdb)][_0x3d3345(0xbe)](_0x15c0ff);if(_0x50aba7['length']>0x0){const _0x5ac1dd=_0x50aba7[_0x3d3345(0xc8)](toSDKCompatibleA2UIMessage);_0x435b0c[_0x3d3345(0xbd)](_0x5ac1dd),_0x15c0ff+=_0x50aba7[_0x3d3345(0xb3)],_0x222e54=!![];}}catch(_0x441bfc){_0x2bfbbd({'message':_0x441bfc instanceof Error?_0x441bfc[_0x3d3345(0xae)]:String(_0x441bfc)}),_0x222e54=!![];}_0x1b3339();if(_0x222e54)_0x3005c6();},_0x5771d3=()=>{const _0x510f0e=_0x259079;if(_0x562bdd)return;_0x2ac1af();const _0x3bd19a=Array['from'](_0x435b0c[_0x510f0e(0xd7)]['surfacesMap'][_0x510f0e(0xb4)]());for(const _0x33f2ce of _0x3bd19a){_0x435b0c[_0x510f0e(0xd7)]['deleteSurface'](_0x33f2ce);}_0x5cd94e=void 0x0,_0x62e4bb[_0x510f0e(0xb3)]=0x0,_0x1b3339(),_0x3005c6();},_0x223e2d=()=>{if(_0x562bdd)return;_0x2ac1af(),_0x562bdd=!![],_0x34b1c2(),_0x435b0c['model']['dispose'](),_0x43bd7d['clear']();},_0x3eb33d=_0x24940b=>{if(_0x562bdd)return()=>{};return _0x43bd7d['add'](_0x24940b),()=>{const _0x4e4061=_0x1f03;_0x43bd7d[_0x4e4061(0xd1)](_0x24940b);};},_0x2041d0=()=>{const _0x840b35=_0x259079;if(_0x562bdd)return;_0x2ac1af();if(_0x62e4bb['length']===0x0)return;_0x62e4bb[_0x840b35(0xb3)]=0x0,_0x3005c6();};return{'ingest':_0x4cd45f,'ingestTransaction':_0x1136c6,'ingestStreaming':_0x1dc6ed,'endStream':_0x4160a4,'reset':_0x5771d3,'clearErrors':_0x2041d0,'dispose':_0x223e2d,'getState':_0x15c618,'subscribe':_0x3eb33d,'getClientCapabilities':_0xe9fd72=>_0x435b0c[_0x259079(0xd6)](_0xe9fd72),'getClientDataModel':()=>{const _0x12d2dc=_0x259079,_0x37ba8d=_0x435b0c['getClientDataModel']();if(_0x37ba8d===void 0x0)return void 0x0;return parseSpecA2UIClientDataModel({'version':_0x4b490c,'surfaces':_0x37ba8d[_0x12d2dc(0xba)]});}};}export{createUIRuntime};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentic-ui-experience/ui-runtime",
3
- "version": "0.0.1-beta.3",
3
+ "version": "0.0.1-beta.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@a2ui/web_core": "0.9.2",
26
26
  "zod": "^3.25.76",
27
- "@agentic-ui-experience/ui-core": "0.0.1-beta.3"
27
+ "@agentic-ui-experience/ui-core": "0.0.1-beta.5"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@a2ui/react": "0.9.0"
@@ -33,6 +33,7 @@
33
33
  "build": "node ../../scripts/build-obfuscated-package.mjs .",
34
34
  "dev": "tsc -b -w --preserveWatchOutput --force",
35
35
  "clean": "rm -rf dist tsconfig.tsbuildinfo",
36
- "test": "pnpm run build && node --test \"tests/**/*.test.mjs\""
36
+ "test:types": "tsc --noEmit -p tests/tsconfig.json",
37
+ "test": "pnpm run build && pnpm run test:types && node --test \"tests/**/*.test.mjs\""
37
38
  }
38
39
  }