@wodecorp/openui-vue-a2ui 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WodeCorp / OpenUI Vue Contributors
4
+ Portions derived from OpenUI, Copyright (c) 2011-2026 Thesys Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ # @wodecorp/openui-vue-a2ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A2UI v1.0 protocol client (`createA2UIClient`) and Vue 3 renderer (`<A2UIRenderer />`) for OpenUI — supporting surface lifecycle (`createSurface`, `updateComponents`, `updateDataModel`, `deleteSurface`), JSON Pointer state sync, and bidirectional agent/renderer function calls.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @wodecorp/openui-vue-a2ui @wodecorp/openui-vue-lang vue zod
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```vue
14
+ <script setup lang="ts">
15
+ import { onMounted } from "vue";
16
+ import { createA2UIClient } from "@wodecorp/openui-vue-a2ui";
17
+ import { A2UIRenderer } from "@wodecorp/openui-vue-a2ui/vue";
18
+ import { openuiLibrary } from "@wodecorp/openui-vue-ui";
19
+
20
+ const client = createA2UIClient({
21
+ schema: openuiLibrary.toJSONSchema(),
22
+ rootName: openuiLibrary.root,
23
+ });
24
+
25
+ onMounted(async () => {
26
+ await client.process({
27
+ version: "v1.0",
28
+ createSurface: {
29
+ surfaceId: "main",
30
+ catalogId: "openui-vue-default",
31
+ sendDataModel: true,
32
+ components: ['root = Card([TextContent("Hello A2UI v1.0")])'],
33
+ dataModel: {},
34
+ },
35
+ });
36
+ });
37
+ </script>
38
+
39
+ <template>
40
+ <A2UIRenderer :client="client" surface-id="main" :library="openuiLibrary" />
41
+ </template>
42
+ ```
43
+
44
+ ## Subpath Exports
45
+
46
+ - `.` — `createA2UIClient`, JSON Pointer helpers, and protocol types
47
+ - `./vue` — `A2UIRenderer` Vue 3 component and `A2UIRendererProps`
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,14 @@
1
+ # Third-Party Notices
2
+
3
+ This repository implements Vue 3 counterpart packages for OpenUI and derives algorithms, styles, or component interaction semantics from the following open-source projects:
4
+
5
+ - **OpenUI** (`thesysdev/openui`, MIT License, Copyright (c) Thesys Inc.)
6
+ - **Radix Primitives** (`radix-ui/primitives`, MIT License, Copyright (c) WorkOS)
7
+ - **Floating UI** (`floating-ui/floating-ui`, MIT License, Copyright (c) Floating UI contributors)
8
+ - **React DayPicker** (`gpbl/react-day-picker`, MIT License, Copyright (c) Giampaolo Bellavite)
9
+ - **TanStack Table** (`TanStack/table`, MIT License, Copyright (c) Tanner Linsley)
10
+ - **Lucide Icons** (`lucide-icons/lucide`, ISC / MIT License, Copyright (c) Lucide Contributors)
11
+ - **KaTeX** (`KaTeX/KaTeX`, MIT License, Copyright (c) Khan Academy)
12
+ - **D3** (`d3/d3-scale`, `d3-selection`, `d3-shape`, `d3-geo`, ISC License)
13
+ - **Zustand** (`pmndrs/zustand`, MIT License)
14
+ - **aria-hidden** & **react-remove-scroll** (`theKashey`, MIT License)
@@ -0,0 +1,504 @@
1
+ import { ActionEvent, LibraryJSONSchema, OpenUIError, ParseResult } from "@openuidev/lang-core";
2
+ import { z } from "zod/v4";
3
+ declare const jsonValueSchema: z.ZodJSONSchema;
4
+ declare const jsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
5
+ declare const messageMetadataSchema: z.ZodObject<{
6
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
7
+ }, z.core.$strict>;
8
+ declare const a2uiFunctionCallSchema: z.ZodObject<{
9
+ call: z.ZodString;
10
+ catalogId: z.ZodOptional<z.ZodString>;
11
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
12
+ }, z.core.$strict>;
13
+ declare const a2uiFunctionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
14
+ functionCallId: z.ZodString;
15
+ value: z.ZodJSONSchema;
16
+ }, z.core.$strict>, z.ZodObject<{
17
+ functionCallId: z.ZodString;
18
+ error: z.ZodObject<{
19
+ code: z.ZodString;
20
+ message: z.ZodString;
21
+ }, z.core.$strict>;
22
+ }, z.core.$strict>]>;
23
+ declare const createSurfaceMessageSchema: z.ZodObject<{
24
+ version: z.ZodLiteral<"v1.0">;
25
+ createSurface: z.ZodObject<{
26
+ surfaceId: z.ZodString;
27
+ catalogId: z.ZodOptional<z.ZodString>;
28
+ sendDataModel: z.ZodOptional<z.ZodBoolean>;
29
+ components: z.ZodOptional<z.ZodArray<z.ZodString>>;
30
+ dataModel: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
31
+ metadata: z.ZodOptional<z.ZodObject<{
32
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
33
+ }, z.core.$strict>>;
34
+ }, z.core.$strict>;
35
+ }, z.core.$strict>;
36
+ declare const updateComponentsMessageSchema: z.ZodObject<{
37
+ version: z.ZodLiteral<"v1.0">;
38
+ updateComponents: z.ZodObject<{
39
+ surfaceId: z.ZodString;
40
+ components: z.ZodArray<z.ZodString>;
41
+ }, z.core.$strict>;
42
+ }, z.core.$strict>;
43
+ declare const updateDataModelMessageSchema: z.ZodObject<{
44
+ version: z.ZodLiteral<"v1.0">;
45
+ updateDataModel: z.ZodObject<{
46
+ surfaceId: z.ZodString;
47
+ path: z.ZodOptional<z.ZodString>;
48
+ value: z.ZodJSONSchema;
49
+ }, z.core.$strict>;
50
+ }, z.core.$strict>;
51
+ declare const deleteSurfaceMessageSchema: z.ZodObject<{
52
+ version: z.ZodLiteral<"v1.0">;
53
+ deleteSurface: z.ZodObject<{
54
+ surfaceId: z.ZodString;
55
+ }, z.core.$strict>;
56
+ }, z.core.$strict>;
57
+ declare const callRendererFunctionMessageSchema: z.ZodObject<{
58
+ version: z.ZodLiteral<"v1.0">;
59
+ callRendererFunction: z.ZodObject<{
60
+ functionCallId: z.ZodString;
61
+ callFunction: z.ZodObject<{
62
+ call: z.ZodString;
63
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
64
+ catalogId: z.ZodString;
65
+ }, z.core.$strict>;
66
+ }, z.core.$strict>;
67
+ }, z.core.$strict>;
68
+ declare const agentFunctionResponseMessageSchema: z.ZodObject<{
69
+ version: z.ZodLiteral<"v1.0">;
70
+ agentFunctionResponse: z.ZodUnion<readonly [z.ZodObject<{
71
+ functionCallId: z.ZodString;
72
+ value: z.ZodJSONSchema;
73
+ }, z.core.$strict>, z.ZodObject<{
74
+ functionCallId: z.ZodString;
75
+ error: z.ZodObject<{
76
+ code: z.ZodString;
77
+ message: z.ZodString;
78
+ }, z.core.$strict>;
79
+ }, z.core.$strict>]>;
80
+ }, z.core.$strict>;
81
+ declare const agentToRendererMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
82
+ version: z.ZodLiteral<"v1.0">;
83
+ createSurface: z.ZodObject<{
84
+ surfaceId: z.ZodString;
85
+ catalogId: z.ZodOptional<z.ZodString>;
86
+ sendDataModel: z.ZodOptional<z.ZodBoolean>;
87
+ components: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
+ dataModel: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
89
+ metadata: z.ZodOptional<z.ZodObject<{
90
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
91
+ }, z.core.$strict>>;
92
+ }, z.core.$strict>;
93
+ }, z.core.$strict>, z.ZodObject<{
94
+ version: z.ZodLiteral<"v1.0">;
95
+ updateComponents: z.ZodObject<{
96
+ surfaceId: z.ZodString;
97
+ components: z.ZodArray<z.ZodString>;
98
+ }, z.core.$strict>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ version: z.ZodLiteral<"v1.0">;
101
+ updateDataModel: z.ZodObject<{
102
+ surfaceId: z.ZodString;
103
+ path: z.ZodOptional<z.ZodString>;
104
+ value: z.ZodJSONSchema;
105
+ }, z.core.$strict>;
106
+ }, z.core.$strict>, z.ZodObject<{
107
+ version: z.ZodLiteral<"v1.0">;
108
+ deleteSurface: z.ZodObject<{
109
+ surfaceId: z.ZodString;
110
+ }, z.core.$strict>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ version: z.ZodLiteral<"v1.0">;
113
+ callRendererFunction: z.ZodObject<{
114
+ functionCallId: z.ZodString;
115
+ callFunction: z.ZodObject<{
116
+ call: z.ZodString;
117
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
118
+ catalogId: z.ZodString;
119
+ }, z.core.$strict>;
120
+ }, z.core.$strict>;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ version: z.ZodLiteral<"v1.0">;
123
+ agentFunctionResponse: z.ZodUnion<readonly [z.ZodObject<{
124
+ functionCallId: z.ZodString;
125
+ value: z.ZodJSONSchema;
126
+ }, z.core.$strict>, z.ZodObject<{
127
+ functionCallId: z.ZodString;
128
+ error: z.ZodObject<{
129
+ code: z.ZodString;
130
+ message: z.ZodString;
131
+ }, z.core.$strict>;
132
+ }, z.core.$strict>]>;
133
+ }, z.core.$strict>]>;
134
+ declare const actionMessageSchema: z.ZodObject<{
135
+ version: z.ZodLiteral<"v1.0">;
136
+ action: z.ZodObject<{
137
+ name: z.ZodString;
138
+ userMessage: z.ZodOptional<z.ZodString>;
139
+ surfaceId: z.ZodString;
140
+ sourceComponentId: z.ZodString;
141
+ timestamp: z.ZodISODateTime;
142
+ context: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
143
+ metadata: z.ZodOptional<z.ZodObject<{
144
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
145
+ }, z.core.$strict>>;
146
+ }, z.core.$strict>;
147
+ }, z.core.$strict>;
148
+ declare const callAgentFunctionMessageSchema: z.ZodObject<{
149
+ version: z.ZodLiteral<"v1.0">;
150
+ callAgentFunction: z.ZodObject<{
151
+ surfaceId: z.ZodString;
152
+ functionCallId: z.ZodString;
153
+ callFunction: z.ZodObject<{
154
+ call: z.ZodString;
155
+ catalogId: z.ZodOptional<z.ZodString>;
156
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
157
+ }, z.core.$strict>;
158
+ }, z.core.$strict>;
159
+ }, z.core.$strict>;
160
+ declare const rendererFunctionResponseMessageSchema: z.ZodObject<{
161
+ version: z.ZodLiteral<"v1.0">;
162
+ rendererFunctionResponse: z.ZodUnion<readonly [z.ZodObject<{
163
+ functionCallId: z.ZodString;
164
+ value: z.ZodJSONSchema;
165
+ }, z.core.$strict>, z.ZodObject<{
166
+ functionCallId: z.ZodString;
167
+ error: z.ZodObject<{
168
+ code: z.ZodString;
169
+ message: z.ZodString;
170
+ }, z.core.$strict>;
171
+ }, z.core.$strict>]>;
172
+ }, z.core.$strict>;
173
+ declare const validationFailedErrorMessageSchema: z.ZodObject<{
174
+ version: z.ZodLiteral<"v1.0">;
175
+ error: z.ZodObject<{
176
+ code: z.ZodEnum<{
177
+ VALIDATION_FAILED: "VALIDATION_FAILED";
178
+ UNALLOWED_PARENT: "UNALLOWED_PARENT";
179
+ UNALLOWED_CHILD: "UNALLOWED_CHILD";
180
+ }>;
181
+ surfaceId: z.ZodString;
182
+ path: z.ZodString;
183
+ message: z.ZodString;
184
+ }, z.core.$strict>;
185
+ }, z.core.$strict>;
186
+ declare const genericErrorMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
187
+ version: z.ZodLiteral<"v1.0">;
188
+ error: z.ZodObject<{
189
+ code: z.ZodString;
190
+ message: z.ZodString;
191
+ surfaceId: z.ZodString;
192
+ }, z.core.$strict>;
193
+ }, z.core.$strict>, z.ZodObject<{
194
+ version: z.ZodLiteral<"v1.0">;
195
+ error: z.ZodObject<{
196
+ code: z.ZodString;
197
+ message: z.ZodString;
198
+ functionCallId: z.ZodString;
199
+ }, z.core.$strict>;
200
+ }, z.core.$strict>]>;
201
+ declare const rendererToAgentMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
202
+ version: z.ZodLiteral<"v1.0">;
203
+ action: z.ZodObject<{
204
+ name: z.ZodString;
205
+ userMessage: z.ZodOptional<z.ZodString>;
206
+ surfaceId: z.ZodString;
207
+ sourceComponentId: z.ZodString;
208
+ timestamp: z.ZodISODateTime;
209
+ context: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
210
+ metadata: z.ZodOptional<z.ZodObject<{
211
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
212
+ }, z.core.$strict>>;
213
+ }, z.core.$strict>;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ version: z.ZodLiteral<"v1.0">;
216
+ callAgentFunction: z.ZodObject<{
217
+ surfaceId: z.ZodString;
218
+ functionCallId: z.ZodString;
219
+ callFunction: z.ZodObject<{
220
+ call: z.ZodString;
221
+ catalogId: z.ZodOptional<z.ZodString>;
222
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
223
+ }, z.core.$strict>;
224
+ }, z.core.$strict>;
225
+ }, z.core.$strict>, z.ZodObject<{
226
+ version: z.ZodLiteral<"v1.0">;
227
+ rendererFunctionResponse: z.ZodUnion<readonly [z.ZodObject<{
228
+ functionCallId: z.ZodString;
229
+ value: z.ZodJSONSchema;
230
+ }, z.core.$strict>, z.ZodObject<{
231
+ functionCallId: z.ZodString;
232
+ error: z.ZodObject<{
233
+ code: z.ZodString;
234
+ message: z.ZodString;
235
+ }, z.core.$strict>;
236
+ }, z.core.$strict>]>;
237
+ }, z.core.$strict>, z.ZodObject<{
238
+ version: z.ZodLiteral<"v1.0">;
239
+ error: z.ZodObject<{
240
+ code: z.ZodEnum<{
241
+ VALIDATION_FAILED: "VALIDATION_FAILED";
242
+ UNALLOWED_PARENT: "UNALLOWED_PARENT";
243
+ UNALLOWED_CHILD: "UNALLOWED_CHILD";
244
+ }>;
245
+ surfaceId: z.ZodString;
246
+ path: z.ZodString;
247
+ message: z.ZodString;
248
+ }, z.core.$strict>;
249
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
250
+ version: z.ZodLiteral<"v1.0">;
251
+ error: z.ZodObject<{
252
+ code: z.ZodString;
253
+ message: z.ZodString;
254
+ surfaceId: z.ZodString;
255
+ }, z.core.$strict>;
256
+ }, z.core.$strict>, z.ZodObject<{
257
+ version: z.ZodLiteral<"v1.0">;
258
+ error: z.ZodObject<{
259
+ code: z.ZodString;
260
+ message: z.ZodString;
261
+ functionCallId: z.ZodString;
262
+ }, z.core.$strict>;
263
+ }, z.core.$strict>]>]>;
264
+ declare const rendererCapabilitiesSchema: z.ZodObject<{
265
+ "v1.0": z.ZodObject<{
266
+ supportedCatalogIds: z.ZodArray<z.ZodString>;
267
+ inlineCatalogs: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>>;
268
+ }, z.core.$strict>;
269
+ }, z.core.$strict>;
270
+ declare const agentCapabilitiesSchema: z.ZodObject<{
271
+ "v1.0": z.ZodObject<{
272
+ supportedCatalogIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
273
+ acceptsInlineCatalogs: z.ZodOptional<z.ZodBoolean>;
274
+ }, z.core.$strict>;
275
+ }, z.core.$strict>;
276
+ declare const rendererDataModelSchema: z.ZodObject<{
277
+ version: z.ZodLiteral<"v1.0">;
278
+ surfaces: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
279
+ }, z.core.$strict>;
280
+ type JsonPrimitive = string | number | boolean | null;
281
+ type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
282
+ type JsonObject = {
283
+ [key: string]: JsonValue;
284
+ };
285
+ interface A2UIFunctionCall {
286
+ call: string;
287
+ catalogId?: string;
288
+ args?: JsonObject;
289
+ }
290
+ type A2UIFunctionResponse = {
291
+ functionCallId: string;
292
+ value: JsonValue;
293
+ } | {
294
+ functionCallId: string;
295
+ error: {
296
+ code: string;
297
+ message: string;
298
+ };
299
+ };
300
+ interface A2UIMessageMetadata {
301
+ extensions?: Record<string, JsonValue>;
302
+ }
303
+ interface CreateSurfaceMessage {
304
+ version: "v1.0";
305
+ createSurface: {
306
+ surfaceId: string;
307
+ catalogId?: string;
308
+ sendDataModel?: boolean;
309
+ components?: string[];
310
+ dataModel?: JsonObject;
311
+ metadata?: A2UIMessageMetadata;
312
+ };
313
+ }
314
+ interface UpdateComponentsMessage {
315
+ version: "v1.0";
316
+ updateComponents: {
317
+ surfaceId: string;
318
+ components: string[];
319
+ };
320
+ }
321
+ interface UpdateDataModelMessage {
322
+ version: "v1.0";
323
+ updateDataModel: {
324
+ surfaceId: string;
325
+ path?: string;
326
+ value: JsonValue;
327
+ };
328
+ }
329
+ interface DeleteSurfaceMessage {
330
+ version: "v1.0";
331
+ deleteSurface: {
332
+ surfaceId: string;
333
+ };
334
+ }
335
+ interface CallRendererFunctionMessage {
336
+ version: "v1.0";
337
+ callRendererFunction: {
338
+ functionCallId: string;
339
+ callFunction: A2UIFunctionCall & {
340
+ catalogId: string;
341
+ };
342
+ };
343
+ }
344
+ interface AgentFunctionResponseMessage {
345
+ version: "v1.0";
346
+ agentFunctionResponse: A2UIFunctionResponse;
347
+ }
348
+ type ActionMessage = {
349
+ version: "v1.0";
350
+ action: {
351
+ name: string;
352
+ userMessage?: string;
353
+ surfaceId: string;
354
+ sourceComponentId: string;
355
+ timestamp: string;
356
+ context: JsonObject;
357
+ metadata?: A2UIMessageMetadata;
358
+ };
359
+ };
360
+ type AgentToRendererMessage = CreateSurfaceMessage | UpdateComponentsMessage | UpdateDataModelMessage | DeleteSurfaceMessage | CallRendererFunctionMessage | AgentFunctionResponseMessage;
361
+ interface CallAgentFunctionMessage {
362
+ version: "v1.0";
363
+ callAgentFunction: {
364
+ surfaceId: string;
365
+ functionCallId: string;
366
+ callFunction: A2UIFunctionCall;
367
+ };
368
+ }
369
+ interface RendererFunctionResponseMessage {
370
+ version: "v1.0";
371
+ rendererFunctionResponse: A2UIFunctionResponse;
372
+ }
373
+ type ValidationErrorCode = "VALIDATION_FAILED" | "UNALLOWED_PARENT" | "UNALLOWED_CHILD";
374
+ interface ValidationFailedErrorMessage {
375
+ version: "v1.0";
376
+ error: {
377
+ code: ValidationErrorCode;
378
+ surfaceId: string;
379
+ path: string;
380
+ message: string;
381
+ };
382
+ }
383
+ type GenericErrorMessage = {
384
+ version: "v1.0";
385
+ error: {
386
+ code: string;
387
+ message: string;
388
+ surfaceId: string;
389
+ };
390
+ } | {
391
+ version: "v1.0";
392
+ error: {
393
+ code: string;
394
+ message: string;
395
+ functionCallId: string;
396
+ };
397
+ };
398
+ type RendererToAgentMessage = ActionMessage | CallAgentFunctionMessage | RendererFunctionResponseMessage | ValidationFailedErrorMessage | GenericErrorMessage;
399
+ interface RendererCapabilities {
400
+ "v1.0": {
401
+ supportedCatalogIds: string[];
402
+ inlineCatalogs?: JsonObject[];
403
+ };
404
+ }
405
+ interface AgentCapabilities {
406
+ "v1.0": {
407
+ supportedCatalogIds?: string[];
408
+ acceptsInlineCatalogs?: boolean;
409
+ };
410
+ }
411
+ interface RendererDataModel {
412
+ version: "v1.0";
413
+ surfaces: Record<string, JsonObject>;
414
+ }
415
+ interface SurfaceSnapshot {
416
+ surfaceId: string;
417
+ catalogId?: string;
418
+ metadata?: A2UIMessageMetadata;
419
+ sendDataModel: boolean;
420
+ source: string;
421
+ dataModel: JsonObject;
422
+ parseResult: ParseResult | null;
423
+ errors: OpenUIError[];
424
+ revision: number;
425
+ }
426
+ type A2UIRendererFunction = (args: JsonObject) => JsonValue | Promise<JsonValue>;
427
+ type A2UIFunctionAllowedCaller = "rendererOnly" | "agentOnly" | "rendererOrAgent";
428
+ interface A2UIRendererFunctionRegistration {
429
+ handler: A2UIRendererFunction;
430
+ /** Catalog that defines this function. Required when the agent may call it. */
431
+ catalogId?: string;
432
+ /** Matches A2UI catalog allowedCallers semantics. Defaults to rendererOnly. */
433
+ allowedCallers?: A2UIFunctionAllowedCaller;
434
+ }
435
+ interface A2UIClientOptions {
436
+ schema: LibraryJSONSchema;
437
+ rootName?: string;
438
+ functions?: Record<string, A2UIRendererFunction | A2UIRendererFunctionRegistration>;
439
+ rendererCapabilities?: RendererCapabilities;
440
+ onMessage?: (message: RendererToAgentMessage, metadata: RendererMetadata) => void;
441
+ now?: () => Date;
442
+ createId?: () => string;
443
+ }
444
+ interface ProtocolValidationIssue {
445
+ path: string;
446
+ message: string;
447
+ }
448
+ interface ProcessResult {
449
+ ok: boolean;
450
+ outbound: RendererToAgentMessage[];
451
+ /** Present when malformed input cannot be represented as an A2UI error envelope. */
452
+ issues?: ProtocolValidationIssue[];
453
+ }
454
+ interface DispatchActionInput {
455
+ surfaceId: string;
456
+ sourceComponentId: string;
457
+ name: string;
458
+ userMessage?: string;
459
+ context?: JsonObject;
460
+ metadata?: A2UIMessageMetadata;
461
+ }
462
+ interface CallAgentFunctionInput {
463
+ surfaceId: string;
464
+ call: string;
465
+ catalogId?: string;
466
+ args?: JsonObject;
467
+ }
468
+ interface OpenUIActionOptions {
469
+ name?: string;
470
+ /** A2UI component ID to report for the action. Defaults to root. */
471
+ sourceComponentId?: string;
472
+ userMessage?: string;
473
+ context?: JsonObject;
474
+ metadata?: A2UIMessageMetadata;
475
+ }
476
+ type MapOpenUIAction = (event: ActionEvent, surface: SurfaceSnapshot) => OpenUIActionOptions;
477
+ interface RendererMetadata {
478
+ a2uiRendererCapabilities?: RendererCapabilities;
479
+ a2uiRendererDataModel?: RendererDataModel;
480
+ }
481
+ type SurfaceListener = () => void;
482
+ type MessageListener = (message: RendererToAgentMessage, metadata: RendererMetadata) => void;
483
+ declare class A2UIFunctionError extends Error {
484
+ readonly code: string;
485
+ constructor(code: string, message: string);
486
+ }
487
+ declare class A2UIClient {
488
+ #private;
489
+ constructor(options: A2UIClientOptions);
490
+ subscribe(listener: SurfaceListener): () => void;
491
+ subscribeMessages(listener: MessageListener): () => void;
492
+ getSurface(surfaceId: string): SurfaceSnapshot | undefined;
493
+ getSurfaces(): SurfaceSnapshot[];
494
+ getRendererDataModel(): RendererDataModel | undefined;
495
+ getRendererMetadata(): RendererMetadata;
496
+ process(input: unknown): Promise<ProcessResult>;
497
+ updateSurfaceFromOpenUIState(surfaceId: string, state: Record<string, unknown>): boolean;
498
+ dispatchOpenUIAction(surfaceId: string, event: ActionEvent, options?: OpenUIActionOptions): void;
499
+ dispatchAction(input: DispatchActionInput): void;
500
+ callAgentFunction(input: CallAgentFunctionInput): Promise<JsonValue>;
501
+ dispose(): void;
502
+ }
503
+ declare function createA2UIClient(options: A2UIClientOptions): A2UIClient;
504
+ export { rendererDataModelSchema as $, RendererDataModel as A, actionMessageSchema as B, JsonPrimitive as C, ProcessResult as D, OpenUIActionOptions as E, UpdateComponentsMessage as F, callRendererFunctionMessageSchema as G, agentFunctionResponseMessageSchema as H, UpdateDataModelMessage as I, genericErrorMessageSchema as J, createSurfaceMessageSchema as K, ValidationFailedErrorMessage as L, RendererMetadata as M, RendererToAgentMessage as N, ProtocolValidationIssue as O, SurfaceSnapshot as P, rendererCapabilitiesSchema as Q, a2uiFunctionCallSchema as R, JsonObject as S, MapOpenUIAction as T, agentToRendererMessageSchema as U, agentCapabilitiesSchema as V, callAgentFunctionMessageSchema as W, jsonValueSchema as X, jsonObjectSchema as Y, messageMetadataSchema as Z, CallRendererFunctionMessage as _, A2UIFunctionAllowedCaller as a, DispatchActionInput as b, A2UIMessageMetadata as c, ActionMessage as d, rendererFunctionResponseMessageSchema as et, AgentCapabilities as f, CallAgentFunctionMessage as g, CallAgentFunctionInput as h, A2UIClientOptions as i, validationFailedErrorMessageSchema as it, RendererFunctionResponseMessage as j, RendererCapabilities as k, A2UIRendererFunction as l, AgentToRendererMessage as m, A2UIFunctionError as n, updateComponentsMessageSchema as nt, A2UIFunctionCall as o, AgentFunctionResponseMessage as p, deleteSurfaceMessageSchema as q, createA2UIClient as r, updateDataModelMessageSchema as rt, A2UIFunctionResponse as s, A2UIClient as t, rendererToAgentMessageSchema as tt, A2UIRendererFunctionRegistration as u, CreateSurfaceMessage as v, JsonValue as w, GenericErrorMessage as x, DeleteSurfaceMessage as y, a2uiFunctionResponseSchema as z };