@jini-ai/agentic 0.4.0 → 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.
- package/CHANGELOG.md +5 -0
- package/dist/core/annotated-actions-script.d.ts +13 -0
- package/dist/core/annotated-actions-script.js +137 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/package.json +2 -2
- package/dist/a2ui/agent-to-renderer.d.ts +0 -613
- package/dist/a2ui/agent-to-renderer.js +0 -191
- package/dist/a2ui/catalog.d.ts +0 -73
- package/dist/a2ui/catalog.js +0 -304
- package/dist/a2ui/common-types.d.ts +0 -401
- package/dist/a2ui/common-types.js +0 -130
- package/dist/a2ui/index.d.ts +0 -16
- package/dist/a2ui/index.js +0 -16
- package/dist/a2ui/interpreter.d.ts +0 -71
- package/dist/a2ui/interpreter.js +0 -337
- package/dist/a2ui/json-pointer.d.ts +0 -48
- package/dist/a2ui/json-pointer.js +0 -174
- package/dist/a2ui/renderer-to-agent.d.ts +0 -342
- package/dist/a2ui/renderer-to-agent.js +0 -111
- package/dist/a2ui/resolve.d.ts +0 -28
- package/dist/a2ui/resolve.js +0 -144
- package/dist/a2ui/tree.d.ts +0 -66
- package/dist/a2ui/tree.js +0 -74
- package/dist/ag-ui.d.ts +0 -82
- package/dist/ag-ui.js +0 -85
- package/dist/agui/encoder.d.ts +0 -50
- package/dist/agui/encoder.js +0 -97
- package/dist/agui/events.d.ts +0 -59
- package/dist/agui/events.js +0 -15
- package/dist/capability.d.ts +0 -81
- package/dist/capability.js +0 -79
- package/dist/dom/dom-page-driver.d.ts +0 -36
- package/dist/dom/dom-page-driver.js +0 -601
- package/dist/dom/index.d.ts +0 -17
- package/dist/dom/index.js +0 -17
- package/dist/dom/model-context.d.ts +0 -69
- package/dist/dom/model-context.js +0 -44
- package/dist/element-handles.d.ts +0 -120
- package/dist/element-handles.js +0 -39
- package/dist/gen-ui/encoder.d.ts +0 -50
- package/dist/gen-ui/encoder.js +0 -97
- package/dist/gen-ui/events.d.ts +0 -59
- package/dist/gen-ui/events.js +0 -15
- package/dist/gen-ui/index.d.ts +0 -18
- package/dist/gen-ui/index.js +0 -17
- package/dist/guards.d.ts +0 -96
- package/dist/guards.js +0 -186
- package/dist/handle.d.ts +0 -41
- package/dist/handle.js +0 -41
- package/dist/mcp-ui-apps.d.ts +0 -223
- package/dist/mcp-ui-apps.js +0 -252
- package/dist/mcp-ui.d.ts +0 -133
- package/dist/mcp-ui.js +0 -134
- package/dist/page-capabilities.d.ts +0 -14
- package/dist/page-capabilities.js +0 -129
- package/dist/page-driver.d.ts +0 -120
- package/dist/page-driver.js +0 -2
- package/dist/page-executor.d.ts +0 -94
- package/dist/page-executor.js +0 -320
- package/dist/webmcp.d.ts +0 -202
- 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
|
package/dist/a2ui/index.d.ts
DELETED
|
@@ -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
|
package/dist/a2ui/index.js
DELETED
|
@@ -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
|