@agentic-ui-experience/ui-runtime 0.0.1-beta.1 → 0.0.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.zh-CN.md +236 -0
- package/dist/basic-catalog.js +1 -1
- package/dist/catalog.js +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +2 -2
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# @agentic-ui-experience/ui-runtime
|
|
2
|
+
|
|
3
|
+
`@agentic-ui-experience/ui-runtime` 是 UI message 的运行时状态层:接收 Agent 输出的 UI
|
|
4
|
+
message,按宿主注册的 catalog 解析并校验组件,维护可订阅的 UI 状态,再把用户在
|
|
5
|
+
UI 中触发的 action 回传给宿主。
|
|
6
|
+
|
|
7
|
+
它不负责构建 prompt,也不负责渲染组件;React 场景通常直接使用
|
|
8
|
+
`@agentic-ui-experience/ui-react`。
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Agent 输出
|
|
12
|
+
-> @agentic-ui-experience/ui-core 解析为 UI message
|
|
13
|
+
-> @agentic-ui-experience/ui-runtime 生成 surfaces / assistantText / errors
|
|
14
|
+
-> 渲染层消费 surfaces
|
|
15
|
+
-> 用户 action 回到宿主
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 架构总览
|
|
19
|
+
|
|
20
|
+
下图展示 `createUIRuntime()` 返回的 runtime 实例及其核心接口(写入、状态、回传三类):
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
Agent output
|
|
24
|
+
│
|
|
25
|
+
▼
|
|
26
|
+
┌─ WRITE · feed model output in ─────────────────────────────┐
|
|
27
|
+
│ ingest() one full output │
|
|
28
|
+
│ ingestStreaming() cumulative text │
|
|
29
|
+
│ endStream() finalize stream │
|
|
30
|
+
│ reuses ui-core normalizeUIResponse() + catalog check │
|
|
31
|
+
└──────────────────────────────────────────────────────────────┘
|
|
32
|
+
│
|
|
33
|
+
▼
|
|
34
|
+
┌─ STATE · subscribable runtime state ───────────────────────┐
|
|
35
|
+
│ surfaces / assistantText / errors │
|
|
36
|
+
│ read via getState() / subscribe() │
|
|
37
|
+
└──────────────────────────────────────────────────────────────┘
|
|
38
|
+
│
|
|
39
|
+
▼
|
|
40
|
+
┌─ RENDER · consumed by host ────────────────────────────────┐
|
|
41
|
+
│ render layer (@agentic-ui-experience/ui-react, etc.) consumes surfaces │
|
|
42
|
+
└──────────────────────────────────────────────────────────────┘
|
|
43
|
+
│
|
|
44
|
+
▼
|
|
45
|
+
┌─ CALLBACK · user action returns ───────────────────────────┐
|
|
46
|
+
│ user taps a component that carries an action │
|
|
47
|
+
│ onAction(action) -> back to the Agent (next turn) │
|
|
48
|
+
└──────────────────────────────────────────────────────────────┘
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- **写入侧**:`ingest()` 处理完整输出,`ingestStreaming()` / `endStream()` 处理流式;内部复用 `@agentic-ui-experience/ui-core` 的 `normalizeUIResponse()`,并以 `catalogs` 校验组件。
|
|
52
|
+
- **状态侧**:解析结果累积成 `surfaces / assistantText / errors`,通过 `getState()` 读取、`subscribe()` 订阅。
|
|
53
|
+
- **回传侧**:用户点击带 `action` 的组件时,runtime 经 `onAction` 把 action 交回宿主,开始下一轮。
|
|
54
|
+
|
|
55
|
+
## 核心接口
|
|
56
|
+
|
|
57
|
+
### `createUIRuntime()`
|
|
58
|
+
|
|
59
|
+
创建一个 runtime 实例:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { createUIRuntime } from "@agentic-ui-experience/ui-runtime";
|
|
63
|
+
|
|
64
|
+
const runtime = createUIRuntime({
|
|
65
|
+
catalogs: [appCatalog],
|
|
66
|
+
onAction: (action) => {
|
|
67
|
+
// 把用户 action 发回 Agent 或业务逻辑
|
|
68
|
+
},
|
|
69
|
+
onError: (error) => {
|
|
70
|
+
// 记录解析、校验或运行时错误
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`catalogs` 是必填项:runtime 用它识别组件名,并以组件自带的 Zod schema 校验
|
|
76
|
+
Agent 输出的 props。`normalizeMode` 默认为 `"repair"`,丢弃无效组件或消息、尽量
|
|
77
|
+
保留其余有效内容;`"strict"` 在首个错误处停止,并通过 `onError` / `errors` 暴露错误。
|
|
78
|
+
|
|
79
|
+
### `ingest()`
|
|
80
|
+
|
|
81
|
+
处理一次完整输出:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
runtime.ingest(modelOutput);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`modelOutput` 可以是完整 assistant 文本、`<a2ui-json>` 信封、UI message 数组,
|
|
88
|
+
或包含 `uiMessages` / `messages` 的对象。runtime 内部会调用
|
|
89
|
+
`normalizeUIResponse()`,所以宿主通常不需要先手动解析。
|
|
90
|
+
|
|
91
|
+
### `ingestStreaming()` / `endStream()`
|
|
92
|
+
|
|
93
|
+
处理流式输出:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
runtime.ingestStreaming(accumulatedText);
|
|
97
|
+
runtime.ingestStreaming(nextAccumulatedText);
|
|
98
|
+
runtime.endStream();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`ingestStreaming()` 接收的是“截至当前累积的完整文本”,不是本次 delta。
|
|
102
|
+
流结束时调用一次 `endStream()`,runtime 会补做最终解析,避免流式过程中尚未解析完整的
|
|
103
|
+
UI message 丢失。
|
|
104
|
+
|
|
105
|
+
### `getState()` / `subscribe()`
|
|
106
|
+
|
|
107
|
+
读取和订阅 runtime 状态:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const unsubscribe = runtime.subscribe(() => {
|
|
111
|
+
const state = runtime.getState();
|
|
112
|
+
render(state.surfaces);
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`getState()` 返回:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
{
|
|
120
|
+
surfaces: UIRuntimeSurface[];
|
|
121
|
+
assistantText?: string;
|
|
122
|
+
errors: UIRuntimeError[];
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- `surfaces`:渲染层要消费的 UI surface model。
|
|
127
|
+
- `assistantText`:UI 信封之外的普通 assistant 文本。
|
|
128
|
+
- `errors`:解析、组件校验或底层 runtime 错误。
|
|
129
|
+
|
|
130
|
+
`surfaces` 不是原始 JSON,而是 runtime 生成的对象模型:它是 `@agentic-ui-experience/ui-core` 的
|
|
131
|
+
`createSurface` / `updateComponents` / `updateDataModel` 等 UI message 被逐条
|
|
132
|
+
累积应用后的结果状态。单个 surface 的结构大致如下:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
const surface = {
|
|
136
|
+
id: "main",
|
|
137
|
+
catalog: { id: "https://a2ui.org/specification/v0_9/basic_catalog.json" },
|
|
138
|
+
dataModel: { /* 输入组件绑定的数据模型 */ },
|
|
139
|
+
componentsModel: {
|
|
140
|
+
root: {
|
|
141
|
+
id: "root",
|
|
142
|
+
type: "Text",
|
|
143
|
+
properties: { text: "Hello" },
|
|
144
|
+
componentTree: { id: "root", type: "Text", text: "Hello" },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`dataModel` 和 `componentsModel` 是对象模型而非普通字面量:组件通过
|
|
151
|
+
`surface.componentsModel.get("root")` 取单个、`entries` 遍历,而不是直接按 id 索引。
|
|
152
|
+
|
|
153
|
+
简言之,`SurfaceModel` 表示一个可渲染的 UI 区域:`componentsModel` 保存组件树/
|
|
154
|
+
组件集合,`dataModel` 保存输入状态。渲染层通常直接消费整个 `surface` 对象,而非
|
|
155
|
+
手动拼装组件。
|
|
156
|
+
|
|
157
|
+
### Action 回传
|
|
158
|
+
|
|
159
|
+
用户与 surface 的交互分两类,只有第一类会触发 `onAction`:
|
|
160
|
+
|
|
161
|
+
- **带 `action` 的组件**(典型是 `Button`):被点击时显式派发一个 action,经
|
|
162
|
+
A2UI binder 解析后到达 `onAction`。
|
|
163
|
+
- **输入类组件**(`TextField`、`ChoicePicker`、`Slider`、`DateTimeInput` 等):
|
|
164
|
+
只把用户输入写进该 surface 的 `dataModel`,**不会**触发 `onAction`。
|
|
165
|
+
|
|
166
|
+
也就是说,输入控件只改本地数据;要让 Agent 继续处理(再发一轮),必须经由一个带
|
|
167
|
+
action 的组件。如果某个选择/输入需要回到 Agent,可以为它配一个 `Button`,或自定义
|
|
168
|
+
一个带显式 action 属性的组件。
|
|
169
|
+
|
|
170
|
+
整条回路是:Agent 在 UI message 里输出一个带 `action` 的按钮 → 用户点击 →
|
|
171
|
+
runtime 把它解析成一个 action 交给 `onAction` → 宿主再发回 Agent。
|
|
172
|
+
|
|
173
|
+
**1. Agent 输出的组件定义**(描述一个带 action 的按钮):
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"component": "Button",
|
|
178
|
+
"child": "submit_label",
|
|
179
|
+
"action": {
|
|
180
|
+
"event": {
|
|
181
|
+
"name": "submitForm",
|
|
182
|
+
"context": { "source": "signup" }
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**2. 用户点击后 `onAction` 收到的 action**:
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
const runtime = createUIRuntime({
|
|
192
|
+
catalogs,
|
|
193
|
+
onAction: (action) => {
|
|
194
|
+
action.name; // "submitForm"
|
|
195
|
+
action.context; // { source: "signup" }
|
|
196
|
+
action.surfaceId; // "main",action 来自哪个 surface
|
|
197
|
+
action.sourceComponentId; // 触发该 action 的组件 id
|
|
198
|
+
action.timestamp; // ISO 时间戳
|
|
199
|
+
// 把它发回 Agent,开始下一轮
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
组件定义里的 `action.event.{name, context}` 会被拍平成回传 action 的 `name` 和
|
|
205
|
+
`context`,runtime 再补上 `surfaceId`、`sourceComponentId`、`timestamp` 三个字段。
|
|
206
|
+
|
|
207
|
+
## 其他方法
|
|
208
|
+
|
|
209
|
+
| 方法 | 说明 |
|
|
210
|
+
| --- | --- |
|
|
211
|
+
| `reset()` | 清空 `surfaces`、`assistantText` 和 `errors`,runtime 可继续使用。 |
|
|
212
|
+
| `clearErrors()` | 只清空错误。 |
|
|
213
|
+
| `dispose()` | 释放订阅和底层资源;之后写入类方法变为空操作。 |
|
|
214
|
+
| `getClientCapabilities()` | 返回当前客户端能力描述。 |
|
|
215
|
+
| `getClientDataModel()` | 返回当前客户端数据模型。 |
|
|
216
|
+
|
|
217
|
+
## 导出
|
|
218
|
+
|
|
219
|
+
主要导出:
|
|
220
|
+
|
|
221
|
+
- `createUIRuntime`
|
|
222
|
+
- `UIRuntime`
|
|
223
|
+
- `UIRuntimeOptions`
|
|
224
|
+
- `UIRuntimeState`
|
|
225
|
+
- `UIRuntimeSurface`
|
|
226
|
+
- `UIRuntimeCatalog`
|
|
227
|
+
- `UIAction`
|
|
228
|
+
- `UIRuntimeError`
|
|
229
|
+
|
|
230
|
+
为定义 catalog,本包也重新导出 `Catalog` 和 `z`。
|
|
231
|
+
|
|
232
|
+
## 测试
|
|
233
|
+
|
|
234
|
+
```sh
|
|
235
|
+
pnpm --filter @agentic-ui-experience/ui-runtime test
|
|
236
|
+
```
|
package/dist/basic-catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3dc350,_0x354912){var _0x399d1d=_0xe1be,_0x167f42=_0x3dc350();while(!![]){try{var _0x412b69=parseInt(_0x399d1d(0x91))/0x1*(-parseInt(_0x399d1d(0x94))/0x2)+parseInt(_0x399d1d(0x95))/0x3+-parseInt(_0x399d1d(0x97))/0x4+parseInt(_0x399d1d(0x96))/0x5*(-parseInt(_0x399d1d(0x92))/0x6)+parseInt(_0x399d1d(0x9b))/0x7+-parseInt(_0x399d1d(0x99))/0x8*(parseInt(_0x399d1d(0x93))/0x9)+-parseInt(_0x399d1d(0x98))/0xa*(-parseInt(_0x399d1d(0x9a))/0xb);if(_0x412b69===_0x354912)break;else _0x167f42['push'](_0x167f42['shift']());}catch(_0x5f4542){_0x167f42['push'](_0x167f42['shift']());}}}(_0x5e33,0xf1b9a));export*from'@a2ui/web_core/v0_9/basic_catalog';function _0xe1be(_0x1e3418,_0x3a5c9b){_0x1e3418=_0x1e3418-0x91;var _0x5e337e=_0x5e33();var _0xe1be09=_0x5e337e[_0x1e3418];return _0xe1be09;}function _0x5e33(){var _0x2c42b4=['56661130YqIPqq','1557272MjftUk','11bTjKcc','6790392NPKREd','86yfApJl','6702kKuWHP','27ChhRTi','36120dSLhsh','90210zXjfEn','7890QIyXMA','7105480UBRSYt'];_0x5e33=function(){return _0x2c42b4;};return _0x5e33();}
|
package/dist/catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x58e9d7,_0x2a2b92){const _0x28a7cd=_0x2157,_0x1f430=_0x58e9d7();while(!![]){try{const _0x4ad343=-parseInt(_0x28a7cd(0x144))/0x1*(parseInt(_0x28a7cd(0x147))/0x2)+parseInt(_0x28a7cd(0x145))/0x3+parseInt(_0x28a7cd(0x149))/0x4+parseInt(_0x28a7cd(0x141))/0x5+parseInt(_0x28a7cd(0x142))/0x6*(-parseInt(_0x28a7cd(0x148))/0x7)+-parseInt(_0x28a7cd(0x14d))/0x8*(parseInt(_0x28a7cd(0x14c))/0x9)+parseInt(_0x28a7cd(0x143))/0xa;if(_0x4ad343===_0x2a2b92)break;else _0x1f430['push'](_0x1f430['shift']());}catch(_0x4eb41f){_0x1f430['push'](_0x1f430['shift']());}}}(_0x3a5c,0xd3596));import{Catalog}from'@a2ui/web_core/v0_9';function _0x3a5c(){const _0x6c7e7b=['1281304prrkRH','components','values','2761443TndMaz','24lbiNkA','5918480EDHNYg','672yJErtQ','8929250BzZuOu','2KlAQrg','1758612tWVRFY','functions','275224LzDWae','57610WwNUrI'];_0x3a5c=function(){return _0x6c7e7b;};return _0x3a5c();}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(_0x4381a9){const _0x464152=_0x2157,_0x212a65=_0x4381a9['extends']??basicCatalog,_0x5f00a3=_0x4381a9[_0x464152(0x14a)]??[],_0x1175d9=_0x4381a9['functions']??[];return new Catalog(_0x4381a9['id'],[..._0x212a65['components'][_0x464152(0x14b)](),..._0x5f00a3],[..._0x212a65[_0x464152(0x146)][_0x464152(0x14b)](),..._0x1175d9],_0x212a65['themeSchema']);}const basicCatalog=new Catalog(A2UI_BASIC_CATALOG_ID,BASIC_COMPONENTS,BASIC_FUNCTIONS);function _0x2157(_0x114441,_0x2b412d){_0x114441=_0x114441-0x141;const _0x3a5c65=_0x3a5c();let _0x215724=_0x3a5c65[_0x114441];return _0x215724;}export{basicCatalog,defineCatalog};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1f311a,_0x77d4e4){var _0x306f73=_0x4f02,_0x204b42=_0x1f311a();while(!![]){try{var _0x46909a=parseInt(_0x306f73(0xda))/0x1+parseInt(_0x306f73(0xd7))/0x2*(-parseInt(_0x306f73(0xd3))/0x3)+parseInt(_0x306f73(0xdb))/0x4+-parseInt(_0x306f73(0xd9))/0x5+-parseInt(_0x306f73(0xd6))/0x6+parseInt(_0x306f73(0xd4))/0x7+-parseInt(_0x306f73(0xd5))/0x8*(-parseInt(_0x306f73(0xd8))/0x9);if(_0x46909a===_0x77d4e4)break;else _0x204b42['push'](_0x204b42['shift']());}catch(_0x484a63){_0x204b42['push'](_0x204b42['shift']());}}}(_0x2d77,0x3eae0));import{basicCatalog,defineCatalog}from'./catalog.js';import{createUIRuntime}from'./runtime.js';function _0x4f02(_0x3fdf40,_0x480dea){_0x3fdf40=_0x3fdf40-0xd3;var _0x2d77b8=_0x2d77();var _0x4f025c=_0x2d77b8[_0x3fdf40];return _0x4f025c;}import{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema}from'@a2ui/web_core/v0_9';function _0x2d77(){var _0x16515d=['9TfuYDI','966295lunoer','76486eaUkAx','1475960LGdOaY','492819SWQnZF','1808233RKMLpg','1165368VbrsLp','1411188MHIZxF','2aDaoeZ'];_0x2d77=function(){return _0x16515d;};return _0x2d77();}import{z}from'zod';export{ActionSchema,Catalog,CheckableSchema,CommonSchemas,DataBindingSchema,DynamicBooleanSchema,DynamicNumberSchema,DynamicStringListSchema,DynamicStringSchema,DynamicValueSchema,FunctionCallSchema,basicCatalog,createUIRuntime,defineCatalog,z};
|
package/dist/runtime.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4d1c37,_0x108e62){const _0x500f40=_0x56d2,_0x25e22f=_0x4d1c37();while(!![]){try{const _0xe99442=-parseInt(_0x500f40(0x7f))/0x1*(parseInt(_0x500f40(0x85))/0x2)+parseInt(_0x500f40(0x8b))/0x3*(-parseInt(_0x500f40(0x7c))/0x4)+-parseInt(_0x500f40(0x70))/0x5*(parseInt(_0x500f40(0x88))/0x6)+parseInt(_0x500f40(0x82))/0x7+-parseInt(_0x500f40(0x68))/0x8+parseInt(_0x500f40(0x7d))/0x9+parseInt(_0x500f40(0x89))/0xa*(parseInt(_0x500f40(0x6c))/0xb);if(_0xe99442===_0x108e62)break;else _0x25e22f['push'](_0x25e22f['shift']());}catch(_0x54762d){_0x25e22f['push'](_0x25e22f['shift']());}}}(_0x1c71,0x3f943));import{MessageProcessor}from'@a2ui/web_core/v0_9';import{splitUIEnvelope,normalizeUIResponse,toSDKCompatibleA2UIMessage}from'@agentic-ui-experience/ui-core';function scanNextTopLevelObject(_0xc96e2e,_0x32c09f){const _0x3a4560=_0x56d2;let _0x16b359=_0x32c09f;while(_0x16b359<_0xc96e2e['length']&&/\s/[_0x3a4560(0x75)](_0xc96e2e[_0x16b359]))_0x16b359++;while(_0x16b359<_0xc96e2e['length']&&(_0xc96e2e[_0x16b359]==='['||_0xc96e2e[_0x16b359]===',')){_0x16b359++;while(_0x16b359<_0xc96e2e['length']&&/\s/['test'](_0xc96e2e[_0x16b359]))_0x16b359++;}if(_0x16b359>=_0xc96e2e['length']||_0xc96e2e[_0x16b359]!=='{')return null;let _0x9dff10=0x0,_0x24f25d=![],_0x35224c=![];const _0x2576fb=_0x16b359;for(;_0x16b359<_0xc96e2e[_0x3a4560(0x6a)];_0x16b359++){const _0x3aaec2=_0xc96e2e[_0x16b359];if(_0x24f25d){if(_0x35224c){_0x35224c=![];continue;}if(_0x3aaec2==='\x5c'){_0x35224c=!![];continue;}_0x3aaec2==='\x22'&&(_0x24f25d=![]);continue;}if(_0x3aaec2==='\x22'){_0x24f25d=!![];continue;}if(_0x3aaec2==='{')_0x9dff10++;else{if(_0x3aaec2==='}'){_0x9dff10--;if(_0x9dff10===0x0)return{'obj':_0xc96e2e[_0x3a4560(0x80)](_0x2576fb,_0x16b359+0x1),'nextIdx':_0x16b359+0x1};}}}return null;}function createUIRuntime(_0x2cece3){const _0x338484=_0x56d2,_0x27d39f=_0x2cece3[_0x338484(0x7e)],_0xe01a41=_0x2cece3['normalizeMode']??_0x338484(0x6f),_0x5527f8=new Map();for(const _0x1f46c2 of _0x27d39f){for(const [_0x31e961,_0x3016c7]of _0x1f46c2['components']){if(!_0x5527f8['has'](_0x31e961))_0x5527f8[_0x338484(0x69)](_0x31e961,_0x3016c7['schema']);}}const _0x5b9c1e=(_0x36b6a1,_0x277c2c)=>{const _0x44693b=_0x338484,_0x37a1b9=_0x5527f8[_0x44693b(0x67)](_0x36b6a1);if(!_0x37a1b9)return['unknown\x20component\x20\x22'+_0x36b6a1+'\x22'];const _0x9fcae8={..._0x277c2c};delete _0x9fcae8['id'],delete _0x9fcae8['component'];const _0x3eba3f=_0x37a1b9['safeParse'](_0x9fcae8);if(_0x3eba3f['success'])return[];return _0x3eba3f[_0x44693b(0x83)]['issues'][_0x44693b(0x8e)](_0x4efbe9=>{const _0x47d00a=_0x44693b,_0x5414da=_0x4efbe9['path']['join']('.');return _0x5414da['length']>0x0?_0x5414da+':\x20'+_0x4efbe9['message']:_0x4efbe9[_0x47d00a(0x8c)];});},_0x1ac1d3=new Set();let _0x174359;const _0x59c20a=[],_0x4c2406=new Map();let _0x1e8d5c=![],_0x46b974='',_0xb35cc8=0x0,_0x129dec=0x0,_0x1f2b4a=![];const _0x36afea=()=>{_0x46b974='',_0xb35cc8=0x0,_0x129dec=0x0,_0x1f2b4a=![];},_0x3b99f4=new MessageProcessor(_0x27d39f,_0x103e48=>{const _0x1306ba=_0x338484;_0x2cece3[_0x1306ba(0x84)]?.(_0x103e48);});let _0x2c121b=null;const _0x1489d7=()=>{_0x2c121b=null;for(const _0x2545c9 of _0x1ac1d3)_0x2545c9();},_0x59f8a2=_0x93ca7a=>{_0x59c20a['push'](_0x93ca7a),_0x2cece3['onError']?.(_0x93ca7a);},_0x358e38=_0x3b99f4['onSurfaceCreated'](_0x368600=>{const _0x2c20ff=_0x338484,_0x4554eb=_0x368600[_0x2c20ff(0x8a)]['subscribe'](_0x39e9c4=>{const _0x36b33f=_0x2c20ff,_0x50370a=_0x39e9c4??{};_0x59f8a2({'surfaceId':_0x368600['id'],..._0x50370a[_0x36b33f(0x74)]!==void 0x0?{'code':_0x50370a['code']}:{},'message':_0x50370a[_0x36b33f(0x8c)]??_0x36b33f(0x86)}),_0x1489d7();});_0x4c2406[_0x2c20ff(0x69)](_0x368600['id'],_0x4554eb),_0x1489d7();}),_0x15cba9=_0x3b99f4[_0x338484(0x78)](_0xa1ce4a=>{const _0x964cd5=_0x338484;_0x4c2406['get'](_0xa1ce4a)?.[_0x964cd5(0x7b)](),_0x4c2406[_0x964cd5(0x6e)](_0xa1ce4a),_0x1489d7();}),_0xcc6a1f=()=>{const _0x1eb3ab=_0x338484;if(_0x2c121b!==null)return _0x2c121b;const _0x55fd1a=Array[_0x1eb3ab(0x7a)](_0x3b99f4['model']['surfacesMap']['values']());return _0x2c121b=_0x174359===void 0x0?{'surfaces':_0x55fd1a,'errors':[..._0x59c20a]}:{'surfaces':_0x55fd1a,'assistantText':_0x174359,'errors':[..._0x59c20a]},_0x2c121b;},_0x32e62d=_0x1db268=>{const _0x24c1e8=_0x338484;if(_0x1e8d5c)return;let _0xb94c89=![];try{const _0x505259=normalizeUIResponse(_0x1db268,{'mode':_0xe01a41,'validateComponent':_0x5b9c1e});_0x505259[_0x24c1e8(0x73)]!==void 0x0&&(_0x174359=_0x505259['assistantText'],_0xb94c89=!![]);if(_0x505259['uiMessages']['length']>0x0){const _0x2692b4=_0x505259['uiMessages'][_0x24c1e8(0x8e)](toSDKCompatibleA2UIMessage);_0x3b99f4['processMessages'](_0x2692b4),_0xb94c89=!![];}}catch(_0x1b0664){_0x59f8a2({'message':_0x1b0664 instanceof Error?_0x1b0664['message']:String(_0x1b0664)}),_0xb94c89=!![];}if(_0xb94c89)_0x1489d7();},_0x19bfba=_0x460c58=>{const _0x3ce441=_0x338484;if(_0x1e8d5c)return;!_0x460c58['startsWith'](_0x46b974)&&_0x36afea();let _0x9fa3d=![];const _0x3096e1=splitUIEnvelope(_0x460c58);_0x174359!==_0x3096e1['visibleText']&&(_0x174359=_0x3096e1['visibleText'],_0x9fa3d=!![]);if(_0x3096e1[_0x3ce441(0x87)]!==null&&!_0x1f2b4a)while(!![]){const _0x31479d=scanNextTopLevelObject(_0x3096e1['a2uiInner'],_0xb35cc8);if(!_0x31479d)break;try{const _0x2437dd=JSON[_0x3ce441(0x79)](_0x31479d[_0x3ce441(0x6b)]),_0x2e0815=toSDKCompatibleA2UIMessage(_0x2437dd);_0x3b99f4['processMessages']([_0x2e0815]),_0x129dec++,_0x9fa3d=!![];}catch{_0x1f2b4a=!![];break;}_0xb35cc8=_0x31479d[_0x3ce441(0x81)];}_0x46b974=_0x460c58;if(_0x9fa3d)_0x1489d7();},_0x3abb57=()=>{const _0x4a119a=_0x338484;if(_0x1e8d5c)return;const _0x3cf315=_0x46b974;if(_0x3cf315['length']===0x0&&!_0x1f2b4a)return;const _0x4fd850=splitUIEnvelope(_0x3cf315);let _0x5ca2d2=![];_0x174359!==_0x4fd850[_0x4a119a(0x77)]&&(_0x174359=_0x4fd850['visibleText'],_0x5ca2d2=!![]);const _0x1dc241=_0x1f2b4a||!_0x4fd850['closed'];if(_0x1dc241&&_0x3cf315['length']>0x0)try{const _0x4f12cb=normalizeUIResponse(_0x3cf315,{'mode':_0xe01a41,'validateComponent':_0x5b9c1e}),_0x43ee3e=_0x4f12cb[_0x4a119a(0x71)]['slice'](_0x129dec);if(_0x43ee3e[_0x4a119a(0x6a)]>0x0){const _0x248ef2=_0x43ee3e['map'](toSDKCompatibleA2UIMessage);_0x3b99f4['processMessages'](_0x248ef2),_0x129dec+=_0x43ee3e[_0x4a119a(0x6a)],_0x5ca2d2=!![];}}catch(_0x4b7f2c){_0x59f8a2({'message':_0x4b7f2c instanceof Error?_0x4b7f2c[_0x4a119a(0x8c)]:String(_0x4b7f2c)}),_0x5ca2d2=!![];}_0x36afea();if(_0x5ca2d2)_0x1489d7();},_0x41a5e2=()=>{if(_0x1e8d5c)return;const _0x2be51c=Array['from'](_0x3b99f4['model']['surfacesMap']['keys']());for(const _0x573b38 of _0x2be51c){_0x3b99f4['model']['deleteSurface'](_0x573b38);}_0x174359=void 0x0,_0x59c20a['length']=0x0,_0x36afea(),_0x1489d7();},_0x54d53b=()=>{const _0x210dc2=_0x338484;if(_0x1e8d5c)return;_0x1e8d5c=!![],_0x358e38[_0x210dc2(0x7b)](),_0x15cba9['unsubscribe']();for(const _0x119e48 of _0x4c2406[_0x210dc2(0x72)]())_0x119e48['unsubscribe']();_0x4c2406[_0x210dc2(0x8d)](),_0x3b99f4[_0x210dc2(0x76)]['dispose'](),_0x1ac1d3[_0x210dc2(0x8d)]();},_0x1006d7=_0x14f431=>{if(_0x1e8d5c)return()=>{};return _0x1ac1d3['add'](_0x14f431),()=>{_0x1ac1d3['delete'](_0x14f431);};},_0x4bdd52=()=>{const _0x250086=_0x338484;if(_0x1e8d5c)return;if(_0x59c20a[_0x250086(0x6a)]===0x0)return;_0x59c20a['length']=0x0,_0x1489d7();};return{'ingest':_0x32e62d,'ingestStreaming':_0x19bfba,'endStream':_0x3abb57,'reset':_0x41a5e2,'clearErrors':_0x4bdd52,'dispose':_0x54d53b,'getState':_0xcc6a1f,'subscribe':_0x1006d7,'getClientCapabilities':_0x4687e3=>_0x3b99f4[_0x338484(0x6d)](_0x4687e3),'getClientDataModel':()=>_0x3b99f4['getClientDataModel']()};}function _0x56d2(_0x22ce37,_0x5d793e){_0x22ce37=_0x22ce37-0x67;const _0x1c7177=_0x1c71();let _0x56d26d=_0x1c7177[_0x22ce37];return _0x56d26d;}export{createUIRuntime};function _0x1c71(){const _0x117324=['code','test','model','visibleText','onSurfaceDeleted','parse','from','unsubscribe','8zWaLAx','1536075EckIUd','catalogs','6108ilRPxs','slice','nextIdx','3342759uLsHJx','error','onAction','146sIrfRu','A2UI\x20surface\x20error','a2uiInner','918978MfDNUW','24510Zlsnhw','onError','775974VsPVmJ','message','clear','map','get','2857784TJIAsx','set','length','obj','4873pJvVfx','getClientCapabilities','delete','repair','5BNUrOv','uiMessages','values','assistantText'];_0x1c71=function(){return _0x117324;};return _0x1c71();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-ui-experience/ui-runtime",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
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
|
|
27
|
+
"@agentic-ui-experience/ui-core": "0.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@a2ui/react": "0.9.0"
|