@yourgpt/copilot-sdk 2.1.8 → 2.1.9-alpha.0
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/dist/{chunk-ISOMZAYN.js → chunk-RBULQ6EJ.js} +207 -62
- package/dist/chunk-RBULQ6EJ.js.map +1 -0
- package/dist/chunk-RPR5GMWF.js +52 -0
- package/dist/chunk-RPR5GMWF.js.map +1 -0
- package/dist/{chunk-IDAQU3FP.cjs → chunk-TD7NF6OE.cjs} +207 -62
- package/dist/chunk-TD7NF6OE.cjs.map +1 -0
- package/dist/{chunk-JFVTY757.cjs → chunk-WYFJZNFT.cjs} +16 -16
- package/dist/{chunk-JFVTY757.cjs.map → chunk-WYFJZNFT.cjs.map} +1 -1
- package/dist/{chunk-H3LX6FTP.js → chunk-XVKKLLKW.js} +3 -3
- package/dist/{chunk-H3LX6FTP.js.map → chunk-XVKKLLKW.js.map} +1 -1
- package/dist/chunk-YBLAHX2Z.cjs +55 -0
- package/dist/chunk-YBLAHX2Z.cjs.map +1 -0
- package/dist/experimental/index.cjs +416 -536
- package/dist/experimental/index.cjs.map +1 -1
- package/dist/experimental/index.d.cts +189 -853
- package/dist/experimental/index.d.ts +189 -853
- package/dist/experimental/index.js +415 -530
- package/dist/experimental/index.js.map +1 -1
- package/dist/react/index.cjs +62 -62
- package/dist/react/index.d.cts +18 -0
- package/dist/react/index.d.ts +18 -0
- package/dist/react/index.js +2 -2
- package/dist/ui/index.cjs +521 -263
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +352 -94
- package/dist/ui/index.js.map +1 -1
- package/package.json +2 -1
- package/dist/chunk-5EGBIQYS.cjs +0 -292
- package/dist/chunk-5EGBIQYS.cjs.map +0 -1
- package/dist/chunk-IDAQU3FP.cjs.map +0 -1
- package/dist/chunk-ISOMZAYN.js.map +0 -1
- package/dist/chunk-TXQ37MAO.js +0 -287
- package/dist/chunk-TXQ37MAO.js.map +0 -1
|
@@ -1,191 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import React__default from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
|
-
interface GenerativeUIToolConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Override the default LLM description.
|
|
8
|
-
* The default instructs the model when to use each UI type.
|
|
9
|
-
*/
|
|
10
|
-
description?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Returns a tool definition compatible with `streamText` for use in your backend route.
|
|
14
|
-
*
|
|
15
|
-
* Pass the returned object as a value in the `tools` map of `streamText`.
|
|
16
|
-
* The key you use becomes the tool name — use the same name in `useGenerativeUI({ name })` on the frontend.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* import { streamText } from "@yourgpt/llm-sdk";
|
|
21
|
-
* import { generativeUITool } from "@yourgpt/copilot-sdk/experimental";
|
|
22
|
-
*
|
|
23
|
-
* const result = await streamText({
|
|
24
|
-
* model: openai("gpt-4o"),
|
|
25
|
-
* messages,
|
|
26
|
-
* tools: {
|
|
27
|
-
* render_ui: generativeUITool(),
|
|
28
|
-
* // ...your other tools
|
|
29
|
-
* },
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
declare function generativeUITool(config?: GenerativeUIToolConfig): {
|
|
34
|
-
description: string;
|
|
35
|
-
parameters: {
|
|
36
|
-
type: "object";
|
|
37
|
-
properties: {
|
|
38
|
-
type: {
|
|
39
|
-
type: "string";
|
|
40
|
-
enum: string[];
|
|
41
|
-
description: string;
|
|
42
|
-
};
|
|
43
|
-
html: {
|
|
44
|
-
type: "string";
|
|
45
|
-
description: string;
|
|
46
|
-
};
|
|
47
|
-
height: {
|
|
48
|
-
type: "string";
|
|
49
|
-
};
|
|
50
|
-
chartType: {
|
|
51
|
-
type: "string";
|
|
52
|
-
enum: string[];
|
|
53
|
-
description: string;
|
|
54
|
-
};
|
|
55
|
-
labels: {
|
|
56
|
-
type: "array";
|
|
57
|
-
items: {
|
|
58
|
-
type: "string";
|
|
59
|
-
};
|
|
60
|
-
description: string;
|
|
61
|
-
};
|
|
62
|
-
datasets: {
|
|
63
|
-
type: "array";
|
|
64
|
-
items: {
|
|
65
|
-
type: "object";
|
|
66
|
-
properties: {
|
|
67
|
-
label: {
|
|
68
|
-
type: "string";
|
|
69
|
-
};
|
|
70
|
-
data: {
|
|
71
|
-
type: "array";
|
|
72
|
-
items: {
|
|
73
|
-
type: "number";
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
required: string[];
|
|
78
|
-
};
|
|
79
|
-
description: string;
|
|
80
|
-
};
|
|
81
|
-
xLabel: {
|
|
82
|
-
type: "string";
|
|
83
|
-
};
|
|
84
|
-
yLabel: {
|
|
85
|
-
type: "string";
|
|
86
|
-
};
|
|
87
|
-
columns: {
|
|
88
|
-
type: "array";
|
|
89
|
-
items: {
|
|
90
|
-
type: "object";
|
|
91
|
-
properties: {
|
|
92
|
-
key: {
|
|
93
|
-
type: "string";
|
|
94
|
-
};
|
|
95
|
-
label: {
|
|
96
|
-
type: "string";
|
|
97
|
-
};
|
|
98
|
-
align: {
|
|
99
|
-
type: "string";
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
required: string[];
|
|
103
|
-
};
|
|
104
|
-
description: string;
|
|
105
|
-
};
|
|
106
|
-
rows: {
|
|
107
|
-
type: "array";
|
|
108
|
-
items: {
|
|
109
|
-
type: "object";
|
|
110
|
-
};
|
|
111
|
-
description: string;
|
|
112
|
-
};
|
|
113
|
-
caption: {
|
|
114
|
-
type: "string";
|
|
115
|
-
};
|
|
116
|
-
stats: {
|
|
117
|
-
type: "array";
|
|
118
|
-
items: {
|
|
119
|
-
type: "object";
|
|
120
|
-
properties: {
|
|
121
|
-
label: {
|
|
122
|
-
type: "string";
|
|
123
|
-
};
|
|
124
|
-
value: {
|
|
125
|
-
type: "string";
|
|
126
|
-
};
|
|
127
|
-
change: {
|
|
128
|
-
type: "string";
|
|
129
|
-
};
|
|
130
|
-
changeDirection: {
|
|
131
|
-
type: "string";
|
|
132
|
-
enum: string[];
|
|
133
|
-
};
|
|
134
|
-
description: {
|
|
135
|
-
type: "string";
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
required: string[];
|
|
139
|
-
};
|
|
140
|
-
description: string;
|
|
141
|
-
};
|
|
142
|
-
title: {
|
|
143
|
-
type: "string";
|
|
144
|
-
description: string;
|
|
145
|
-
};
|
|
146
|
-
subtitle: {
|
|
147
|
-
type: "string";
|
|
148
|
-
};
|
|
149
|
-
body: {
|
|
150
|
-
type: "string";
|
|
151
|
-
};
|
|
152
|
-
fields: {
|
|
153
|
-
type: "array";
|
|
154
|
-
items: {
|
|
155
|
-
type: "object";
|
|
156
|
-
properties: {
|
|
157
|
-
label: {
|
|
158
|
-
type: "string";
|
|
159
|
-
};
|
|
160
|
-
value: {
|
|
161
|
-
type: "string";
|
|
162
|
-
};
|
|
163
|
-
badge: {
|
|
164
|
-
type: "boolean";
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
required: string[];
|
|
168
|
-
};
|
|
169
|
-
description: string;
|
|
170
|
-
};
|
|
171
|
-
cta: {
|
|
172
|
-
type: "object";
|
|
173
|
-
properties: {
|
|
174
|
-
label: {
|
|
175
|
-
type: "string";
|
|
176
|
-
};
|
|
177
|
-
url: {
|
|
178
|
-
type: "string";
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
required: string[];
|
|
182
|
-
description: string;
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
required: string[];
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
|
|
189
5
|
declare const HtmlPayloadSchema: z.ZodObject<{
|
|
190
6
|
type: z.ZodLiteral<"html">;
|
|
191
7
|
html: z.ZodString;
|
|
@@ -202,309 +18,7 @@ declare const HtmlPayloadSchema: z.ZodObject<{
|
|
|
202
18
|
title: z.ZodOptional<z.ZodString>;
|
|
203
19
|
height: z.ZodOptional<z.ZodString>;
|
|
204
20
|
}, z.ZodTypeAny, "passthrough">>;
|
|
205
|
-
declare const
|
|
206
|
-
type: z.ZodLiteral<"chart">;
|
|
207
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
208
|
-
title: z.ZodOptional<z.ZodString>;
|
|
209
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
210
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
211
|
-
label: z.ZodString;
|
|
212
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
213
|
-
color: z.ZodOptional<z.ZodString>;
|
|
214
|
-
}, "strip", z.ZodTypeAny, {
|
|
215
|
-
label: string;
|
|
216
|
-
data: number[];
|
|
217
|
-
color?: string | undefined;
|
|
218
|
-
}, {
|
|
219
|
-
label: string;
|
|
220
|
-
data: number[];
|
|
221
|
-
color?: string | undefined;
|
|
222
|
-
}>, "many">;
|
|
223
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
224
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
225
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
226
|
-
type: z.ZodLiteral<"chart">;
|
|
227
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
228
|
-
title: z.ZodOptional<z.ZodString>;
|
|
229
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
230
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
231
|
-
label: z.ZodString;
|
|
232
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
233
|
-
color: z.ZodOptional<z.ZodString>;
|
|
234
|
-
}, "strip", z.ZodTypeAny, {
|
|
235
|
-
label: string;
|
|
236
|
-
data: number[];
|
|
237
|
-
color?: string | undefined;
|
|
238
|
-
}, {
|
|
239
|
-
label: string;
|
|
240
|
-
data: number[];
|
|
241
|
-
color?: string | undefined;
|
|
242
|
-
}>, "many">;
|
|
243
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
244
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
245
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
246
|
-
type: z.ZodLiteral<"chart">;
|
|
247
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
248
|
-
title: z.ZodOptional<z.ZodString>;
|
|
249
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
250
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
251
|
-
label: z.ZodString;
|
|
252
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
253
|
-
color: z.ZodOptional<z.ZodString>;
|
|
254
|
-
}, "strip", z.ZodTypeAny, {
|
|
255
|
-
label: string;
|
|
256
|
-
data: number[];
|
|
257
|
-
color?: string | undefined;
|
|
258
|
-
}, {
|
|
259
|
-
label: string;
|
|
260
|
-
data: number[];
|
|
261
|
-
color?: string | undefined;
|
|
262
|
-
}>, "many">;
|
|
263
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
264
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
265
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
266
|
-
declare const TablePayloadSchema: z.ZodObject<{
|
|
267
|
-
type: z.ZodLiteral<"table">;
|
|
268
|
-
title: z.ZodOptional<z.ZodString>;
|
|
269
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
270
|
-
key: z.ZodString;
|
|
271
|
-
label: z.ZodString;
|
|
272
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
273
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
274
|
-
key: z.ZodString;
|
|
275
|
-
label: z.ZodString;
|
|
276
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
277
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
278
|
-
key: z.ZodString;
|
|
279
|
-
label: z.ZodString;
|
|
280
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
281
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
282
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
283
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
284
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
285
|
-
type: z.ZodLiteral<"table">;
|
|
286
|
-
title: z.ZodOptional<z.ZodString>;
|
|
287
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
288
|
-
key: z.ZodString;
|
|
289
|
-
label: z.ZodString;
|
|
290
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
291
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
292
|
-
key: z.ZodString;
|
|
293
|
-
label: z.ZodString;
|
|
294
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
295
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
296
|
-
key: z.ZodString;
|
|
297
|
-
label: z.ZodString;
|
|
298
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
299
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
300
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
301
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
302
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
303
|
-
type: z.ZodLiteral<"table">;
|
|
304
|
-
title: z.ZodOptional<z.ZodString>;
|
|
305
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
306
|
-
key: z.ZodString;
|
|
307
|
-
label: z.ZodString;
|
|
308
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
309
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
310
|
-
key: z.ZodString;
|
|
311
|
-
label: z.ZodString;
|
|
312
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
313
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
314
|
-
key: z.ZodString;
|
|
315
|
-
label: z.ZodString;
|
|
316
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
317
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
318
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
319
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
320
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
321
|
-
declare const StatPayloadSchema: z.ZodObject<{
|
|
322
|
-
type: z.ZodLiteral<"stat">;
|
|
323
|
-
title: z.ZodOptional<z.ZodString>;
|
|
324
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
325
|
-
label: z.ZodString;
|
|
326
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
327
|
-
change: z.ZodOptional<z.ZodString>;
|
|
328
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
329
|
-
description: z.ZodOptional<z.ZodString>;
|
|
330
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
331
|
-
label: z.ZodString;
|
|
332
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
333
|
-
change: z.ZodOptional<z.ZodString>;
|
|
334
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
335
|
-
description: z.ZodOptional<z.ZodString>;
|
|
336
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
337
|
-
label: z.ZodString;
|
|
338
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
339
|
-
change: z.ZodOptional<z.ZodString>;
|
|
340
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
341
|
-
description: z.ZodOptional<z.ZodString>;
|
|
342
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
343
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
344
|
-
type: z.ZodLiteral<"stat">;
|
|
345
|
-
title: z.ZodOptional<z.ZodString>;
|
|
346
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
347
|
-
label: z.ZodString;
|
|
348
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
349
|
-
change: z.ZodOptional<z.ZodString>;
|
|
350
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
351
|
-
description: z.ZodOptional<z.ZodString>;
|
|
352
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
353
|
-
label: z.ZodString;
|
|
354
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
355
|
-
change: z.ZodOptional<z.ZodString>;
|
|
356
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
357
|
-
description: z.ZodOptional<z.ZodString>;
|
|
358
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
359
|
-
label: z.ZodString;
|
|
360
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
361
|
-
change: z.ZodOptional<z.ZodString>;
|
|
362
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
363
|
-
description: z.ZodOptional<z.ZodString>;
|
|
364
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
365
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
366
|
-
type: z.ZodLiteral<"stat">;
|
|
367
|
-
title: z.ZodOptional<z.ZodString>;
|
|
368
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
369
|
-
label: z.ZodString;
|
|
370
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
371
|
-
change: z.ZodOptional<z.ZodString>;
|
|
372
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
373
|
-
description: z.ZodOptional<z.ZodString>;
|
|
374
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
375
|
-
label: z.ZodString;
|
|
376
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
377
|
-
change: z.ZodOptional<z.ZodString>;
|
|
378
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
379
|
-
description: z.ZodOptional<z.ZodString>;
|
|
380
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
381
|
-
label: z.ZodString;
|
|
382
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
383
|
-
change: z.ZodOptional<z.ZodString>;
|
|
384
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
385
|
-
description: z.ZodOptional<z.ZodString>;
|
|
386
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
387
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
388
|
-
declare const CardPayloadSchema: z.ZodObject<{
|
|
389
|
-
type: z.ZodLiteral<"card">;
|
|
390
|
-
title: z.ZodString;
|
|
391
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
392
|
-
body: z.ZodOptional<z.ZodString>;
|
|
393
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
394
|
-
label: z.ZodString;
|
|
395
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
396
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
397
|
-
}, "strip", z.ZodTypeAny, {
|
|
398
|
-
label: string;
|
|
399
|
-
value: string | number | boolean;
|
|
400
|
-
badge?: boolean | undefined;
|
|
401
|
-
}, {
|
|
402
|
-
label: string;
|
|
403
|
-
value: string | number | boolean;
|
|
404
|
-
badge?: boolean | undefined;
|
|
405
|
-
}>, "many">>;
|
|
406
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
407
|
-
label: z.ZodOptional<z.ZodString>;
|
|
408
|
-
text: z.ZodOptional<z.ZodString>;
|
|
409
|
-
url: z.ZodString;
|
|
410
|
-
}, "strip", z.ZodTypeAny, {
|
|
411
|
-
url: string;
|
|
412
|
-
label?: string | undefined;
|
|
413
|
-
text?: string | undefined;
|
|
414
|
-
}, {
|
|
415
|
-
url: string;
|
|
416
|
-
label?: string | undefined;
|
|
417
|
-
text?: string | undefined;
|
|
418
|
-
}>, {
|
|
419
|
-
label: string;
|
|
420
|
-
url: string;
|
|
421
|
-
text?: string | undefined;
|
|
422
|
-
}, {
|
|
423
|
-
url: string;
|
|
424
|
-
label?: string | undefined;
|
|
425
|
-
text?: string | undefined;
|
|
426
|
-
}>>;
|
|
427
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
428
|
-
type: z.ZodLiteral<"card">;
|
|
429
|
-
title: z.ZodString;
|
|
430
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
431
|
-
body: z.ZodOptional<z.ZodString>;
|
|
432
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
433
|
-
label: z.ZodString;
|
|
434
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
435
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
436
|
-
}, "strip", z.ZodTypeAny, {
|
|
437
|
-
label: string;
|
|
438
|
-
value: string | number | boolean;
|
|
439
|
-
badge?: boolean | undefined;
|
|
440
|
-
}, {
|
|
441
|
-
label: string;
|
|
442
|
-
value: string | number | boolean;
|
|
443
|
-
badge?: boolean | undefined;
|
|
444
|
-
}>, "many">>;
|
|
445
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
446
|
-
label: z.ZodOptional<z.ZodString>;
|
|
447
|
-
text: z.ZodOptional<z.ZodString>;
|
|
448
|
-
url: z.ZodString;
|
|
449
|
-
}, "strip", z.ZodTypeAny, {
|
|
450
|
-
url: string;
|
|
451
|
-
label?: string | undefined;
|
|
452
|
-
text?: string | undefined;
|
|
453
|
-
}, {
|
|
454
|
-
url: string;
|
|
455
|
-
label?: string | undefined;
|
|
456
|
-
text?: string | undefined;
|
|
457
|
-
}>, {
|
|
458
|
-
label: string;
|
|
459
|
-
url: string;
|
|
460
|
-
text?: string | undefined;
|
|
461
|
-
}, {
|
|
462
|
-
url: string;
|
|
463
|
-
label?: string | undefined;
|
|
464
|
-
text?: string | undefined;
|
|
465
|
-
}>>;
|
|
466
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
467
|
-
type: z.ZodLiteral<"card">;
|
|
468
|
-
title: z.ZodString;
|
|
469
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
470
|
-
body: z.ZodOptional<z.ZodString>;
|
|
471
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
472
|
-
label: z.ZodString;
|
|
473
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
474
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
475
|
-
}, "strip", z.ZodTypeAny, {
|
|
476
|
-
label: string;
|
|
477
|
-
value: string | number | boolean;
|
|
478
|
-
badge?: boolean | undefined;
|
|
479
|
-
}, {
|
|
480
|
-
label: string;
|
|
481
|
-
value: string | number | boolean;
|
|
482
|
-
badge?: boolean | undefined;
|
|
483
|
-
}>, "many">>;
|
|
484
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
485
|
-
label: z.ZodOptional<z.ZodString>;
|
|
486
|
-
text: z.ZodOptional<z.ZodString>;
|
|
487
|
-
url: z.ZodString;
|
|
488
|
-
}, "strip", z.ZodTypeAny, {
|
|
489
|
-
url: string;
|
|
490
|
-
label?: string | undefined;
|
|
491
|
-
text?: string | undefined;
|
|
492
|
-
}, {
|
|
493
|
-
url: string;
|
|
494
|
-
label?: string | undefined;
|
|
495
|
-
text?: string | undefined;
|
|
496
|
-
}>, {
|
|
497
|
-
label: string;
|
|
498
|
-
url: string;
|
|
499
|
-
text?: string | undefined;
|
|
500
|
-
}, {
|
|
501
|
-
url: string;
|
|
502
|
-
label?: string | undefined;
|
|
503
|
-
text?: string | undefined;
|
|
504
|
-
}>>;
|
|
505
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
506
|
-
/** Full discriminated union of all generative UI payload types */
|
|
507
|
-
declare const GenerativeUIPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
21
|
+
declare const GenerativeUIPayloadSchema: z.ZodObject<{
|
|
508
22
|
type: z.ZodLiteral<"html">;
|
|
509
23
|
html: z.ZodString;
|
|
510
24
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -519,406 +33,228 @@ declare const GenerativeUIPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
519
33
|
html: z.ZodString;
|
|
520
34
|
title: z.ZodOptional<z.ZodString>;
|
|
521
35
|
height: z.ZodOptional<z.ZodString>;
|
|
522
|
-
}, z.ZodTypeAny, "passthrough"
|
|
523
|
-
type: z.ZodLiteral<"chart">;
|
|
524
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
525
|
-
title: z.ZodOptional<z.ZodString>;
|
|
526
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
527
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
528
|
-
label: z.ZodString;
|
|
529
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
530
|
-
color: z.ZodOptional<z.ZodString>;
|
|
531
|
-
}, "strip", z.ZodTypeAny, {
|
|
532
|
-
label: string;
|
|
533
|
-
data: number[];
|
|
534
|
-
color?: string | undefined;
|
|
535
|
-
}, {
|
|
536
|
-
label: string;
|
|
537
|
-
data: number[];
|
|
538
|
-
color?: string | undefined;
|
|
539
|
-
}>, "many">;
|
|
540
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
541
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
542
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
543
|
-
type: z.ZodLiteral<"chart">;
|
|
544
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
545
|
-
title: z.ZodOptional<z.ZodString>;
|
|
546
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
547
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
548
|
-
label: z.ZodString;
|
|
549
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
550
|
-
color: z.ZodOptional<z.ZodString>;
|
|
551
|
-
}, "strip", z.ZodTypeAny, {
|
|
552
|
-
label: string;
|
|
553
|
-
data: number[];
|
|
554
|
-
color?: string | undefined;
|
|
555
|
-
}, {
|
|
556
|
-
label: string;
|
|
557
|
-
data: number[];
|
|
558
|
-
color?: string | undefined;
|
|
559
|
-
}>, "many">;
|
|
560
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
561
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
562
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
563
|
-
type: z.ZodLiteral<"chart">;
|
|
564
|
-
chartType: z.ZodEnum<["bar", "line", "pie", "area", "scatter"]>;
|
|
565
|
-
title: z.ZodOptional<z.ZodString>;
|
|
566
|
-
labels: z.ZodArray<z.ZodString, "many">;
|
|
567
|
-
datasets: z.ZodArray<z.ZodObject<{
|
|
568
|
-
label: z.ZodString;
|
|
569
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
570
|
-
color: z.ZodOptional<z.ZodString>;
|
|
571
|
-
}, "strip", z.ZodTypeAny, {
|
|
572
|
-
label: string;
|
|
573
|
-
data: number[];
|
|
574
|
-
color?: string | undefined;
|
|
575
|
-
}, {
|
|
576
|
-
label: string;
|
|
577
|
-
data: number[];
|
|
578
|
-
color?: string | undefined;
|
|
579
|
-
}>, "many">;
|
|
580
|
-
xLabel: z.ZodOptional<z.ZodString>;
|
|
581
|
-
yLabel: z.ZodOptional<z.ZodString>;
|
|
582
|
-
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
583
|
-
type: z.ZodLiteral<"table">;
|
|
584
|
-
title: z.ZodOptional<z.ZodString>;
|
|
585
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
586
|
-
key: z.ZodString;
|
|
587
|
-
label: z.ZodString;
|
|
588
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
589
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
590
|
-
key: z.ZodString;
|
|
591
|
-
label: z.ZodString;
|
|
592
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
593
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
594
|
-
key: z.ZodString;
|
|
595
|
-
label: z.ZodString;
|
|
596
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
597
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
598
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
599
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
600
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
601
|
-
type: z.ZodLiteral<"table">;
|
|
602
|
-
title: z.ZodOptional<z.ZodString>;
|
|
603
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
604
|
-
key: z.ZodString;
|
|
605
|
-
label: z.ZodString;
|
|
606
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
607
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
608
|
-
key: z.ZodString;
|
|
609
|
-
label: z.ZodString;
|
|
610
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
611
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
612
|
-
key: z.ZodString;
|
|
613
|
-
label: z.ZodString;
|
|
614
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
615
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
616
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
617
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
618
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
619
|
-
type: z.ZodLiteral<"table">;
|
|
620
|
-
title: z.ZodOptional<z.ZodString>;
|
|
621
|
-
columns: z.ZodArray<z.ZodObject<{
|
|
622
|
-
key: z.ZodString;
|
|
623
|
-
label: z.ZodString;
|
|
624
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
625
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
626
|
-
key: z.ZodString;
|
|
627
|
-
label: z.ZodString;
|
|
628
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
629
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
630
|
-
key: z.ZodString;
|
|
631
|
-
label: z.ZodString;
|
|
632
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right", "center"]>>;
|
|
633
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
634
|
-
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
635
|
-
caption: z.ZodOptional<z.ZodString>;
|
|
636
|
-
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
637
|
-
type: z.ZodLiteral<"stat">;
|
|
638
|
-
title: z.ZodOptional<z.ZodString>;
|
|
639
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
640
|
-
label: z.ZodString;
|
|
641
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
642
|
-
change: z.ZodOptional<z.ZodString>;
|
|
643
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
644
|
-
description: z.ZodOptional<z.ZodString>;
|
|
645
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
646
|
-
label: z.ZodString;
|
|
647
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
648
|
-
change: z.ZodOptional<z.ZodString>;
|
|
649
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
650
|
-
description: z.ZodOptional<z.ZodString>;
|
|
651
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
652
|
-
label: z.ZodString;
|
|
653
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
654
|
-
change: z.ZodOptional<z.ZodString>;
|
|
655
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
656
|
-
description: z.ZodOptional<z.ZodString>;
|
|
657
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
658
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
659
|
-
type: z.ZodLiteral<"stat">;
|
|
660
|
-
title: z.ZodOptional<z.ZodString>;
|
|
661
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
662
|
-
label: z.ZodString;
|
|
663
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
664
|
-
change: z.ZodOptional<z.ZodString>;
|
|
665
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
666
|
-
description: z.ZodOptional<z.ZodString>;
|
|
667
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
668
|
-
label: z.ZodString;
|
|
669
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
670
|
-
change: z.ZodOptional<z.ZodString>;
|
|
671
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
672
|
-
description: z.ZodOptional<z.ZodString>;
|
|
673
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
674
|
-
label: z.ZodString;
|
|
675
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
676
|
-
change: z.ZodOptional<z.ZodString>;
|
|
677
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
678
|
-
description: z.ZodOptional<z.ZodString>;
|
|
679
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
680
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
681
|
-
type: z.ZodLiteral<"stat">;
|
|
682
|
-
title: z.ZodOptional<z.ZodString>;
|
|
683
|
-
stats: z.ZodArray<z.ZodObject<{
|
|
684
|
-
label: z.ZodString;
|
|
685
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
686
|
-
change: z.ZodOptional<z.ZodString>;
|
|
687
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
688
|
-
description: z.ZodOptional<z.ZodString>;
|
|
689
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
690
|
-
label: z.ZodString;
|
|
691
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
692
|
-
change: z.ZodOptional<z.ZodString>;
|
|
693
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
694
|
-
description: z.ZodOptional<z.ZodString>;
|
|
695
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
696
|
-
label: z.ZodString;
|
|
697
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
698
|
-
change: z.ZodOptional<z.ZodString>;
|
|
699
|
-
changeDirection: z.ZodOptional<z.ZodEnum<["positive", "negative", "neutral"]>>;
|
|
700
|
-
description: z.ZodOptional<z.ZodString>;
|
|
701
|
-
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
702
|
-
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
703
|
-
type: z.ZodLiteral<"card">;
|
|
704
|
-
title: z.ZodString;
|
|
705
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
706
|
-
body: z.ZodOptional<z.ZodString>;
|
|
707
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
708
|
-
label: z.ZodString;
|
|
709
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
710
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
711
|
-
}, "strip", z.ZodTypeAny, {
|
|
712
|
-
label: string;
|
|
713
|
-
value: string | number | boolean;
|
|
714
|
-
badge?: boolean | undefined;
|
|
715
|
-
}, {
|
|
716
|
-
label: string;
|
|
717
|
-
value: string | number | boolean;
|
|
718
|
-
badge?: boolean | undefined;
|
|
719
|
-
}>, "many">>;
|
|
720
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
721
|
-
label: z.ZodOptional<z.ZodString>;
|
|
722
|
-
text: z.ZodOptional<z.ZodString>;
|
|
723
|
-
url: z.ZodString;
|
|
724
|
-
}, "strip", z.ZodTypeAny, {
|
|
725
|
-
url: string;
|
|
726
|
-
label?: string | undefined;
|
|
727
|
-
text?: string | undefined;
|
|
728
|
-
}, {
|
|
729
|
-
url: string;
|
|
730
|
-
label?: string | undefined;
|
|
731
|
-
text?: string | undefined;
|
|
732
|
-
}>, {
|
|
733
|
-
label: string;
|
|
734
|
-
url: string;
|
|
735
|
-
text?: string | undefined;
|
|
736
|
-
}, {
|
|
737
|
-
url: string;
|
|
738
|
-
label?: string | undefined;
|
|
739
|
-
text?: string | undefined;
|
|
740
|
-
}>>;
|
|
741
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
742
|
-
type: z.ZodLiteral<"card">;
|
|
743
|
-
title: z.ZodString;
|
|
744
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
745
|
-
body: z.ZodOptional<z.ZodString>;
|
|
746
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
747
|
-
label: z.ZodString;
|
|
748
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
749
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
750
|
-
}, "strip", z.ZodTypeAny, {
|
|
751
|
-
label: string;
|
|
752
|
-
value: string | number | boolean;
|
|
753
|
-
badge?: boolean | undefined;
|
|
754
|
-
}, {
|
|
755
|
-
label: string;
|
|
756
|
-
value: string | number | boolean;
|
|
757
|
-
badge?: boolean | undefined;
|
|
758
|
-
}>, "many">>;
|
|
759
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
760
|
-
label: z.ZodOptional<z.ZodString>;
|
|
761
|
-
text: z.ZodOptional<z.ZodString>;
|
|
762
|
-
url: z.ZodString;
|
|
763
|
-
}, "strip", z.ZodTypeAny, {
|
|
764
|
-
url: string;
|
|
765
|
-
label?: string | undefined;
|
|
766
|
-
text?: string | undefined;
|
|
767
|
-
}, {
|
|
768
|
-
url: string;
|
|
769
|
-
label?: string | undefined;
|
|
770
|
-
text?: string | undefined;
|
|
771
|
-
}>, {
|
|
772
|
-
label: string;
|
|
773
|
-
url: string;
|
|
774
|
-
text?: string | undefined;
|
|
775
|
-
}, {
|
|
776
|
-
url: string;
|
|
777
|
-
label?: string | undefined;
|
|
778
|
-
text?: string | undefined;
|
|
779
|
-
}>>;
|
|
780
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
781
|
-
type: z.ZodLiteral<"card">;
|
|
782
|
-
title: z.ZodString;
|
|
783
|
-
subtitle: z.ZodOptional<z.ZodString>;
|
|
784
|
-
body: z.ZodOptional<z.ZodString>;
|
|
785
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
786
|
-
label: z.ZodString;
|
|
787
|
-
value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
788
|
-
badge: z.ZodOptional<z.ZodBoolean>;
|
|
789
|
-
}, "strip", z.ZodTypeAny, {
|
|
790
|
-
label: string;
|
|
791
|
-
value: string | number | boolean;
|
|
792
|
-
badge?: boolean | undefined;
|
|
793
|
-
}, {
|
|
794
|
-
label: string;
|
|
795
|
-
value: string | number | boolean;
|
|
796
|
-
badge?: boolean | undefined;
|
|
797
|
-
}>, "many">>;
|
|
798
|
-
cta: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
799
|
-
label: z.ZodOptional<z.ZodString>;
|
|
800
|
-
text: z.ZodOptional<z.ZodString>;
|
|
801
|
-
url: z.ZodString;
|
|
802
|
-
}, "strip", z.ZodTypeAny, {
|
|
803
|
-
url: string;
|
|
804
|
-
label?: string | undefined;
|
|
805
|
-
text?: string | undefined;
|
|
806
|
-
}, {
|
|
807
|
-
url: string;
|
|
808
|
-
label?: string | undefined;
|
|
809
|
-
text?: string | undefined;
|
|
810
|
-
}>, {
|
|
811
|
-
label: string;
|
|
812
|
-
url: string;
|
|
813
|
-
text?: string | undefined;
|
|
814
|
-
}, {
|
|
815
|
-
url: string;
|
|
816
|
-
label?: string | undefined;
|
|
817
|
-
text?: string | undefined;
|
|
818
|
-
}>>;
|
|
819
|
-
}, z.ZodTypeAny, "passthrough">>]>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
820
37
|
type HtmlPayload = z.infer<typeof HtmlPayloadSchema>;
|
|
821
|
-
type
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
/** Config for useGenerativeUI hook */
|
|
38
|
+
type GenerativeUIPayload = HtmlPayload;
|
|
39
|
+
/**
|
|
40
|
+
* Action handler called when the AI-generated iframe triggers
|
|
41
|
+
* `copilot.action(name, data)` via the bridge API.
|
|
42
|
+
*/
|
|
43
|
+
type GenUIActionHandler = (data: unknown) => unknown | Promise<unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* Config for the `useGenerativeUI` hook.
|
|
46
|
+
*/
|
|
831
47
|
interface UseGenerativeUIConfig {
|
|
832
48
|
/**
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*/
|
|
836
|
-
name?: string;
|
|
837
|
-
/**
|
|
838
|
-
* Renderer for chart payloads. The SDK does not bundle a chart library.
|
|
839
|
-
* Pass your own Recharts / Chart.js / Victory component here.
|
|
840
|
-
* If omitted, chart results show a JSON data fallback.
|
|
49
|
+
* Custom actions available inside the iframe.
|
|
50
|
+
* The AI can call these via `copilot.action('name', data)` in onclick handlers.
|
|
841
51
|
*
|
|
842
52
|
* @example
|
|
843
53
|
* ```tsx
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* )
|
|
54
|
+
* useGenerativeUI({
|
|
55
|
+
* actions: {
|
|
56
|
+
* addToCart: (data) => cartStore.add(data.itemId),
|
|
57
|
+
* navigate: (data) => router.push(data.url),
|
|
58
|
+
* },
|
|
59
|
+
* })
|
|
847
60
|
* ```
|
|
848
61
|
*/
|
|
849
|
-
|
|
62
|
+
actions?: Record<string, GenUIActionHandler>;
|
|
850
63
|
/**
|
|
851
|
-
*
|
|
852
|
-
*
|
|
64
|
+
* Max width of the iframe (CSS value).
|
|
65
|
+
* @default undefined (takes full available width)
|
|
853
66
|
*/
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
67
|
+
maxWidth?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A processed message that may contain a `<GENUI>` block.
|
|
71
|
+
*/
|
|
72
|
+
interface GenUIMessage {
|
|
73
|
+
id: string;
|
|
74
|
+
role: string;
|
|
75
|
+
content: string | null;
|
|
76
|
+
_genui?: {
|
|
77
|
+
html: string;
|
|
78
|
+
streaming: boolean;
|
|
79
|
+
textBefore: string;
|
|
80
|
+
textAfter: string;
|
|
81
|
+
};
|
|
82
|
+
[key: string]: unknown;
|
|
869
83
|
}
|
|
870
84
|
|
|
871
85
|
/**
|
|
872
|
-
*
|
|
86
|
+
* Hook that enables generative UI rendering in CopilotChat.
|
|
873
87
|
*
|
|
874
|
-
*
|
|
875
|
-
*
|
|
88
|
+
* Detects `<GENUI>...</GENUI>` blocks in assistant messages and
|
|
89
|
+
* renders them as interactive HTML in sandboxed iframes with
|
|
90
|
+
* Tailwind CSS and Chart.js.
|
|
91
|
+
*
|
|
92
|
+
* Returns a `wrapMessage` function to pass to `<CopilotChat>`.
|
|
876
93
|
*
|
|
877
94
|
* @example
|
|
878
95
|
* ```tsx
|
|
879
96
|
* import { useGenerativeUI } from "@yourgpt/copilot-sdk/experimental";
|
|
880
97
|
*
|
|
881
98
|
* function App() {
|
|
882
|
-
* useGenerativeUI(
|
|
883
|
-
*
|
|
884
|
-
* <BarChart labels={payload.labels} datasets={payload.datasets} />
|
|
885
|
-
* ),
|
|
886
|
-
* });
|
|
887
|
-
* return <CopilotChat />;
|
|
99
|
+
* const { wrapMessage } = useGenerativeUI();
|
|
100
|
+
* return <CopilotChat wrapMessage={wrapMessage} />;
|
|
888
101
|
* }
|
|
889
102
|
* ```
|
|
890
103
|
*
|
|
104
|
+
* @example With actions (interactive iframe → parent communication)
|
|
105
|
+
* ```tsx
|
|
106
|
+
* const { wrapMessage } = useGenerativeUI({
|
|
107
|
+
* actions: {
|
|
108
|
+
* addToCart: (data) => cartStore.add(data.itemId),
|
|
109
|
+
* navigate: (data) => router.push(data.url),
|
|
110
|
+
* },
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
891
114
|
* @experimental This API may change without a semver major bump.
|
|
892
115
|
*/
|
|
893
|
-
declare function useGenerativeUI(config?: UseGenerativeUIConfig):
|
|
116
|
+
declare function useGenerativeUI(config?: UseGenerativeUIConfig): {
|
|
117
|
+
wrapMessage: (content: React.ReactNode, message: {
|
|
118
|
+
id: string;
|
|
119
|
+
role: string;
|
|
120
|
+
}) => React.ReactNode;
|
|
121
|
+
};
|
|
894
122
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Options for generating the generative UI system prompt.
|
|
125
|
+
*/
|
|
126
|
+
interface GenerativeUIPromptOptions {
|
|
127
|
+
/**
|
|
128
|
+
* Custom actions available inside the iframe via `copilot.action(name, data)`.
|
|
129
|
+
* Keys are action names, values are descriptions for the AI.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* generativeUISystemPrompt({
|
|
134
|
+
* actions: {
|
|
135
|
+
* addToCart: "Add an item to the shopping cart. Params: { itemId: string, qty: number }",
|
|
136
|
+
* navigate: "Navigate to a URL. Params: { url: string }",
|
|
137
|
+
* }
|
|
138
|
+
* })
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
actions?: Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Additional design guidelines appended to the prompt.
|
|
144
|
+
*/
|
|
145
|
+
designGuidelines?: string;
|
|
898
146
|
}
|
|
899
147
|
/**
|
|
900
|
-
*
|
|
901
|
-
*
|
|
902
|
-
*
|
|
148
|
+
* Returns a system prompt string that instructs the LLM to generate
|
|
149
|
+
* rich HTML UI wrapped in `<GENUI>` tags.
|
|
150
|
+
*
|
|
151
|
+
* The generated HTML renders in a sandboxed iframe with Tailwind CSS
|
|
152
|
+
* and Chart.js pre-loaded.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* import { generativeUISystemPrompt } from "@yourgpt/copilot-sdk/experimental";
|
|
157
|
+
*
|
|
158
|
+
* const runtime = createRuntime({
|
|
159
|
+
* systemPrompt: `You are a helpful assistant. ${generativeUISystemPrompt()}`,
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* @experimental
|
|
903
164
|
*/
|
|
904
|
-
declare function
|
|
165
|
+
declare function generativeUISystemPrompt(options?: GenerativeUIPromptOptions): string;
|
|
905
166
|
|
|
906
|
-
interface
|
|
907
|
-
|
|
167
|
+
interface GenUIFrameProps {
|
|
168
|
+
/** HTML content to render inside the iframe */
|
|
169
|
+
html: string;
|
|
170
|
+
/** Whether the content is still streaming (defers scripts, strips last incomplete line) */
|
|
171
|
+
streaming?: boolean;
|
|
172
|
+
/** CSS class applied to the iframe */
|
|
908
173
|
className?: string;
|
|
174
|
+
/** Max width of the iframe (default: none) */
|
|
175
|
+
maxWidth?: string;
|
|
176
|
+
/** Theme CSS variables to inject into the iframe (e.g. from getComputedStyle(document.documentElement)) */
|
|
177
|
+
themeVars?: Record<string, string>;
|
|
178
|
+
/** Callback when a copilot.sendMessage() is called from inside the iframe */
|
|
179
|
+
onSendMessage?: (message: string) => void;
|
|
180
|
+
/** Callback when a copilot.action() is called from inside the iframe */
|
|
181
|
+
onAction?: (name: string, data: unknown) => unknown | Promise<unknown>;
|
|
909
182
|
}
|
|
910
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Sandboxed iframe renderer for AI-generated HTML.
|
|
185
|
+
*
|
|
186
|
+
* Features:
|
|
187
|
+
* - Static shell loaded once (Tailwind CSS + Chart.js CDN)
|
|
188
|
+
* - Content pushed via postMessage (no iframe reloads on update)
|
|
189
|
+
* - Auto-height via ResizeObserver
|
|
190
|
+
* - Unique frame ID prevents cross-iframe interference
|
|
191
|
+
* - Scripts deferred during streaming, executed on completion
|
|
192
|
+
* - Theme vars injected via postMessage (not baked into srcDoc)
|
|
193
|
+
* - `window.copilot` bridge for iframe → parent communication
|
|
194
|
+
*
|
|
195
|
+
* @experimental
|
|
196
|
+
*/
|
|
197
|
+
declare function GenUIFrame({ html, streaming, className, maxWidth, themeVars, onSendMessage, onAction, }: GenUIFrameProps): react_jsx_runtime.JSX.Element;
|
|
911
198
|
|
|
912
|
-
interface
|
|
913
|
-
|
|
914
|
-
|
|
199
|
+
interface GenerativeUIToolConfig {
|
|
200
|
+
/**
|
|
201
|
+
* Override the default LLM description.
|
|
202
|
+
*/
|
|
203
|
+
description?: string;
|
|
915
204
|
}
|
|
916
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Returns a tool definition compatible with `streamText` for use in your backend route.
|
|
207
|
+
*
|
|
208
|
+
* Pass the returned object as a value in the `tools` map of `streamText`.
|
|
209
|
+
* The key you use becomes the tool name — use the same name in `useGenerativeUI({ name })` on the frontend.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* import { streamText } from "@yourgpt/llm-sdk";
|
|
214
|
+
* import { generativeUITool } from "@yourgpt/copilot-sdk/experimental";
|
|
215
|
+
*
|
|
216
|
+
* const result = await streamText({
|
|
217
|
+
* model: openai("gpt-4o"),
|
|
218
|
+
* messages,
|
|
219
|
+
* tools: {
|
|
220
|
+
* render_ui: generativeUITool(),
|
|
221
|
+
* // ...your other tools
|
|
222
|
+
* },
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function generativeUITool(config?: GenerativeUIToolConfig): {
|
|
227
|
+
description: string;
|
|
228
|
+
parameters: {
|
|
229
|
+
type: "object";
|
|
230
|
+
properties: {
|
|
231
|
+
html: {
|
|
232
|
+
type: "string";
|
|
233
|
+
description: string;
|
|
234
|
+
};
|
|
235
|
+
title: {
|
|
236
|
+
type: "string";
|
|
237
|
+
description: string;
|
|
238
|
+
};
|
|
239
|
+
height: {
|
|
240
|
+
type: "string";
|
|
241
|
+
description: string;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
required: string[];
|
|
245
|
+
};
|
|
246
|
+
};
|
|
917
247
|
|
|
918
|
-
interface
|
|
919
|
-
payload:
|
|
248
|
+
interface HtmlRendererProps {
|
|
249
|
+
payload: HtmlPayload;
|
|
920
250
|
className?: string;
|
|
251
|
+
/** When true, defers script execution and strips the last incomplete line */
|
|
252
|
+
streaming?: boolean;
|
|
921
253
|
}
|
|
922
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Renders AI-generated HTML inside an isolated iframe.
|
|
256
|
+
* Uses srcdoc for simplicity and reliability.
|
|
257
|
+
*/
|
|
258
|
+
declare function HtmlRenderer({ payload, className, streaming, }: HtmlRendererProps): react_jsx_runtime.JSX.Element;
|
|
923
259
|
|
|
924
|
-
export { type
|
|
260
|
+
export { type GenUIActionHandler, GenUIFrame, type GenUIFrameProps, type GenUIMessage, type GenerativeUIPayload, GenerativeUIPayloadSchema, type GenerativeUIPromptOptions, type GenerativeUIToolConfig, type HtmlPayload, HtmlPayloadSchema, HtmlRenderer, type UseGenerativeUIConfig, generativeUISystemPrompt, generativeUITool, useGenerativeUI };
|