@agentic-ui-experience/ui-runtime 0.0.1-beta.1

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 ADDED
@@ -0,0 +1,179 @@
1
+ # @agentic-ui-experience/ui-runtime
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.
4
+
5
+ It does not build prompts and does not render components; React hosts usually use `@agentic-ui-experience/ui-react` directly.
6
+
7
+ ```text
8
+ Agent output
9
+ -> @agentic-ui-experience/ui-core parses into UI messages
10
+ -> @agentic-ui-experience/ui-runtime produces surfaces / assistantText / errors
11
+ -> the rendering layer consumes surfaces
12
+ -> user actions return to the host
13
+ ```
14
+
15
+ ## Core interfaces
16
+
17
+ ### `createUIRuntime()`
18
+
19
+ Create a runtime instance:
20
+
21
+ ```ts
22
+ import { createUIRuntime } from "@agentic-ui-experience/ui-runtime";
23
+
24
+ const runtime = createUIRuntime({
25
+ catalogs: [appCatalog],
26
+ onAction: (action) => {
27
+ // Send the user action back to the agent or business logic.
28
+ },
29
+ onError: (error) => {
30
+ // Record parse, validation, or runtime errors.
31
+ }
32
+ });
33
+ ```
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`.
36
+
37
+ ### `ingest()`
38
+
39
+ Process one complete output:
40
+
41
+ ```ts
42
+ runtime.ingest(modelOutput);
43
+ ```
44
+
45
+ `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
+
47
+ ### `ingestStreaming()` / `endStream()`
48
+
49
+ Process a streaming output:
50
+
51
+ ```ts
52
+ runtime.ingestStreaming(accumulatedText);
53
+ runtime.ingestStreaming(nextAccumulatedText);
54
+ runtime.endStream();
55
+ ```
56
+
57
+ `ingestStreaming()` takes the "full text accumulated so far", not the current delta. Call `endStream()` once when the stream finishes; the runtime performs a final parse so that a UI message not yet fully parsed during streaming is not lost.
58
+
59
+ ### `getState()` / `subscribe()`
60
+
61
+ Read and subscribe to runtime state:
62
+
63
+ ```ts
64
+ const unsubscribe = runtime.subscribe(() => {
65
+ const state = runtime.getState();
66
+ render(state.surfaces);
67
+ });
68
+ ```
69
+
70
+ `getState()` returns:
71
+
72
+ ```ts
73
+ {
74
+ surfaces: UIRuntimeSurface[];
75
+ assistantText?: string;
76
+ errors: UIRuntimeError[];
77
+ }
78
+ ```
79
+
80
+ - `surfaces`: the UI surface model for the rendering layer to consume.
81
+ - `assistantText`: plain assistant text outside the UI envelope.
82
+ - `errors`: parse, component-validation, or underlying runtime errors.
83
+
84
+ `surfaces` is not raw JSON but an object model produced by the runtime: it is the result state after `@agentic-ui-experience/ui-core`'s `createSurface` / `updateComponents` / `updateDataModel` UI messages are applied one by one. A single surface looks roughly like:
85
+
86
+ ```ts
87
+ const surface = {
88
+ id: "main",
89
+ catalog: { id: "https://a2ui.org/specification/v0_9/basic_catalog.json" },
90
+ dataModel: { /* the data model bound by input components */ },
91
+ componentsModel: {
92
+ root: {
93
+ id: "root",
94
+ type: "Text",
95
+ properties: { text: "Hello" },
96
+ componentTree: { id: "root", type: "Text", text: "Hello" },
97
+ },
98
+ },
99
+ };
100
+ ```
101
+
102
+ `dataModel` and `componentsModel` are object models, not plain literals: access a single component with `surface.componentsModel.get("root")` and iterate with `entries`, rather than indexing by id directly.
103
+
104
+ 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
+
106
+ ### Action dispatch
107
+
108
+ User interaction with a surface falls into two kinds; only the first triggers `onAction`:
109
+
110
+ - **Components with an `action`** (typically `Button`): clicking explicitly dispatches an action, which is resolved by the A2UI binder and reaches `onAction`.
111
+ - **Input components** (`TextField`, `ChoicePicker`, `Slider`, `DateTimeInput`, etc.): they only write the user input into the surface's `dataModel` and do **not** trigger `onAction`.
112
+
113
+ In other words, input controls only change local data; to let the agent continue (send another turn), it must go through a component with an action. If a selection / input needs to return to the agent, pair it with a `Button`, or define a custom component with an explicit action prop.
114
+
115
+ The full loop is: the agent emits a button with an `action` in a UI message → the user clicks → the runtime parses it into an action and hands it to `onAction` → the host sends it back to the agent.
116
+
117
+ **1. The component definition the agent emits** (describes a button with an action):
118
+
119
+ ```json
120
+ {
121
+ "component": "Button",
122
+ "child": "submit_label",
123
+ "action": {
124
+ "event": {
125
+ "name": "submitForm",
126
+ "context": { "source": "signup" }
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ **2. The action `onAction` receives after the user clicks:**
133
+
134
+ ```ts
135
+ const runtime = createUIRuntime({
136
+ catalogs,
137
+ onAction: (action) => {
138
+ action.name; // "submitForm"
139
+ action.context; // { source: "signup" }
140
+ action.surfaceId; // "main", the surface the action came from
141
+ action.sourceComponentId; // id of the component that triggered the action
142
+ action.timestamp; // ISO timestamp
143
+ // Send it back to the agent to start the next turn.
144
+ }
145
+ });
146
+ ```
147
+
148
+ The `action.event.{name, context}` in the component definition is flattened into the returned action's `name` and `context`; the runtime then adds `surfaceId`, `sourceComponentId`, and `timestamp`.
149
+
150
+ ## Other methods
151
+
152
+ | Method | Purpose |
153
+ | --- | --- |
154
+ | `reset()` | Clears `surfaces`, `assistantText`, and `errors`; the runtime stays usable. |
155
+ | `clearErrors()` | Clears only errors. |
156
+ | `dispose()` | Releases subscriptions and underlying resources; write-style methods become no-ops afterward. |
157
+ | `getClientCapabilities()` | Returns the current client capability metadata. |
158
+ | `getClientDataModel()` | Returns the current client data model. |
159
+
160
+ ## Exports
161
+
162
+ Primary exports:
163
+
164
+ - `createUIRuntime`
165
+ - `UIRuntime`
166
+ - `UIRuntimeOptions`
167
+ - `UIRuntimeState`
168
+ - `UIRuntimeSurface`
169
+ - `UIRuntimeCatalog`
170
+ - `UIAction`
171
+ - `UIRuntimeError`
172
+
173
+ For catalog authoring, this package also re-exports `Catalog` and `z`.
174
+
175
+ ## Tests
176
+
177
+ ```sh
178
+ pnpm --filter @agentic-ui-experience/ui-runtime test
179
+ ```
@@ -0,0 +1 @@
1
+ export * from "@a2ui/web_core/v0_9/basic_catalog";
@@ -0,0 +1 @@
1
+ function _0x4961(){var _0x1d4799=['1706956ZRWPiP','157203VQCfkN','5686737hqYhQE','154747CIqDAu','3rEjtoc','8607990JpAUMi','6287384eDlBLy','472XjmiFX','4816375IMyLxs'];_0x4961=function(){return _0x1d4799;};return _0x4961();}(function(_0x3bcab1,_0x365af4){var _0x4e4ee0=_0x2b33,_0x52d2c9=_0x3bcab1();while(!![]){try{var _0x23ac90=parseInt(_0x4e4ee0(0x11e))/0x1+parseInt(_0x4e4ee0(0x124))/0x2+-parseInt(_0x4e4ee0(0x11f))/0x3*(parseInt(_0x4e4ee0(0x121))/0x4)+parseInt(_0x4e4ee0(0x123))/0x5+-parseInt(_0x4e4ee0(0x120))/0x6+parseInt(_0x4e4ee0(0x126))/0x7+parseInt(_0x4e4ee0(0x122))/0x8*(parseInt(_0x4e4ee0(0x125))/0x9);if(_0x23ac90===_0x365af4)break;else _0x52d2c9['push'](_0x52d2c9['shift']());}catch(_0x2e3bc5){_0x52d2c9['push'](_0x52d2c9['shift']());}}}(_0x4961,0xc53fd));function _0x2b33(_0x3bf3d6,_0x2b7b0e){_0x3bf3d6=_0x3bf3d6-0x11e;var _0x496105=_0x4961();var _0x2b33cd=_0x496105[_0x3bf3d6];return _0x2b33cd;}export*from'@a2ui/web_core/v0_9/basic_catalog';
@@ -0,0 +1,13 @@
1
+ import { Catalog, type ComponentApi, type FunctionImplementation } from "@a2ui/web_core/v0_9";
2
+ export interface DefineCatalogOptions<TComponent extends ComponentApi = ComponentApi> {
3
+ /** Catalog id - must match the surface's `catalogId`. */
4
+ id: string;
5
+ /** Catalog to extend. Defaults to `basicCatalog`. */
6
+ extends?: Catalog<TComponent>;
7
+ /** Custom component APIs added on top of the base catalog. */
8
+ components?: readonly TComponent[];
9
+ /** Custom function implementations added on top of the base catalog. */
10
+ functions?: readonly FunctionImplementation[];
11
+ }
12
+ export declare function defineCatalog<TComponent extends ComponentApi = ComponentApi>(options: DefineCatalogOptions<TComponent>): Catalog<TComponent>;
13
+ export declare const basicCatalog: Catalog<ComponentApi>;
@@ -0,0 +1 @@
1
+ (function(_0x93cfbf,_0x95bb8a){const _0x2dfeea=_0x2f6f,_0x5032b4=_0x93cfbf();while(!![]){try{const _0xcb2c5=parseInt(_0x2dfeea(0xde))/0x1+-parseInt(_0x2dfeea(0xe0))/0x2+-parseInt(_0x2dfeea(0xd6))/0x3*(parseInt(_0x2dfeea(0xe1))/0x4)+parseInt(_0x2dfeea(0xd5))/0x5*(-parseInt(_0x2dfeea(0xd4))/0x6)+parseInt(_0x2dfeea(0xd9))/0x7*(parseInt(_0x2dfeea(0xdf))/0x8)+-parseInt(_0x2dfeea(0xda))/0x9+parseInt(_0x2dfeea(0xdc))/0xa*(parseInt(_0x2dfeea(0xdb))/0xb);if(_0xcb2c5===_0x95bb8a)break;else _0x5032b4['push'](_0x5032b4['shift']());}catch(_0x14b638){_0x5032b4['push'](_0x5032b4['shift']());}}}(_0x2a89,0x9a6db));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(_0x1c73c5){const _0x4a44f3=_0x2f6f,_0x479a0a=_0x1c73c5[_0x4a44f3(0xdd)]??basicCatalog,_0x21625f=_0x1c73c5['components']??[],_0x13a831=_0x1c73c5[_0x4a44f3(0xd7)]??[];return new Catalog(_0x1c73c5['id'],[..._0x479a0a[_0x4a44f3(0xd3)][_0x4a44f3(0xd8)](),..._0x21625f],[..._0x479a0a['functions'][_0x4a44f3(0xd8)](),..._0x13a831],_0x479a0a['themeSchema']);}const basicCatalog=new Catalog(A2UI_BASIC_CATALOG_ID,BASIC_COMPONENTS,BASIC_FUNCTIONS);function _0x2f6f(_0x1ed905,_0x105486){_0x1ed905=_0x1ed905-0xd3;const _0x2a89d5=_0x2a89();let _0x2f6f49=_0x2a89d5[_0x1ed905];return _0x2f6f49;}function _0x2a89(){const _0xa6dfad=['1554BCTENZ','3985wKhMph','633javVoh','functions','values','518rasblX','9205020hOITyz','44FsNdZq','138980tEIrEU','extends','1021692ODCHRA','130768VukrvL','566286mUAJOX','2692HaGWge','components'];_0x2a89=function(){return _0xa6dfad;};return _0x2a89();}export{basicCatalog,defineCatalog};
@@ -0,0 +1,6 @@
1
+ export { basicCatalog, defineCatalog, type DefineCatalogOptions } from "./catalog.js";
2
+ export * from "./runtime.js";
3
+ export { Catalog } from "@a2ui/web_core/v0_9";
4
+ export type { ComponentApi, FunctionImplementation } from "@a2ui/web_core/v0_9";
5
+ export { ActionSchema, CheckableSchema, CommonSchemas, DataBindingSchema, DynamicBooleanSchema, DynamicNumberSchema, DynamicStringListSchema, DynamicStringSchema, DynamicValueSchema, FunctionCallSchema } from "@a2ui/web_core/v0_9";
6
+ export { z } from "zod";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (function(_0x1203e7,_0x2e46b2){var _0x196c73=_0x1415,_0x5097be=_0x1203e7();while(!![]){try{var _0x15d411=-parseInt(_0x196c73(0x8d))/0x1*(parseInt(_0x196c73(0x85))/0x2)+-parseInt(_0x196c73(0x86))/0x3*(parseInt(_0x196c73(0x8c))/0x4)+-parseInt(_0x196c73(0x89))/0x5*(-parseInt(_0x196c73(0x8b))/0x6)+parseInt(_0x196c73(0x84))/0x7+parseInt(_0x196c73(0x8e))/0x8*(parseInt(_0x196c73(0x8a))/0x9)+parseInt(_0x196c73(0x83))/0xa*(parseInt(_0x196c73(0x88))/0xb)+parseInt(_0x196c73(0x87))/0xc*(parseInt(_0x196c73(0x8f))/0xd);if(_0x15d411===_0x2e46b2)break;else _0x5097be['push'](_0x5097be['shift']());}catch(_0x5648ee){_0x5097be['push'](_0x5097be['shift']());}}}(_0x4ffc,0xd8277));import{basicCatalog,defineCatalog}from'./catalog.js';import{createUIRuntime}from'./runtime.js';function _0x4ffc(){var _0x23a816=['3tEaRBM','1488jEiEcj','453002AwbFkN','1704955YHECnM','2790PHxzcv','6DHErEb','2379092NGAAEn','845702nJXHvT','13048MaQXeg','100906vmnxQA','40OqRhox','2464175BCBGnW','2xgNpDr'];_0x4ffc=function(){return _0x23a816;};return _0x4ffc();}import{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema}from'@a2ui/web_core/v0_9';function _0x1415(_0x3d3cb0,_0x49f06a){_0x3d3cb0=_0x3d3cb0-0x83;var _0x4ffc74=_0x4ffc();var _0x1415e2=_0x4ffc74[_0x3d3cb0];return _0x1415e2;}import{z}from'zod';export{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema,basicCatalog,createUIRuntime,defineCatalog,z};
@@ -0,0 +1,59 @@
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";
4
+ export type UIRuntimeCatalog<TComp extends ComponentApi = ComponentApi> = Catalog<TComp>;
5
+ export type UIRuntimeSurface<TComp extends ComponentApi = ComponentApi> = SurfaceModel<TComp>;
6
+ export type UIAction = A2uiClientAction;
7
+ export type UIRuntimeError = {
8
+ surfaceId?: string;
9
+ code?: string;
10
+ message: string;
11
+ };
12
+ export interface UIRuntimeOptions<TComp extends ComponentApi = ComponentApi> {
13
+ catalogs: UIRuntimeCatalog<TComp>[];
14
+ normalizeMode?: NormalizeUIResponseOptions["mode"];
15
+ onAction?: (action: UIAction) => void;
16
+ onError?: (error: UIRuntimeError) => void;
17
+ }
18
+ export interface UIRuntimeState<TComp extends ComponentApi = ComponentApi> {
19
+ surfaces: UIRuntimeSurface<TComp>[];
20
+ assistantText?: string;
21
+ errors: UIRuntimeError[];
22
+ }
23
+ /**
24
+ * Lifecycle:
25
+ *
26
+ * createUIRuntime
27
+ * → ingest() (one-shot, e.g. tests / non-streaming hosts)
28
+ * → ingestStreaming() * N → endStream() (streaming hosts; call once per delta with the
29
+ * RUNNING CONCATENATION, then endStream once)
30
+ * → reset() (drop surfaces + assistantText + errors; reusable)
31
+ * → clearErrors() (drop errors only; surfaces remain)
32
+ * → dispose() (terminal — all methods become no-ops afterward)
33
+ *
34
+ * `assistantText` semantics: derived from the <a2ui-json> envelope split.
35
+ * If a payload yields no envelope (e.g. a raw messages[] array passed to
36
+ * `ingest`), `assistantText` is left untouched, not cleared. Only `reset()`
37
+ * clears it.
38
+ *
39
+ * Between turns, just call `ingestStreaming` with the new running text —
40
+ * when the new text is not a prefix-extension of the previous one, the
41
+ * stream cursor auto-resets, so no manual `reset()` is needed.
42
+ *
43
+ * After `dispose()`: `getState()` returns the last snapshot, `subscribe()`
44
+ * returns a no-op unsubscribe, and `ingest*` / `reset` / `clearErrors` are
45
+ * no-ops.
46
+ */
47
+ export interface UIRuntime<TComp extends ComponentApi = ComponentApi> {
48
+ ingest(payload: unknown): void;
49
+ ingestStreaming(accumulatedText: string): void;
50
+ endStream(): void;
51
+ reset(): void;
52
+ clearErrors(): void;
53
+ dispose(): void;
54
+ getState(): UIRuntimeState<TComp>;
55
+ subscribe(listener: () => void): () => void;
56
+ getClientCapabilities(options?: CapabilitiesOptions): A2uiClientCapabilities;
57
+ getClientDataModel(): A2uiClientDataModel | undefined;
58
+ }
59
+ export declare function createUIRuntime<TComp extends ComponentApi = ComponentApi>(options: UIRuntimeOptions<TComp>): UIRuntime<TComp>;
@@ -0,0 +1 @@
1
+ (function(_0x3adf13,_0x2e2165){const _0x4bb9fd=_0x430f,_0x37587a=_0x3adf13();while(!![]){try{const _0x50051b=-parseInt(_0x4bb9fd(0xe6))/0x1+-parseInt(_0x4bb9fd(0xef))/0x2+-parseInt(_0x4bb9fd(0xf9))/0x3*(parseInt(_0x4bb9fd(0xda))/0x4)+parseInt(_0x4bb9fd(0xfd))/0x5+-parseInt(_0x4bb9fd(0xf7))/0x6+-parseInt(_0x4bb9fd(0xfb))/0x7+parseInt(_0x4bb9fd(0xd7))/0x8*(parseInt(_0x4bb9fd(0xd8))/0x9);if(_0x50051b===_0x2e2165)break;else _0x37587a['push'](_0x37587a['shift']());}catch(_0x57f407){_0x37587a['push'](_0x37587a['shift']());}}}(_0x48bc,0xad13a));function _0x430f(_0x584e78,_0x425d52){_0x584e78=_0x584e78-0xd3;const _0x48bc60=_0x48bc();let _0x430f5b=_0x48bc60[_0x584e78];return _0x430f5b;}import{MessageProcessor}from'@a2ui/web_core/v0_9';import{splitUIEnvelope,normalizeUIResponse,toSDKCompatibleA2UIMessage}from'@agentic-ui-experience/ui-core';function _0x48bc(){const _0x461376=['closed','component','getClientDataModel','uiMessages','model','2548386fKnEvG','onSurfaceCreated','path','unsubscribe','nextIdx','values','error','assistantText','3338478iGxALN','dispose','105297mmcqqu','processMessages','2466520nyZtou','add','5959400fgTyWF','A2UI\x20surface\x20error','components','length','startsWith','3318648mfIuUC','63wMHlUP','code','4aIWTbO','has','normalizeMode','catalogs','schema','success','deleteSurface','message','slice','safeParse','map','surfacesMap','1168710mAGpOa','clear','test','onError'];_0x48bc=function(){return _0x461376;};return _0x48bc();}function scanNextTopLevelObject(_0x18a5b4,_0x318df6){const _0x56a2ee=_0x430f;let _0x399ec1=_0x318df6;while(_0x399ec1<_0x18a5b4['length']&&/\s/[_0x56a2ee(0xe8)](_0x18a5b4[_0x399ec1]))_0x399ec1++;while(_0x399ec1<_0x18a5b4[_0x56a2ee(0xd5)]&&(_0x18a5b4[_0x399ec1]==='['||_0x18a5b4[_0x399ec1]===',')){_0x399ec1++;while(_0x399ec1<_0x18a5b4['length']&&/\s/['test'](_0x18a5b4[_0x399ec1]))_0x399ec1++;}if(_0x399ec1>=_0x18a5b4[_0x56a2ee(0xd5)]||_0x18a5b4[_0x399ec1]!=='{')return null;let _0x8461bc=0x0,_0x247324=![],_0x244e6d=![];const _0x579b53=_0x399ec1;for(;_0x399ec1<_0x18a5b4[_0x56a2ee(0xd5)];_0x399ec1++){const _0x511c2c=_0x18a5b4[_0x399ec1];if(_0x247324){if(_0x244e6d){_0x244e6d=![];continue;}if(_0x511c2c==='\x5c'){_0x244e6d=!![];continue;}_0x511c2c==='\x22'&&(_0x247324=![]);continue;}if(_0x511c2c==='\x22'){_0x247324=!![];continue;}if(_0x511c2c==='{')_0x8461bc++;else{if(_0x511c2c==='}'){_0x8461bc--;if(_0x8461bc===0x0)return{'obj':_0x18a5b4[_0x56a2ee(0xe2)](_0x579b53,_0x399ec1+0x1),'nextIdx':_0x399ec1+0x1};}}}return null;}function createUIRuntime(_0x187c29){const _0x4b25ca=_0x430f,_0xc0f97f=_0x187c29[_0x4b25ca(0xdd)],_0x75dc15=_0x187c29[_0x4b25ca(0xdc)]??'repair',_0x3b8011=new Map();for(const _0x3940b4 of _0xc0f97f){for(const [_0x222ce9,_0x34e6e9]of _0x3940b4[_0x4b25ca(0xd4)]){if(!_0x3b8011[_0x4b25ca(0xdb)](_0x222ce9))_0x3b8011['set'](_0x222ce9,_0x34e6e9[_0x4b25ca(0xde)]);}}const _0x2c6acb=(_0x11b9a0,_0x4b2975)=>{const _0x5f10e0=_0x4b25ca,_0x371f59=_0x3b8011['get'](_0x11b9a0);if(!_0x371f59)return['unknown\x20component\x20\x22'+_0x11b9a0+'\x22'];const _0x2c9282={..._0x4b2975};delete _0x2c9282['id'],delete _0x2c9282[_0x5f10e0(0xeb)];const _0x17f489=_0x371f59[_0x5f10e0(0xe3)](_0x2c9282);if(_0x17f489[_0x5f10e0(0xdf)])return[];return _0x17f489[_0x5f10e0(0xf5)]['issues']['map'](_0x3d1912=>{const _0xd93455=_0x5f10e0,_0x1b6bb1=_0x3d1912[_0xd93455(0xf1)]['join']('.');return _0x1b6bb1['length']>0x0?_0x1b6bb1+':\x20'+_0x3d1912[_0xd93455(0xe1)]:_0x3d1912[_0xd93455(0xe1)];});},_0x290fba=new Set();let _0x177d33;const _0x3c77e5=[],_0x3fab5f=new Map();let _0x1cf5c3=![],_0x22d44b='',_0x1a3620=0x0,_0x44faed=0x0,_0x2caf63=![];const _0x4c937b=()=>{_0x22d44b='',_0x1a3620=0x0,_0x44faed=0x0,_0x2caf63=![];},_0x3e524e=new MessageProcessor(_0xc0f97f,_0x5ebff1=>{_0x187c29['onAction']?.(_0x5ebff1);});let _0x1fe70a=null;const _0x4b528d=()=>{_0x1fe70a=null;for(const _0x4ccbb7 of _0x290fba)_0x4ccbb7();},_0x9b1f3b=_0x560c9d=>{const _0x2317e4=_0x4b25ca;_0x3c77e5['push'](_0x560c9d),_0x187c29[_0x2317e4(0xe9)]?.(_0x560c9d);},_0x1ccf7b=_0x3e524e[_0x4b25ca(0xf0)](_0x5f74aa=>{const _0x30afd5=_0x4b25ca,_0x32fdeb=_0x5f74aa[_0x30afd5(0xe9)]['subscribe'](_0x41944e=>{const _0x4da22e=_0x30afd5,_0x29057e=_0x41944e??{};_0x9b1f3b({'surfaceId':_0x5f74aa['id'],..._0x29057e[_0x4da22e(0xd9)]!==void 0x0?{'code':_0x29057e['code']}:{},'message':_0x29057e[_0x4da22e(0xe1)]??_0x4da22e(0xd3)}),_0x4b528d();});_0x3fab5f['set'](_0x5f74aa['id'],_0x32fdeb),_0x4b528d();}),_0x2ea1f0=_0x3e524e['onSurfaceDeleted'](_0x178cc2=>{const _0x25efda=_0x4b25ca;_0x3fab5f['get'](_0x178cc2)?.[_0x25efda(0xf2)](),_0x3fab5f['delete'](_0x178cc2),_0x4b528d();}),_0xe278cf=()=>{const _0x381a12=_0x4b25ca;if(_0x1fe70a!==null)return _0x1fe70a;const _0xbf4cba=Array['from'](_0x3e524e[_0x381a12(0xee)][_0x381a12(0xe5)][_0x381a12(0xf4)]());return _0x1fe70a=_0x177d33===void 0x0?{'surfaces':_0xbf4cba,'errors':[..._0x3c77e5]}:{'surfaces':_0xbf4cba,'assistantText':_0x177d33,'errors':[..._0x3c77e5]},_0x1fe70a;},_0x36ee6a=_0x44837d=>{const _0x3e7ca6=_0x4b25ca;if(_0x1cf5c3)return;let _0x3ab413=![];try{const _0x11ad47=normalizeUIResponse(_0x44837d,{'mode':_0x75dc15,'validateComponent':_0x2c6acb});_0x11ad47['assistantText']!==void 0x0&&(_0x177d33=_0x11ad47[_0x3e7ca6(0xf6)],_0x3ab413=!![]);if(_0x11ad47['uiMessages'][_0x3e7ca6(0xd5)]>0x0){const _0x26cf68=_0x11ad47[_0x3e7ca6(0xed)][_0x3e7ca6(0xe4)](toSDKCompatibleA2UIMessage);_0x3e524e['processMessages'](_0x26cf68),_0x3ab413=!![];}}catch(_0x2811e3){_0x9b1f3b({'message':_0x2811e3 instanceof Error?_0x2811e3[_0x3e7ca6(0xe1)]:String(_0x2811e3)}),_0x3ab413=!![];}if(_0x3ab413)_0x4b528d();},_0x4cb00c=_0x2afab5=>{const _0x454c9a=_0x4b25ca;if(_0x1cf5c3)return;!_0x2afab5[_0x454c9a(0xd6)](_0x22d44b)&&_0x4c937b();let _0x4adcb3=![];const _0x2e8939=splitUIEnvelope(_0x2afab5);_0x177d33!==_0x2e8939['visibleText']&&(_0x177d33=_0x2e8939['visibleText'],_0x4adcb3=!![]);if(_0x2e8939['a2uiInner']!==null&&!_0x2caf63)while(!![]){const _0x45f4bc=scanNextTopLevelObject(_0x2e8939['a2uiInner'],_0x1a3620);if(!_0x45f4bc)break;try{const _0x35787b=JSON['parse'](_0x45f4bc['obj']),_0x55f53d=toSDKCompatibleA2UIMessage(_0x35787b);_0x3e524e[_0x454c9a(0xfa)]([_0x55f53d]),_0x44faed++,_0x4adcb3=!![];}catch{_0x2caf63=!![];break;}_0x1a3620=_0x45f4bc[_0x454c9a(0xf3)];}_0x22d44b=_0x2afab5;if(_0x4adcb3)_0x4b528d();},_0x55a647=()=>{const _0x51a519=_0x4b25ca;if(_0x1cf5c3)return;const _0x4e4c99=_0x22d44b;if(_0x4e4c99['length']===0x0&&!_0x2caf63)return;const _0x314887=splitUIEnvelope(_0x4e4c99);let _0x512f17=![];_0x177d33!==_0x314887['visibleText']&&(_0x177d33=_0x314887['visibleText'],_0x512f17=!![]);const _0x54888e=_0x2caf63||!_0x314887[_0x51a519(0xea)];if(_0x54888e&&_0x4e4c99['length']>0x0)try{const _0x4eb57c=normalizeUIResponse(_0x4e4c99,{'mode':_0x75dc15,'validateComponent':_0x2c6acb}),_0x1a54d2=_0x4eb57c['uiMessages'][_0x51a519(0xe2)](_0x44faed);if(_0x1a54d2['length']>0x0){const _0x3fb98f=_0x1a54d2['map'](toSDKCompatibleA2UIMessage);_0x3e524e['processMessages'](_0x3fb98f),_0x44faed+=_0x1a54d2[_0x51a519(0xd5)],_0x512f17=!![];}}catch(_0x3211e6){_0x9b1f3b({'message':_0x3211e6 instanceof Error?_0x3211e6['message']:String(_0x3211e6)}),_0x512f17=!![];}_0x4c937b();if(_0x512f17)_0x4b528d();},_0x74fec9=()=>{const _0x4a654d=_0x4b25ca;if(_0x1cf5c3)return;const _0x104ae4=Array['from'](_0x3e524e['model']['surfacesMap']['keys']());for(const _0x2e1772 of _0x104ae4){_0x3e524e['model'][_0x4a654d(0xe0)](_0x2e1772);}_0x177d33=void 0x0,_0x3c77e5['length']=0x0,_0x4c937b(),_0x4b528d();},_0x3d6de5=()=>{const _0x47baba=_0x4b25ca;if(_0x1cf5c3)return;_0x1cf5c3=!![],_0x1ccf7b[_0x47baba(0xf2)](),_0x2ea1f0[_0x47baba(0xf2)]();for(const _0x17f135 of _0x3fab5f['values']())_0x17f135[_0x47baba(0xf2)]();_0x3fab5f[_0x47baba(0xe7)](),_0x3e524e[_0x47baba(0xee)][_0x47baba(0xf8)](),_0x290fba['clear']();},_0x114552=_0x4a6cfc=>{const _0x2fe3ec=_0x4b25ca;if(_0x1cf5c3)return()=>{};return _0x290fba[_0x2fe3ec(0xfc)](_0x4a6cfc),()=>{_0x290fba['delete'](_0x4a6cfc);};},_0x2699ae=()=>{const _0x541b2c=_0x4b25ca;if(_0x1cf5c3)return;if(_0x3c77e5['length']===0x0)return;_0x3c77e5[_0x541b2c(0xd5)]=0x0,_0x4b528d();};return{'ingest':_0x36ee6a,'ingestStreaming':_0x4cb00c,'endStream':_0x55a647,'reset':_0x74fec9,'clearErrors':_0x2699ae,'dispose':_0x3d6de5,'getState':_0xe278cf,'subscribe':_0x114552,'getClientCapabilities':_0x2a36f7=>_0x3e524e['getClientCapabilities'](_0x2a36f7),'getClientDataModel':()=>_0x3e524e[_0x4b25ca(0xec)]()};}export{createUIRuntime};
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@agentic-ui-experience/ui-runtime",
3
+ "version": "0.0.1-beta.1",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./basic-catalog": {
13
+ "types": "./dist/basic-catalog.d.ts",
14
+ "default": "./dist/basic-catalog.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "tag": "beta"
23
+ },
24
+ "dependencies": {
25
+ "@a2ui/web_core": "0.9.2",
26
+ "zod": "^3.25.76",
27
+ "@agentic-ui-experience/ui-core": "0.0.1-beta.1"
28
+ },
29
+ "devDependencies": {
30
+ "@a2ui/react": "0.9.0"
31
+ },
32
+ "scripts": {
33
+ "build": "node ../../scripts/build-obfuscated-package.mjs .",
34
+ "dev": "tsc -b -w --preserveWatchOutput --force",
35
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
36
+ "test": "pnpm run build && node --test \"tests/**/*.test.mjs\""
37
+ }
38
+ }