@jini-ai/agentic 0.3.7 → 0.4.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.
Files changed (142) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/README.md +33 -6
  3. package/dist/core/a2ui/agent-to-renderer.d.ts +3 -1
  4. package/dist/core/a2ui/agent-to-renderer.js +1 -1
  5. package/dist/core/a2ui/catalog.d.ts +14 -5
  6. package/dist/core/a2ui/catalog.js +5 -5
  7. package/dist/core/a2ui/common-types.d.ts +11 -3
  8. package/dist/core/a2ui/common-types.js +5 -3
  9. package/dist/core/a2ui/index.d.ts +1 -1
  10. package/dist/core/a2ui/index.js +1 -1
  11. package/dist/core/a2ui/interpreter.d.ts +45 -10
  12. package/dist/core/a2ui/interpreter.js +38 -43
  13. package/dist/core/a2ui/json-pointer.d.ts +16 -4
  14. package/dist/core/a2ui/json-pointer.js +7 -7
  15. package/dist/core/a2ui/renderer-to-agent.d.ts +22 -8
  16. package/dist/core/a2ui/renderer-to-agent.js +5 -5
  17. package/dist/core/a2ui/resolve.d.ts +7 -2
  18. package/dist/core/a2ui/resolve.js +10 -9
  19. package/dist/core/a2ui/tree.d.ts +8 -2
  20. package/dist/core/a2ui/tree.js +2 -2
  21. package/dist/core/ag-ui.d.ts +17 -9
  22. package/dist/core/ag-ui.js +4 -4
  23. package/dist/core/annotated-actions-script.d.ts +13 -0
  24. package/dist/core/annotated-actions-script.js +137 -0
  25. package/dist/core/capability.d.ts +12 -3
  26. package/dist/core/capability.js +3 -3
  27. package/dist/core/dom/dom-page-driver.d.ts +8 -4
  28. package/dist/core/dom/dom-page-driver.js +19 -20
  29. package/dist/core/dom/index.d.ts +3 -3
  30. package/dist/core/dom/index.js +1 -1
  31. package/dist/core/dom/model-context.d.ts +18 -8
  32. package/dist/core/dom/model-context.js +12 -15
  33. package/dist/core/dom/native-model-context.d.ts +6 -0
  34. package/dist/core/dom/native-model-context.js +19 -0
  35. package/dist/core/element-handles.d.ts +6 -2
  36. package/dist/core/element-handles.js +3 -3
  37. package/dist/core/gen-ui/encoder.d.ts +21 -11
  38. package/dist/core/gen-ui/encoder.js +8 -7
  39. package/dist/core/gen-ui/events.d.ts +6 -5
  40. package/dist/core/gen-ui/events.js +6 -5
  41. package/dist/core/gen-ui/index.d.ts +1 -1
  42. package/dist/core/gen-ui/index.js +1 -1
  43. package/dist/core/guards.d.ts +17 -5
  44. package/dist/core/guards.js +6 -6
  45. package/dist/core/handle.d.ts +12 -5
  46. package/dist/core/handle.js +9 -8
  47. package/dist/core/index.d.ts +3 -1
  48. package/dist/core/index.js +3 -1
  49. package/dist/core/list-handles.d.ts +4 -1
  50. package/dist/core/list-handles.js +1 -1
  51. package/dist/core/mcp-ui-apps.d.ts +39 -9
  52. package/dist/core/mcp-ui-apps.js +10 -8
  53. package/dist/core/messages.d.ts +6 -0
  54. package/dist/core/messages.js +6 -0
  55. package/dist/core/page-capabilities.d.ts +0 -11
  56. package/dist/core/page-capabilities.js +13 -1
  57. package/dist/core/page-driver.d.ts +32 -11
  58. package/dist/core/page-executor.d.ts +8 -2
  59. package/dist/core/page-executor.js +31 -31
  60. package/dist/core/webmcp.d.ts +27 -8
  61. package/dist/core/webmcp.js +14 -14
  62. package/dist/index.d.ts +30 -0
  63. package/dist/index.js +30 -0
  64. package/dist/skills/install/archive.d.ts +8 -0
  65. package/dist/skills/install/archive.js +47 -0
  66. package/dist/skills/install/fetch-adapter.d.ts +6 -0
  67. package/dist/skills/install/fetch-adapter.js +6 -0
  68. package/dist/skills/install/github.d.ts +21 -0
  69. package/dist/skills/install/github.js +92 -0
  70. package/dist/skills/install/index.d.ts +11 -0
  71. package/dist/skills/install/index.js +11 -0
  72. package/dist/skills/install/install-service.d.ts +44 -0
  73. package/dist/skills/install/install-service.js +121 -0
  74. package/dist/skills/install/layout.d.ts +13 -0
  75. package/dist/skills/install/layout.js +22 -0
  76. package/dist/skills/install/live-registration.d.ts +61 -0
  77. package/dist/skills/install/live-registration.js +64 -0
  78. package/dist/skills/install/node-filesystem.d.ts +4 -0
  79. package/dist/skills/install/node-filesystem.js +41 -0
  80. package/dist/skills/install/ports.d.ts +101 -0
  81. package/dist/skills/install/ports.js +2 -0
  82. package/dist/skills/install/state.d.ts +13 -0
  83. package/dist/skills/install/state.js +23 -0
  84. package/dist/skills/install/validation.d.ts +45 -0
  85. package/dist/skills/install/validation.js +104 -0
  86. package/package.json +20 -5
  87. package/dist/a2ui/agent-to-renderer.d.ts +0 -613
  88. package/dist/a2ui/agent-to-renderer.js +0 -191
  89. package/dist/a2ui/catalog.d.ts +0 -73
  90. package/dist/a2ui/catalog.js +0 -304
  91. package/dist/a2ui/common-types.d.ts +0 -401
  92. package/dist/a2ui/common-types.js +0 -130
  93. package/dist/a2ui/index.d.ts +0 -16
  94. package/dist/a2ui/index.js +0 -16
  95. package/dist/a2ui/interpreter.d.ts +0 -71
  96. package/dist/a2ui/interpreter.js +0 -337
  97. package/dist/a2ui/json-pointer.d.ts +0 -48
  98. package/dist/a2ui/json-pointer.js +0 -174
  99. package/dist/a2ui/renderer-to-agent.d.ts +0 -342
  100. package/dist/a2ui/renderer-to-agent.js +0 -111
  101. package/dist/a2ui/resolve.d.ts +0 -28
  102. package/dist/a2ui/resolve.js +0 -144
  103. package/dist/a2ui/tree.d.ts +0 -66
  104. package/dist/a2ui/tree.js +0 -74
  105. package/dist/ag-ui.d.ts +0 -82
  106. package/dist/ag-ui.js +0 -85
  107. package/dist/agui/encoder.d.ts +0 -50
  108. package/dist/agui/encoder.js +0 -97
  109. package/dist/agui/events.d.ts +0 -59
  110. package/dist/agui/events.js +0 -15
  111. package/dist/capability.d.ts +0 -81
  112. package/dist/capability.js +0 -79
  113. package/dist/dom/dom-page-driver.d.ts +0 -36
  114. package/dist/dom/dom-page-driver.js +0 -601
  115. package/dist/dom/index.d.ts +0 -17
  116. package/dist/dom/index.js +0 -17
  117. package/dist/dom/model-context.d.ts +0 -69
  118. package/dist/dom/model-context.js +0 -44
  119. package/dist/element-handles.d.ts +0 -120
  120. package/dist/element-handles.js +0 -39
  121. package/dist/gen-ui/encoder.d.ts +0 -50
  122. package/dist/gen-ui/encoder.js +0 -97
  123. package/dist/gen-ui/events.d.ts +0 -59
  124. package/dist/gen-ui/events.js +0 -15
  125. package/dist/gen-ui/index.d.ts +0 -18
  126. package/dist/gen-ui/index.js +0 -17
  127. package/dist/guards.d.ts +0 -96
  128. package/dist/guards.js +0 -186
  129. package/dist/handle.d.ts +0 -41
  130. package/dist/handle.js +0 -41
  131. package/dist/mcp-ui-apps.d.ts +0 -223
  132. package/dist/mcp-ui-apps.js +0 -252
  133. package/dist/mcp-ui.d.ts +0 -133
  134. package/dist/mcp-ui.js +0 -134
  135. package/dist/page-capabilities.d.ts +0 -14
  136. package/dist/page-capabilities.js +0 -129
  137. package/dist/page-driver.d.ts +0 -120
  138. package/dist/page-driver.js +0 -2
  139. package/dist/page-executor.d.ts +0 -94
  140. package/dist/page-executor.js +0 -320
  141. package/dist/webmcp.d.ts +0 -202
  142. package/dist/webmcp.js +0 -173
@@ -1,401 +0,0 @@
1
- /**
2
- * @module common-types
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 common wire types — Zod schemas mirroring
5
- * `specification/v1_0/json/common_types.json` from https://github.com/a2ui-project/a2ui
6
- * (fetched and read directly from that repo's `main` branch this session; every field name below
7
- * was copied from the real JSON Schema `$defs`, not guessed). A2UI is a real, versioned,
8
- * actively-maintained spec (v1.0 is a release candidate at the time this was written) for agents
9
- * to stream a declarative, catalog-whitelisted component tree + JSON-Pointer-bound data model to a
10
- * renderer. See `../source-map.md` for provenance, what was verified against the primary source,
11
- * and — importantly — why this was hand-rolled from the JSON Schemas rather than built on the
12
- * official `@a2ui/web_core` npm package (materially version-drifted: see that doc).
13
- *
14
- * Scope note: this module is the **wire shape** only (what a message/type looks like on the
15
- * wire). Catalog membership (which component/function names are actually legal for a given
16
- * surface) is a separate, runtime concern — see `catalog.ts` and `interpreter.ts`. A component
17
- * object's own per-type property shape (e.g. what `Text` requires beyond `id`/`component`) is
18
- * also not encoded here — see `catalog.ts`'s `createLabCatalog()`, which carries all 18 of the real
19
- * "basic" catalog's components with their closed, per-type property schemas.
20
- */
21
- import { z } from 'zod';
22
- /** `common_types.json#/$defs/ComponentId` — "The unique identifier for a component, used for both definitions and references within the same surface." */
23
- export declare const ComponentIdSchema: z.ZodString;
24
- export type ComponentId = z.infer<typeof ComponentIdSchema>;
25
- /** `common_types.json#/$defs/CallId` — "The unique identifier for an agent initiated function call." */
26
- export declare const CallIdSchema: z.ZodString;
27
- export type CallId = z.infer<typeof CallIdSchema>;
28
- /** `common_types.json#/$defs/DataBinding` — a JSON Pointer (RFC 6901) reference into the data model. */
29
- export declare const DataBindingSchema: z.ZodObject<{
30
- path: z.ZodString;
31
- }, "strict", z.ZodTypeAny, {
32
- path: string;
33
- }, {
34
- path: string;
35
- }>;
36
- export type DataBinding = z.infer<typeof DataBindingSchema>;
37
- /**
38
- * `common_types.json#/$defs/FunctionCall` — "Invokes a named function on the renderer."
39
- * The real schema additionally constrains `call`/`args` via a `oneOf` against
40
- * `catalog.json#/$defs/anyFunction` (i.e. the active catalog's own function definitions) or
41
- * `IndexSystemFunction`. That constraint is catalog-dependent and cannot be expressed in a static
42
- * wire schema shared across every catalog — it is enforced at runtime instead, by
43
- * `catalog.ts`/`resolve.ts` (function-name whitelist + `callableFrom` execution-boundary check).
44
- * This schema only validates the wire shape: `call` is a non-empty string, `args` (if present) is
45
- * a plain object.
46
- */
47
- export declare const FunctionCallSchema: z.ZodType<FunctionCall>;
48
- export interface FunctionCall {
49
- call: string;
50
- args?: Record<string, ArgValue> | undefined;
51
- }
52
- export type ArgValue = string | number | boolean | unknown[] | DataBinding | FunctionCall | Record<string, unknown>;
53
- /** `common_types.json#/$defs/DynamicValue` — "A value that can be a literal, a path, or a function call returning any type." */
54
- export declare const DynamicValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodObject<{
55
- path: z.ZodString;
56
- }, "strict", z.ZodTypeAny, {
57
- path: string;
58
- }, {
59
- path: string;
60
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
61
- export type DynamicValue = z.infer<typeof DynamicValueSchema>;
62
- /** `common_types.json#/$defs/DynamicString` — literal, JSON-Pointer binding, or `FunctionCall` returning a string. */
63
- export declare const DynamicStringSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
64
- path: z.ZodString;
65
- }, "strict", z.ZodTypeAny, {
66
- path: string;
67
- }, {
68
- path: string;
69
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
70
- export type DynamicString = z.infer<typeof DynamicStringSchema>;
71
- /** `common_types.json#/$defs/DynamicNumber`. */
72
- export declare const DynamicNumberSchema: z.ZodUnion<[z.ZodNumber, z.ZodObject<{
73
- path: z.ZodString;
74
- }, "strict", z.ZodTypeAny, {
75
- path: string;
76
- }, {
77
- path: string;
78
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
79
- export type DynamicNumber = z.infer<typeof DynamicNumberSchema>;
80
- /** `common_types.json#/$defs/DynamicBoolean`. */
81
- export declare const DynamicBooleanSchema: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
82
- path: z.ZodString;
83
- }, "strict", z.ZodTypeAny, {
84
- path: string;
85
- }, {
86
- path: string;
87
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
88
- export type DynamicBoolean = z.infer<typeof DynamicBooleanSchema>;
89
- /** `common_types.json#/$defs/DynamicStringList`. */
90
- export declare const DynamicStringListSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodObject<{
91
- path: z.ZodString;
92
- }, "strict", z.ZodTypeAny, {
93
- path: string;
94
- }, {
95
- path: string;
96
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
97
- export type DynamicStringList = z.infer<typeof DynamicStringListSchema>;
98
- /**
99
- * `common_types.json#/$defs/IndexSystemFunction` — "Returns the 0-based index of the current item
100
- * when rendering a dynamic list from a template. This function MUST ONLY be available when
101
- * evaluating template items within a list context." `call` is the literal `@index`; catalogs
102
- * "MUST NOT define functions prefixed with `@`" per the catalog spec's system-namespace rule, so
103
- * this is the one function name every catalog implicitly carries.
104
- */
105
- export declare const IndexSystemFunctionSchema: z.ZodObject<{
106
- call: z.ZodLiteral<"@index">;
107
- args: z.ZodOptional<z.ZodObject<{
108
- offset: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodObject<{
109
- path: z.ZodString;
110
- }, "strict", z.ZodTypeAny, {
111
- path: string;
112
- }, {
113
- path: string;
114
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>;
115
- }, "strict", z.ZodTypeAny, {
116
- offset?: number | {
117
- path: string;
118
- } | FunctionCall | undefined;
119
- }, {
120
- offset?: number | {
121
- path: string;
122
- } | FunctionCall | undefined;
123
- }>>;
124
- }, "strict", z.ZodTypeAny, {
125
- call: "@index";
126
- args?: {
127
- offset?: number | {
128
- path: string;
129
- } | FunctionCall | undefined;
130
- } | undefined;
131
- }, {
132
- call: "@index";
133
- args?: {
134
- offset?: number | {
135
- path: string;
136
- } | FunctionCall | undefined;
137
- } | undefined;
138
- }>;
139
- export type IndexSystemFunction = z.infer<typeof IndexSystemFunctionSchema>;
140
- /** `common_types.json#/$defs/AccessibilityAttributes`. */
141
- export declare const AccessibilityAttributesSchema: z.ZodObject<{
142
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
143
- path: z.ZodString;
144
- }, "strict", z.ZodTypeAny, {
145
- path: string;
146
- }, {
147
- path: string;
148
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>;
149
- description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
150
- path: z.ZodString;
151
- }, "strict", z.ZodTypeAny, {
152
- path: string;
153
- }, {
154
- path: string;
155
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>;
156
- }, "strict", z.ZodTypeAny, {
157
- label?: string | {
158
- path: string;
159
- } | FunctionCall | undefined;
160
- description?: string | {
161
- path: string;
162
- } | FunctionCall | undefined;
163
- }, {
164
- label?: string | {
165
- path: string;
166
- } | FunctionCall | undefined;
167
- description?: string | {
168
- path: string;
169
- } | FunctionCall | undefined;
170
- }>;
171
- export type AccessibilityAttributes = z.infer<typeof AccessibilityAttributesSchema>;
172
- /** `common_types.json#/$defs/ComponentCommon` — every component carries at least `id`. */
173
- export declare const ComponentCommonSchema: z.ZodObject<{
174
- id: z.ZodString;
175
- accessibility: z.ZodOptional<z.ZodObject<{
176
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
177
- path: z.ZodString;
178
- }, "strict", z.ZodTypeAny, {
179
- path: string;
180
- }, {
181
- path: string;
182
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>;
183
- description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
184
- path: z.ZodString;
185
- }, "strict", z.ZodTypeAny, {
186
- path: string;
187
- }, {
188
- path: string;
189
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>;
190
- }, "strict", z.ZodTypeAny, {
191
- label?: string | {
192
- path: string;
193
- } | FunctionCall | undefined;
194
- description?: string | {
195
- path: string;
196
- } | FunctionCall | undefined;
197
- }, {
198
- label?: string | {
199
- path: string;
200
- } | FunctionCall | undefined;
201
- description?: string | {
202
- path: string;
203
- } | FunctionCall | undefined;
204
- }>>;
205
- }, "strip", z.ZodTypeAny, {
206
- id: string;
207
- accessibility?: {
208
- label?: string | {
209
- path: string;
210
- } | FunctionCall | undefined;
211
- description?: string | {
212
- path: string;
213
- } | FunctionCall | undefined;
214
- } | undefined;
215
- }, {
216
- id: string;
217
- accessibility?: {
218
- label?: string | {
219
- path: string;
220
- } | FunctionCall | undefined;
221
- description?: string | {
222
- path: string;
223
- } | FunctionCall | undefined;
224
- } | undefined;
225
- }>;
226
- export type ComponentCommon = z.infer<typeof ComponentCommonSchema>;
227
- /** `common_types.json#/$defs/Child` — "A reference to a single child component ID." */
228
- export declare const ChildSchema: z.ZodString;
229
- export type Child = ComponentId;
230
- /**
231
- * `common_types.json#/$defs/ChildList` — either a static array of `ComponentId`s, or a template
232
- * object (`{componentId, path}`) that generates one child per item in a data-model list.
233
- */
234
- export declare const ChildListSchema: z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodObject<{
235
- componentId: z.ZodString;
236
- path: z.ZodString;
237
- }, "strict", z.ZodTypeAny, {
238
- path: string;
239
- componentId: string;
240
- }, {
241
- path: string;
242
- componentId: string;
243
- }>]>;
244
- export type ChildList = z.infer<typeof ChildListSchema>;
245
- export type ChildListTemplate = Extract<ChildList, {
246
- componentId: string;
247
- }>;
248
- /** `common_types.json#/$defs/CheckRule` — "A single validation rule applied to an input component." */
249
- export declare const CheckRuleSchema: z.ZodObject<{
250
- condition: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
251
- path: z.ZodString;
252
- }, "strict", z.ZodTypeAny, {
253
- path: string;
254
- }, {
255
- path: string;
256
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
257
- message: z.ZodString;
258
- }, "strict", z.ZodTypeAny, {
259
- message: string;
260
- condition: boolean | {
261
- path: string;
262
- } | FunctionCall;
263
- }, {
264
- message: string;
265
- condition: boolean | {
266
- path: string;
267
- } | FunctionCall;
268
- }>;
269
- export type CheckRule = z.infer<typeof CheckRuleSchema>;
270
- /** `common_types.json#/$defs/Checkable`. */
271
- export declare const CheckableSchema: z.ZodObject<{
272
- checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
273
- condition: z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
274
- path: z.ZodString;
275
- }, "strict", z.ZodTypeAny, {
276
- path: string;
277
- }, {
278
- path: string;
279
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>;
280
- message: z.ZodString;
281
- }, "strict", z.ZodTypeAny, {
282
- message: string;
283
- condition: boolean | {
284
- path: string;
285
- } | FunctionCall;
286
- }, {
287
- message: string;
288
- condition: boolean | {
289
- path: string;
290
- } | FunctionCall;
291
- }>, "many">>;
292
- }, "strip", z.ZodTypeAny, {
293
- checks?: {
294
- message: string;
295
- condition: boolean | {
296
- path: string;
297
- } | FunctionCall;
298
- }[] | undefined;
299
- }, {
300
- checks?: {
301
- message: string;
302
- condition: boolean | {
303
- path: string;
304
- } | FunctionCall;
305
- }[] | undefined;
306
- }>;
307
- export type Checkable = z.infer<typeof CheckableSchema>;
308
- /**
309
- * `common_types.json#/$defs/Action` — "Defines an interaction handler that can either trigger an
310
- * agent-side event or execute a local renderer-side function." The two variants are mutually
311
- * exclusive on the wire (each is `.strict()` with only its own key).
312
- */
313
- export declare const AgentActionEventSchema: z.ZodObject<{
314
- name: z.ZodString;
315
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodObject<{
316
- path: z.ZodString;
317
- }, "strict", z.ZodTypeAny, {
318
- path: string;
319
- }, {
320
- path: string;
321
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>>;
322
- wantResponse: z.ZodOptional<z.ZodBoolean>;
323
- responsePath: z.ZodOptional<z.ZodString>;
324
- }, "strict", z.ZodTypeAny, {
325
- name: string;
326
- context?: Record<string, string | number | boolean | unknown[] | {
327
- path: string;
328
- } | FunctionCall> | undefined;
329
- wantResponse?: boolean | undefined;
330
- responsePath?: string | undefined;
331
- }, {
332
- name: string;
333
- context?: Record<string, string | number | boolean | unknown[] | {
334
- path: string;
335
- } | FunctionCall> | undefined;
336
- wantResponse?: boolean | undefined;
337
- responsePath?: string | undefined;
338
- }>;
339
- export type AgentActionEvent = z.infer<typeof AgentActionEventSchema>;
340
- export declare const ActionSchema: z.ZodUnion<[z.ZodObject<{
341
- event: z.ZodObject<{
342
- name: z.ZodString;
343
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodObject<{
344
- path: z.ZodString;
345
- }, "strict", z.ZodTypeAny, {
346
- path: string;
347
- }, {
348
- path: string;
349
- }>, z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>]>>>;
350
- wantResponse: z.ZodOptional<z.ZodBoolean>;
351
- responsePath: z.ZodOptional<z.ZodString>;
352
- }, "strict", z.ZodTypeAny, {
353
- name: string;
354
- context?: Record<string, string | number | boolean | unknown[] | {
355
- path: string;
356
- } | FunctionCall> | undefined;
357
- wantResponse?: boolean | undefined;
358
- responsePath?: string | undefined;
359
- }, {
360
- name: string;
361
- context?: Record<string, string | number | boolean | unknown[] | {
362
- path: string;
363
- } | FunctionCall> | undefined;
364
- wantResponse?: boolean | undefined;
365
- responsePath?: string | undefined;
366
- }>;
367
- }, "strict", z.ZodTypeAny, {
368
- event: {
369
- name: string;
370
- context?: Record<string, string | number | boolean | unknown[] | {
371
- path: string;
372
- } | FunctionCall> | undefined;
373
- wantResponse?: boolean | undefined;
374
- responsePath?: string | undefined;
375
- };
376
- }, {
377
- event: {
378
- name: string;
379
- context?: Record<string, string | number | boolean | unknown[] | {
380
- path: string;
381
- } | FunctionCall> | undefined;
382
- wantResponse?: boolean | undefined;
383
- responsePath?: string | undefined;
384
- };
385
- }>, z.ZodObject<{
386
- functionCall: z.ZodType<FunctionCall, z.ZodTypeDef, FunctionCall>;
387
- }, "strict", z.ZodTypeAny, {
388
- functionCall: FunctionCall;
389
- }, {
390
- functionCall: FunctionCall;
391
- }>]>;
392
- export type Action = z.infer<typeof ActionSchema>;
393
- export type AgentEventAction = Extract<Action, {
394
- event: AgentActionEvent;
395
- }>;
396
- export type LocalFunctionAction = Extract<Action, {
397
- functionCall: FunctionCall;
398
- }>;
399
- export declare function isAgentEventAction(action: Action): action is AgentEventAction;
400
- export declare function isLocalFunctionAction(action: Action): action is LocalFunctionAction;
401
- //# sourceMappingURL=common-types.d.ts.map
@@ -1,130 +0,0 @@
1
- /**
2
- * @module common-types
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 common wire types — Zod schemas mirroring
5
- * `specification/v1_0/json/common_types.json` from https://github.com/a2ui-project/a2ui
6
- * (fetched and read directly from that repo's `main` branch this session; every field name below
7
- * was copied from the real JSON Schema `$defs`, not guessed). A2UI is a real, versioned,
8
- * actively-maintained spec (v1.0 is a release candidate at the time this was written) for agents
9
- * to stream a declarative, catalog-whitelisted component tree + JSON-Pointer-bound data model to a
10
- * renderer. See `../source-map.md` for provenance, what was verified against the primary source,
11
- * and — importantly — why this was hand-rolled from the JSON Schemas rather than built on the
12
- * official `@a2ui/web_core` npm package (materially version-drifted: see that doc).
13
- *
14
- * Scope note: this module is the **wire shape** only (what a message/type looks like on the
15
- * wire). Catalog membership (which component/function names are actually legal for a given
16
- * surface) is a separate, runtime concern — see `catalog.ts` and `interpreter.ts`. A component
17
- * object's own per-type property shape (e.g. what `Text` requires beyond `id`/`component`) is
18
- * also not encoded here — see `catalog.ts`'s `createLabCatalog()`, which carries all 18 of the real
19
- * "basic" catalog's components with their closed, per-type property schemas.
20
- */
21
- import { z } from 'zod';
22
- /** `common_types.json#/$defs/ComponentId` — "The unique identifier for a component, used for both definitions and references within the same surface." */
23
- export const ComponentIdSchema = z.string();
24
- /** `common_types.json#/$defs/CallId` — "The unique identifier for an agent initiated function call." */
25
- export const CallIdSchema = z.string();
26
- /** `common_types.json#/$defs/DataBinding` — a JSON Pointer (RFC 6901) reference into the data model. */
27
- export const DataBindingSchema = z.object({ path: z.string() }).strict();
28
- /**
29
- * `common_types.json#/$defs/FunctionCall` — "Invokes a named function on the renderer."
30
- * The real schema additionally constrains `call`/`args` via a `oneOf` against
31
- * `catalog.json#/$defs/anyFunction` (i.e. the active catalog's own function definitions) or
32
- * `IndexSystemFunction`. That constraint is catalog-dependent and cannot be expressed in a static
33
- * wire schema shared across every catalog — it is enforced at runtime instead, by
34
- * `catalog.ts`/`resolve.ts` (function-name whitelist + `callableFrom` execution-boundary check).
35
- * This schema only validates the wire shape: `call` is a non-empty string, `args` (if present) is
36
- * a plain object.
37
- */
38
- export const FunctionCallSchema = z.lazy(() => z
39
- .object({
40
- call: z.string(),
41
- args: z.record(z.string(), ArgValueSchema).optional(),
42
- })
43
- .strict());
44
- /** `common_types.json#/$defs/DynamicValue`'s `args`-position shape: a `DynamicValue`, or a literal object (catalog-defined config). Recursive because `args` values may themselves be `FunctionCall`s. */
45
- const ArgValueSchema = z.lazy(() => z.union([z.string(), z.number(), z.boolean(), z.array(z.unknown()), DataBindingSchema, FunctionCallSchema, z.record(z.string(), z.unknown())]));
46
- /** `common_types.json#/$defs/DynamicValue` — "A value that can be a literal, a path, or a function call returning any type." */
47
- export const DynamicValueSchema = z.union([
48
- z.string(),
49
- z.number(),
50
- z.boolean(),
51
- z.array(z.unknown()),
52
- DataBindingSchema,
53
- FunctionCallSchema,
54
- ]);
55
- /** `common_types.json#/$defs/DynamicString` — literal, JSON-Pointer binding, or `FunctionCall` returning a string. */
56
- export const DynamicStringSchema = z.union([z.string(), DataBindingSchema, FunctionCallSchema]);
57
- /** `common_types.json#/$defs/DynamicNumber`. */
58
- export const DynamicNumberSchema = z.union([z.number(), DataBindingSchema, FunctionCallSchema]);
59
- /** `common_types.json#/$defs/DynamicBoolean`. */
60
- export const DynamicBooleanSchema = z.union([z.boolean(), DataBindingSchema, FunctionCallSchema]);
61
- /** `common_types.json#/$defs/DynamicStringList`. */
62
- export const DynamicStringListSchema = z.union([z.array(z.string()), DataBindingSchema, FunctionCallSchema]);
63
- /**
64
- * `common_types.json#/$defs/IndexSystemFunction` — "Returns the 0-based index of the current item
65
- * when rendering a dynamic list from a template. This function MUST ONLY be available when
66
- * evaluating template items within a list context." `call` is the literal `@index`; catalogs
67
- * "MUST NOT define functions prefixed with `@`" per the catalog spec's system-namespace rule, so
68
- * this is the one function name every catalog implicitly carries.
69
- */
70
- export const IndexSystemFunctionSchema = z
71
- .object({
72
- call: z.literal('@index'),
73
- args: z.object({ offset: DynamicNumberSchema.optional() }).strict().optional(),
74
- })
75
- .strict();
76
- /** `common_types.json#/$defs/AccessibilityAttributes`. */
77
- export const AccessibilityAttributesSchema = z
78
- .object({
79
- label: DynamicStringSchema.optional(),
80
- description: DynamicStringSchema.optional(),
81
- })
82
- .strict();
83
- /** `common_types.json#/$defs/ComponentCommon` — every component carries at least `id`. */
84
- export const ComponentCommonSchema = z.object({
85
- id: ComponentIdSchema,
86
- accessibility: AccessibilityAttributesSchema.optional(),
87
- });
88
- /** `common_types.json#/$defs/Child` — "A reference to a single child component ID." */
89
- export const ChildSchema = ComponentIdSchema;
90
- /**
91
- * `common_types.json#/$defs/ChildList` — either a static array of `ComponentId`s, or a template
92
- * object (`{componentId, path}`) that generates one child per item in a data-model list.
93
- */
94
- export const ChildListSchema = z.union([
95
- z.array(ComponentIdSchema),
96
- z.object({ componentId: ComponentIdSchema, path: z.string() }).strict(),
97
- ]);
98
- /** `common_types.json#/$defs/CheckRule` — "A single validation rule applied to an input component." */
99
- export const CheckRuleSchema = z
100
- .object({
101
- condition: DynamicBooleanSchema,
102
- message: z.string(),
103
- })
104
- .strict();
105
- /** `common_types.json#/$defs/Checkable`. */
106
- export const CheckableSchema = z.object({ checks: z.array(CheckRuleSchema).optional() });
107
- /**
108
- * `common_types.json#/$defs/Action` — "Defines an interaction handler that can either trigger an
109
- * agent-side event or execute a local renderer-side function." The two variants are mutually
110
- * exclusive on the wire (each is `.strict()` with only its own key).
111
- */
112
- export const AgentActionEventSchema = z
113
- .object({
114
- name: z.string(),
115
- context: z.record(z.string(), DynamicValueSchema).optional(),
116
- wantResponse: z.boolean().optional(),
117
- responsePath: z.string().optional(),
118
- })
119
- .strict();
120
- export const ActionSchema = z.union([
121
- z.object({ event: AgentActionEventSchema }).strict(),
122
- z.object({ functionCall: FunctionCallSchema }).strict(),
123
- ]);
124
- export function isAgentEventAction(action) {
125
- return 'event' in action;
126
- }
127
- export function isLocalFunctionAction(action) {
128
- return 'functionCall' in action;
129
- }
130
- //# sourceMappingURL=common-types.js.map
@@ -1,16 +0,0 @@
1
- /**
2
- * @module @jini-ai/a2ui
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 wire types + a minimal client-side interpreter — see each module's
5
- * own doc for detail, and `source-map.md` for provenance, verified-against-primary-source notes,
6
- * and the honest gap list against full v1.0 spec parity.
7
- */
8
- export * from './common-types.js';
9
- export * from './agent-to-renderer.js';
10
- export * from './renderer-to-agent.js';
11
- export * from './catalog.js';
12
- export * from './json-pointer.js';
13
- export * from './resolve.js';
14
- export * from './tree.js';
15
- export * from './interpreter.js';
16
- //# sourceMappingURL=index.d.ts.map
@@ -1,16 +0,0 @@
1
- /**
2
- * @module @jini-ai/a2ui
3
- *
4
- * A2UI ("Agent-to-UI") v1.0 wire types + a minimal client-side interpreter — see each module's
5
- * own doc for detail, and `source-map.md` for provenance, verified-against-primary-source notes,
6
- * and the honest gap list against full v1.0 spec parity.
7
- */
8
- export * from './common-types.js';
9
- export * from './agent-to-renderer.js';
10
- export * from './renderer-to-agent.js';
11
- export * from './catalog.js';
12
- export * from './json-pointer.js';
13
- export * from './resolve.js';
14
- export * from './tree.js';
15
- export * from './interpreter.js';
16
- //# sourceMappingURL=index.js.map
@@ -1,71 +0,0 @@
1
- import type { ParseFailure } from './agent-to-renderer.js';
2
- import { WireComponentSchema } from './agent-to-renderer.js';
3
- import type { RendererToAgentMessage } from './renderer-to-agent.js';
4
- import { type Catalog } from './catalog.js';
5
- import { resolveDynamicValue } from './resolve.js';
6
- import { type DynamicValue, type LocalFunctionAction } from './common-types.js';
7
- export interface ComponentInstance {
8
- readonly id: string;
9
- readonly component: string;
10
- /** Validated + defaulted per the catalog's own per-type schema. Does not include `id`/`component`. */
11
- readonly props: Record<string, unknown>;
12
- }
13
- export interface SurfaceSnapshot {
14
- readonly surfaceId: string;
15
- readonly catalogId: string;
16
- readonly components: ReadonlyMap<string, ComponentInstance>;
17
- readonly dataModel: unknown;
18
- }
19
- export interface ApplyMessageResult {
20
- readonly rendererMessages: readonly RendererToAgentMessage[];
21
- /** See module doc, decision 4. Not part of the wire protocol — a local-only diagnostic. */
22
- readonly unattributedViolation?: string;
23
- }
24
- export type BuildActionResult = {
25
- readonly ok: true;
26
- readonly kind: 'agent';
27
- readonly message: RendererToAgentMessage;
28
- } | {
29
- readonly ok: true;
30
- readonly kind: 'local';
31
- readonly result: unknown;
32
- } | {
33
- readonly ok: false;
34
- readonly reason: string;
35
- };
36
- /**
37
- * Turns a `ParseFailure` (from `parseAgentToRendererMessage`) into what `applyAgentMessage`
38
- * returns for it. See this module's doc, decision 4: an envelope malformed enough to carry no
39
- * attributable `surfaceId`/`functionCallId` cannot be turned into a spec-shaped `error` message —
40
- * `renderer_to_agent.json`'s own generic-error schema *requires* one of those two identifiers —
41
- * so it surfaces out-of-band via `unattributedViolation` (a string, not sent over the wire)
42
- * instead of forcing a fake identifier into a wire-conformant shape.
43
- *
44
- * Exported and pure — it only reads `parsed`/`raw`, so the surfaceId-attribution rule can be
45
- * tested directly, without a live interpreter instance.
46
- */
47
- export declare function buildParseFailureResult(parsed: ParseFailure, raw: unknown): ApplyMessageResult;
48
- /**
49
- * Runs a component's local `functionCall` action synchronously against `dataModel` — no network
50
- * round trip, no pending-action bookkeeping (that only applies to the agent-event branch; see
51
- * `interpreter`'s `buildAction`/`buildAgentEventAction`).
52
- *
53
- * Exported and pure given its inputs, so "a local action resolves against the surface's actual
54
- * data model, and a resolution failure becomes a typed refusal rather than a thrown error" can be
55
- * tested without a live interpreter instance.
56
- */
57
- export declare function runLocalFunctionAction(dataModel: unknown, catalog: Catalog, action: LocalFunctionAction): BuildActionResult;
58
- export interface A2uiInterpreter {
59
- applyAgentMessage(raw: unknown): ApplyMessageResult;
60
- getSurface(surfaceId: string): SurfaceSnapshot | undefined;
61
- listSurfaceIds(): string[];
62
- /** `undefined` if the surface doesn't exist, or exists but has no component with id `'root'` yet (a legal, "still streaming in" state per the spec's own forward-reference tolerance). */
63
- getRoot(surfaceId: string): ComponentInstance | undefined;
64
- /** Resolves a component's `action` prop (if any) for dispatch — builds the `action` envelope for an agent-event action, or synchronously runs a local `functionCall` action. Called by a host renderer on a real user interaction (e.g. a Button click). */
65
- buildAction(surfaceId: string, componentId: string, now?: () => number): BuildActionResult;
66
- resolve(surfaceId: string, value: DynamicValue, itemBasePath?: string, itemIndex?: number): ReturnType<typeof resolveDynamicValue>;
67
- subscribe(listener: () => void): () => void;
68
- }
69
- export declare function createA2uiInterpreter(catalog: Catalog): A2uiInterpreter;
70
- export { WireComponentSchema };
71
- //# sourceMappingURL=interpreter.d.ts.map