@jini-ai/agentic 0.1.0 → 0.1.2

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.
Files changed (53) hide show
  1. package/dist/a2ui/agent-to-renderer.d.ts +579 -0
  2. package/dist/a2ui/agent-to-renderer.d.ts.map +1 -0
  3. package/dist/a2ui/agent-to-renderer.js +169 -0
  4. package/dist/a2ui/agent-to-renderer.js.map +1 -0
  5. package/dist/a2ui/catalog.d.ts +73 -0
  6. package/dist/a2ui/catalog.d.ts.map +1 -0
  7. package/dist/a2ui/catalog.js +304 -0
  8. package/dist/a2ui/catalog.js.map +1 -0
  9. package/dist/a2ui/common-types.d.ts +401 -0
  10. package/dist/a2ui/common-types.d.ts.map +1 -0
  11. package/dist/a2ui/common-types.js +130 -0
  12. package/dist/a2ui/common-types.js.map +1 -0
  13. package/dist/a2ui/index.d.ts +16 -0
  14. package/dist/a2ui/index.d.ts.map +1 -0
  15. package/dist/a2ui/index.js +16 -0
  16. package/dist/a2ui/index.js.map +1 -0
  17. package/dist/a2ui/interpreter.d.ts +48 -0
  18. package/dist/a2ui/interpreter.d.ts.map +1 -0
  19. package/dist/a2ui/interpreter.js +287 -0
  20. package/dist/a2ui/interpreter.js.map +1 -0
  21. package/dist/a2ui/json-pointer.d.ts +48 -0
  22. package/dist/a2ui/json-pointer.d.ts.map +1 -0
  23. package/dist/a2ui/json-pointer.js +149 -0
  24. package/dist/a2ui/json-pointer.js.map +1 -0
  25. package/dist/a2ui/renderer-to-agent.d.ts +318 -0
  26. package/dist/a2ui/renderer-to-agent.d.ts.map +1 -0
  27. package/dist/a2ui/renderer-to-agent.js +98 -0
  28. package/dist/a2ui/renderer-to-agent.js.map +1 -0
  29. package/dist/a2ui/resolve.d.ts +28 -0
  30. package/dist/a2ui/resolve.d.ts.map +1 -0
  31. package/dist/a2ui/resolve.js +118 -0
  32. package/dist/a2ui/resolve.js.map +1 -0
  33. package/dist/a2ui/tree.d.ts +41 -0
  34. package/dist/a2ui/tree.d.ts.map +1 -0
  35. package/dist/a2ui/tree.js +35 -0
  36. package/dist/a2ui/tree.js.map +1 -0
  37. package/dist/dom/model-context.d.ts +15 -0
  38. package/dist/dom/model-context.d.ts.map +1 -1
  39. package/dist/dom/model-context.js +8 -0
  40. package/dist/dom/model-context.js.map +1 -1
  41. package/dist/index.d.ts +2 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +2 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/mcp-ui-apps.d.ts +81 -10
  46. package/dist/mcp-ui-apps.d.ts.map +1 -1
  47. package/dist/mcp-ui-apps.js +84 -11
  48. package/dist/mcp-ui-apps.js.map +1 -1
  49. package/dist/webmcp.d.ts +126 -5
  50. package/dist/webmcp.d.ts.map +1 -1
  51. package/dist/webmcp.js +110 -4
  52. package/dist/webmcp.js.map +1 -1
  53. package/package.json +16 -5
@@ -0,0 +1,579 @@
1
+ /**
2
+ * @module agent-to-renderer
3
+ *
4
+ * A2UI v1.0 agent→renderer envelope — mirrors `specification/v1_0/json/agent_to_renderer.json`
5
+ * (fetched from https://github.com/a2ui-project/a2ui, `main` branch, this session). Every
6
+ * required/optional field and every `additionalProperties: false` closure below was copied
7
+ * directly from that JSON Schema, not guessed. See `common-types.ts`'s module doc for the overall
8
+ * scope note (wire shape only; catalog membership is a separate runtime concern).
9
+ *
10
+ * The six message kinds, each keyed by version + exactly one message-type key
11
+ * (`createSurface` | `updateComponents` | `updateDataModel` | `deleteSurface` | `callFunction` +
12
+ * `functionCallId` | `actionResponse` + `actionId`):
13
+ * `CreateSurfaceMessage`, `UpdateComponentsMessage`, `UpdateDataModelMessage`,
14
+ * `DeleteSurfaceMessage`, `CallFunctionMessage`, `ActionResponseMessage`.
15
+ *
16
+ * `parseAgentToRendererMessage` is a hand-written dispatcher, not a plain `z.union(...)`: zod's
17
+ * union error for a 6-branch, all-`.strict()` union is an unreadable dump of all 6 branches'
18
+ * failures at once. Real renderers need to tell an agent *specifically* "you sent no version",
19
+ * "you sent two message-type keys", or "`updateComponents` is missing `surfaceId`" — so this
20
+ * dispatcher inspects the envelope's own shape first (which key is present) and only then
21
+ * validates against the one matching schema, matching what `renderer_to_agent.json`'s own error
22
+ * schema anticipates (`VALIDATION_FAILED` with a JSON-Pointer `path` into the offending field).
23
+ */
24
+ import { z } from 'zod';
25
+ /**
26
+ * A component's wire shape is only closed by its *catalog's* own per-type schema (e.g. `Text`
27
+ * requires `text`, forbids unknown extra keys via that type's own `unevaluatedProperties: false`)
28
+ * — a shape this module cannot know statically, since a renderer may be configured with any
29
+ * catalog. This schema validates only what every component, in every catalog, always carries:
30
+ * an `id` and a `component` type-name string. `catalog.ts`/`interpreter.ts` layer the closed,
31
+ * per-type check on top at runtime (component-type whitelisting against the active catalog).
32
+ */
33
+ export declare const WireComponentSchema: z.ZodObject<{
34
+ id: z.ZodString;
35
+ component: z.ZodString;
36
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
37
+ id: z.ZodString;
38
+ component: z.ZodString;
39
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
40
+ id: z.ZodString;
41
+ component: z.ZodString;
42
+ }, z.ZodTypeAny, "passthrough">>;
43
+ export type WireComponent = z.infer<typeof WireComponentSchema> & Record<string, unknown>;
44
+ /** `agent_to_renderer.json#/$defs/ComponentsList` — "A list containing UI components for the surface." `minItems: 1`. */
45
+ export declare const ComponentsListSchema: z.ZodArray<z.ZodObject<{
46
+ id: z.ZodString;
47
+ component: z.ZodString;
48
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
49
+ id: z.ZodString;
50
+ component: z.ZodString;
51
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
52
+ id: z.ZodString;
53
+ component: z.ZodString;
54
+ }, z.ZodTypeAny, "passthrough">>, "many">;
55
+ export type ComponentsList = z.infer<typeof ComponentsListSchema>;
56
+ export declare const CreateSurfaceMessageSchema: z.ZodObject<{
57
+ version: z.ZodLiteral<"v1.0">;
58
+ createSurface: z.ZodObject<{
59
+ surfaceId: z.ZodString;
60
+ catalogId: z.ZodString;
61
+ surfaceProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
62
+ sendDataModel: z.ZodOptional<z.ZodBoolean>;
63
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
64
+ id: z.ZodString;
65
+ component: z.ZodString;
66
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
67
+ id: z.ZodString;
68
+ component: z.ZodString;
69
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
70
+ id: z.ZodString;
71
+ component: z.ZodString;
72
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
73
+ dataModel: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
74
+ }, "strict", z.ZodTypeAny, {
75
+ surfaceId: string;
76
+ catalogId: string;
77
+ surfaceProperties?: Record<string, unknown> | undefined;
78
+ sendDataModel?: boolean | undefined;
79
+ components?: z.objectOutputType<{
80
+ id: z.ZodString;
81
+ component: z.ZodString;
82
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
83
+ dataModel?: Record<string, unknown> | undefined;
84
+ }, {
85
+ surfaceId: string;
86
+ catalogId: string;
87
+ surfaceProperties?: Record<string, unknown> | undefined;
88
+ sendDataModel?: boolean | undefined;
89
+ components?: z.objectInputType<{
90
+ id: z.ZodString;
91
+ component: z.ZodString;
92
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
93
+ dataModel?: Record<string, unknown> | undefined;
94
+ }>;
95
+ }, "strict", z.ZodTypeAny, {
96
+ version: "v1.0";
97
+ createSurface: {
98
+ surfaceId: string;
99
+ catalogId: string;
100
+ surfaceProperties?: Record<string, unknown> | undefined;
101
+ sendDataModel?: boolean | undefined;
102
+ components?: z.objectOutputType<{
103
+ id: z.ZodString;
104
+ component: z.ZodString;
105
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
106
+ dataModel?: Record<string, unknown> | undefined;
107
+ };
108
+ }, {
109
+ version: "v1.0";
110
+ createSurface: {
111
+ surfaceId: string;
112
+ catalogId: string;
113
+ surfaceProperties?: Record<string, unknown> | undefined;
114
+ sendDataModel?: boolean | undefined;
115
+ components?: z.objectInputType<{
116
+ id: z.ZodString;
117
+ component: z.ZodString;
118
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
119
+ dataModel?: Record<string, unknown> | undefined;
120
+ };
121
+ }>;
122
+ export type CreateSurfaceMessage = z.infer<typeof CreateSurfaceMessageSchema>;
123
+ export declare const UpdateComponentsMessageSchema: z.ZodObject<{
124
+ version: z.ZodLiteral<"v1.0">;
125
+ updateComponents: z.ZodObject<{
126
+ surfaceId: z.ZodString;
127
+ components: z.ZodArray<z.ZodObject<{
128
+ id: z.ZodString;
129
+ component: z.ZodString;
130
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
131
+ id: z.ZodString;
132
+ component: z.ZodString;
133
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
134
+ id: z.ZodString;
135
+ component: z.ZodString;
136
+ }, z.ZodTypeAny, "passthrough">>, "many">;
137
+ }, "strict", z.ZodTypeAny, {
138
+ surfaceId: string;
139
+ components: z.objectOutputType<{
140
+ id: z.ZodString;
141
+ component: z.ZodString;
142
+ }, z.ZodTypeAny, "passthrough">[];
143
+ }, {
144
+ surfaceId: string;
145
+ components: z.objectInputType<{
146
+ id: z.ZodString;
147
+ component: z.ZodString;
148
+ }, z.ZodTypeAny, "passthrough">[];
149
+ }>;
150
+ }, "strict", z.ZodTypeAny, {
151
+ version: "v1.0";
152
+ updateComponents: {
153
+ surfaceId: string;
154
+ components: z.objectOutputType<{
155
+ id: z.ZodString;
156
+ component: z.ZodString;
157
+ }, z.ZodTypeAny, "passthrough">[];
158
+ };
159
+ }, {
160
+ version: "v1.0";
161
+ updateComponents: {
162
+ surfaceId: string;
163
+ components: z.objectInputType<{
164
+ id: z.ZodString;
165
+ component: z.ZodString;
166
+ }, z.ZodTypeAny, "passthrough">[];
167
+ };
168
+ }>;
169
+ export type UpdateComponentsMessage = z.infer<typeof UpdateComponentsMessageSchema>;
170
+ export declare const UpdateDataModelMessageSchema: z.ZodObject<{
171
+ version: z.ZodLiteral<"v1.0">;
172
+ updateDataModel: z.ZodObject<{
173
+ surfaceId: z.ZodString;
174
+ path: z.ZodOptional<z.ZodString>;
175
+ value: z.ZodUnknown;
176
+ }, "strict", z.ZodTypeAny, {
177
+ surfaceId: string;
178
+ value?: unknown;
179
+ path?: string | undefined;
180
+ }, {
181
+ surfaceId: string;
182
+ value?: unknown;
183
+ path?: string | undefined;
184
+ }>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ version: "v1.0";
187
+ updateDataModel: {
188
+ surfaceId: string;
189
+ value?: unknown;
190
+ path?: string | undefined;
191
+ };
192
+ }, {
193
+ version: "v1.0";
194
+ updateDataModel: {
195
+ surfaceId: string;
196
+ value?: unknown;
197
+ path?: string | undefined;
198
+ };
199
+ }>;
200
+ export type UpdateDataModelMessage = z.infer<typeof UpdateDataModelMessageSchema>;
201
+ export declare const DeleteSurfaceMessageSchema: z.ZodObject<{
202
+ version: z.ZodLiteral<"v1.0">;
203
+ deleteSurface: z.ZodObject<{
204
+ surfaceId: z.ZodString;
205
+ }, "strict", z.ZodTypeAny, {
206
+ surfaceId: string;
207
+ }, {
208
+ surfaceId: string;
209
+ }>;
210
+ }, "strict", z.ZodTypeAny, {
211
+ version: "v1.0";
212
+ deleteSurface: {
213
+ surfaceId: string;
214
+ };
215
+ }, {
216
+ version: "v1.0";
217
+ deleteSurface: {
218
+ surfaceId: string;
219
+ };
220
+ }>;
221
+ export type DeleteSurfaceMessage = z.infer<typeof DeleteSurfaceMessageSchema>;
222
+ export declare const CallFunctionMessageSchema: z.ZodObject<{
223
+ version: z.ZodLiteral<"v1.0">;
224
+ functionCallId: z.ZodString;
225
+ wantResponse: z.ZodOptional<z.ZodBoolean>;
226
+ callFunction: z.ZodType<import("./common-types.js").FunctionCall, z.ZodTypeDef, import("./common-types.js").FunctionCall>;
227
+ }, "strict", z.ZodTypeAny, {
228
+ version: "v1.0";
229
+ functionCallId: string;
230
+ callFunction: import("./common-types.js").FunctionCall;
231
+ wantResponse?: boolean | undefined;
232
+ }, {
233
+ version: "v1.0";
234
+ functionCallId: string;
235
+ callFunction: import("./common-types.js").FunctionCall;
236
+ wantResponse?: boolean | undefined;
237
+ }>;
238
+ export type CallFunctionMessage = z.infer<typeof CallFunctionMessageSchema>;
239
+ export declare const ActionResponseMessageSchema: z.ZodObject<{
240
+ version: z.ZodLiteral<"v1.0">;
241
+ actionId: z.ZodString;
242
+ actionResponse: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
243
+ value: z.ZodUnknown;
244
+ }, "strict", z.ZodTypeAny, {
245
+ value?: unknown;
246
+ }, {
247
+ value?: unknown;
248
+ }>, z.ZodObject<{
249
+ error: z.ZodObject<{
250
+ code: z.ZodString;
251
+ message: z.ZodString;
252
+ }, "strict", z.ZodTypeAny, {
253
+ code: string;
254
+ message: string;
255
+ }, {
256
+ code: string;
257
+ message: string;
258
+ }>;
259
+ }, "strict", z.ZodTypeAny, {
260
+ error: {
261
+ code: string;
262
+ message: string;
263
+ };
264
+ }, {
265
+ error: {
266
+ code: string;
267
+ message: string;
268
+ };
269
+ }>]>, {
270
+ value?: unknown;
271
+ } | {
272
+ error: {
273
+ code: string;
274
+ message: string;
275
+ };
276
+ }, {
277
+ value?: unknown;
278
+ } | {
279
+ error: {
280
+ code: string;
281
+ message: string;
282
+ };
283
+ }>;
284
+ }, "strict", z.ZodTypeAny, {
285
+ version: "v1.0";
286
+ actionId: string;
287
+ actionResponse: {
288
+ value?: unknown;
289
+ } | {
290
+ error: {
291
+ code: string;
292
+ message: string;
293
+ };
294
+ };
295
+ }, {
296
+ version: "v1.0";
297
+ actionId: string;
298
+ actionResponse: {
299
+ value?: unknown;
300
+ } | {
301
+ error: {
302
+ code: string;
303
+ message: string;
304
+ };
305
+ };
306
+ }>;
307
+ export type ActionResponseMessage = z.infer<typeof ActionResponseMessageSchema>;
308
+ export type AgentToRendererMessage = CreateSurfaceMessage | UpdateComponentsMessage | UpdateDataModelMessage | DeleteSurfaceMessage | CallFunctionMessage | ActionResponseMessage;
309
+ declare const MESSAGE_KEY_SCHEMAS: {
310
+ readonly createSurface: z.ZodObject<{
311
+ version: z.ZodLiteral<"v1.0">;
312
+ createSurface: z.ZodObject<{
313
+ surfaceId: z.ZodString;
314
+ catalogId: z.ZodString;
315
+ surfaceProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
316
+ sendDataModel: z.ZodOptional<z.ZodBoolean>;
317
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
318
+ id: z.ZodString;
319
+ component: z.ZodString;
320
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
321
+ id: z.ZodString;
322
+ component: z.ZodString;
323
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
324
+ id: z.ZodString;
325
+ component: z.ZodString;
326
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
327
+ dataModel: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
328
+ }, "strict", z.ZodTypeAny, {
329
+ surfaceId: string;
330
+ catalogId: string;
331
+ surfaceProperties?: Record<string, unknown> | undefined;
332
+ sendDataModel?: boolean | undefined;
333
+ components?: z.objectOutputType<{
334
+ id: z.ZodString;
335
+ component: z.ZodString;
336
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
337
+ dataModel?: Record<string, unknown> | undefined;
338
+ }, {
339
+ surfaceId: string;
340
+ catalogId: string;
341
+ surfaceProperties?: Record<string, unknown> | undefined;
342
+ sendDataModel?: boolean | undefined;
343
+ components?: z.objectInputType<{
344
+ id: z.ZodString;
345
+ component: z.ZodString;
346
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
347
+ dataModel?: Record<string, unknown> | undefined;
348
+ }>;
349
+ }, "strict", z.ZodTypeAny, {
350
+ version: "v1.0";
351
+ createSurface: {
352
+ surfaceId: string;
353
+ catalogId: string;
354
+ surfaceProperties?: Record<string, unknown> | undefined;
355
+ sendDataModel?: boolean | undefined;
356
+ components?: z.objectOutputType<{
357
+ id: z.ZodString;
358
+ component: z.ZodString;
359
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
360
+ dataModel?: Record<string, unknown> | undefined;
361
+ };
362
+ }, {
363
+ version: "v1.0";
364
+ createSurface: {
365
+ surfaceId: string;
366
+ catalogId: string;
367
+ surfaceProperties?: Record<string, unknown> | undefined;
368
+ sendDataModel?: boolean | undefined;
369
+ components?: z.objectInputType<{
370
+ id: z.ZodString;
371
+ component: z.ZodString;
372
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
373
+ dataModel?: Record<string, unknown> | undefined;
374
+ };
375
+ }>;
376
+ readonly updateComponents: z.ZodObject<{
377
+ version: z.ZodLiteral<"v1.0">;
378
+ updateComponents: z.ZodObject<{
379
+ surfaceId: z.ZodString;
380
+ components: z.ZodArray<z.ZodObject<{
381
+ id: z.ZodString;
382
+ component: z.ZodString;
383
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
384
+ id: z.ZodString;
385
+ component: z.ZodString;
386
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
387
+ id: z.ZodString;
388
+ component: z.ZodString;
389
+ }, z.ZodTypeAny, "passthrough">>, "many">;
390
+ }, "strict", z.ZodTypeAny, {
391
+ surfaceId: string;
392
+ components: z.objectOutputType<{
393
+ id: z.ZodString;
394
+ component: z.ZodString;
395
+ }, z.ZodTypeAny, "passthrough">[];
396
+ }, {
397
+ surfaceId: string;
398
+ components: z.objectInputType<{
399
+ id: z.ZodString;
400
+ component: z.ZodString;
401
+ }, z.ZodTypeAny, "passthrough">[];
402
+ }>;
403
+ }, "strict", z.ZodTypeAny, {
404
+ version: "v1.0";
405
+ updateComponents: {
406
+ surfaceId: string;
407
+ components: z.objectOutputType<{
408
+ id: z.ZodString;
409
+ component: z.ZodString;
410
+ }, z.ZodTypeAny, "passthrough">[];
411
+ };
412
+ }, {
413
+ version: "v1.0";
414
+ updateComponents: {
415
+ surfaceId: string;
416
+ components: z.objectInputType<{
417
+ id: z.ZodString;
418
+ component: z.ZodString;
419
+ }, z.ZodTypeAny, "passthrough">[];
420
+ };
421
+ }>;
422
+ readonly updateDataModel: z.ZodObject<{
423
+ version: z.ZodLiteral<"v1.0">;
424
+ updateDataModel: z.ZodObject<{
425
+ surfaceId: z.ZodString;
426
+ path: z.ZodOptional<z.ZodString>;
427
+ value: z.ZodUnknown;
428
+ }, "strict", z.ZodTypeAny, {
429
+ surfaceId: string;
430
+ value?: unknown;
431
+ path?: string | undefined;
432
+ }, {
433
+ surfaceId: string;
434
+ value?: unknown;
435
+ path?: string | undefined;
436
+ }>;
437
+ }, "strict", z.ZodTypeAny, {
438
+ version: "v1.0";
439
+ updateDataModel: {
440
+ surfaceId: string;
441
+ value?: unknown;
442
+ path?: string | undefined;
443
+ };
444
+ }, {
445
+ version: "v1.0";
446
+ updateDataModel: {
447
+ surfaceId: string;
448
+ value?: unknown;
449
+ path?: string | undefined;
450
+ };
451
+ }>;
452
+ readonly deleteSurface: z.ZodObject<{
453
+ version: z.ZodLiteral<"v1.0">;
454
+ deleteSurface: z.ZodObject<{
455
+ surfaceId: z.ZodString;
456
+ }, "strict", z.ZodTypeAny, {
457
+ surfaceId: string;
458
+ }, {
459
+ surfaceId: string;
460
+ }>;
461
+ }, "strict", z.ZodTypeAny, {
462
+ version: "v1.0";
463
+ deleteSurface: {
464
+ surfaceId: string;
465
+ };
466
+ }, {
467
+ version: "v1.0";
468
+ deleteSurface: {
469
+ surfaceId: string;
470
+ };
471
+ }>;
472
+ readonly callFunction: z.ZodObject<{
473
+ version: z.ZodLiteral<"v1.0">;
474
+ functionCallId: z.ZodString;
475
+ wantResponse: z.ZodOptional<z.ZodBoolean>;
476
+ callFunction: z.ZodType<import("./common-types.js").FunctionCall, z.ZodTypeDef, import("./common-types.js").FunctionCall>;
477
+ }, "strict", z.ZodTypeAny, {
478
+ version: "v1.0";
479
+ functionCallId: string;
480
+ callFunction: import("./common-types.js").FunctionCall;
481
+ wantResponse?: boolean | undefined;
482
+ }, {
483
+ version: "v1.0";
484
+ functionCallId: string;
485
+ callFunction: import("./common-types.js").FunctionCall;
486
+ wantResponse?: boolean | undefined;
487
+ }>;
488
+ readonly actionResponse: z.ZodObject<{
489
+ version: z.ZodLiteral<"v1.0">;
490
+ actionId: z.ZodString;
491
+ actionResponse: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
492
+ value: z.ZodUnknown;
493
+ }, "strict", z.ZodTypeAny, {
494
+ value?: unknown;
495
+ }, {
496
+ value?: unknown;
497
+ }>, z.ZodObject<{
498
+ error: z.ZodObject<{
499
+ code: z.ZodString;
500
+ message: z.ZodString;
501
+ }, "strict", z.ZodTypeAny, {
502
+ code: string;
503
+ message: string;
504
+ }, {
505
+ code: string;
506
+ message: string;
507
+ }>;
508
+ }, "strict", z.ZodTypeAny, {
509
+ error: {
510
+ code: string;
511
+ message: string;
512
+ };
513
+ }, {
514
+ error: {
515
+ code: string;
516
+ message: string;
517
+ };
518
+ }>]>, {
519
+ value?: unknown;
520
+ } | {
521
+ error: {
522
+ code: string;
523
+ message: string;
524
+ };
525
+ }, {
526
+ value?: unknown;
527
+ } | {
528
+ error: {
529
+ code: string;
530
+ message: string;
531
+ };
532
+ }>;
533
+ }, "strict", z.ZodTypeAny, {
534
+ version: "v1.0";
535
+ actionId: string;
536
+ actionResponse: {
537
+ value?: unknown;
538
+ } | {
539
+ error: {
540
+ code: string;
541
+ message: string;
542
+ };
543
+ };
544
+ }, {
545
+ version: "v1.0";
546
+ actionId: string;
547
+ actionResponse: {
548
+ value?: unknown;
549
+ } | {
550
+ error: {
551
+ code: string;
552
+ message: string;
553
+ };
554
+ };
555
+ }>;
556
+ };
557
+ type MessageKey = keyof typeof MESSAGE_KEY_SCHEMAS;
558
+ /** Exported so `interpreter.ts` can look up "which of the *known* message-type keys is present" the same way this module's own dispatcher does, instead of guessing from raw object-key order (which could pick up an unrelated extra top-level key first). */
559
+ export declare const AGENT_TO_RENDERER_MESSAGE_KEYS: MessageKey[];
560
+ export interface ParseFailure {
561
+ readonly ok: false;
562
+ readonly code: 'MISSING_VERSION' | 'UNSUPPORTED_VERSION' | 'NO_MESSAGE_KEY' | 'AMBIGUOUS_MESSAGE' | 'VALIDATION_FAILED';
563
+ readonly message: string;
564
+ readonly path?: string;
565
+ }
566
+ export interface ParseSuccess {
567
+ readonly ok: true;
568
+ readonly message: AgentToRendererMessage;
569
+ }
570
+ /**
571
+ * Validates a raw (untrusted, possibly-malformed) value as one A2UI agent→renderer envelope.
572
+ * Never throws — every failure mode (missing `version`, an unrecognized/absent message-type key,
573
+ * two message-type keys at once, or a structurally invalid message body) returns a tagged
574
+ * `ParseFailure` instead, mirroring how a real renderer must degrade on the wire: reject the one
575
+ * bad message with a specific reason, not crash the whole connection.
576
+ */
577
+ export declare function parseAgentToRendererMessage(raw: unknown): ParseSuccess | ParseFailure;
578
+ export {};
579
+ //# sourceMappingURL=agent-to-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-to-renderer.d.ts","sourceRoot":"","sources":["../../src/a2ui/agent-to-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;gCAKhB,CAAC;AACjB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1F,yHAAyH;AACzH,eAAO,MAAM,oBAAoB;;;;;;;;;yCAAsC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;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