@copilotkit/shared 2.0.0-rc.14 → 2.0.0-rc.16
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/a2ui-envelope.cjs +2 -2
- package/dist/a2ui-envelope.cjs.map +1 -1
- package/dist/a2ui-envelope.d.cts +1 -1
- package/dist/a2ui-envelope.d.cts.map +1 -1
- package/dist/a2ui-envelope.d.mts +1 -1
- package/dist/a2ui-envelope.d.mts.map +1 -1
- package/dist/a2ui-envelope.mjs +2 -2
- package/dist/a2ui-envelope.mjs.map +1 -1
- package/dist/generative-ui/child-refs.cjs +3 -3
- package/dist/generative-ui/child-refs.cjs.map +1 -1
- package/dist/generative-ui/child-refs.d.cts.map +1 -1
- package/dist/generative-ui/child-refs.d.mts.map +1 -1
- package/dist/generative-ui/child-refs.mjs +3 -3
- package/dist/generative-ui/child-refs.mjs.map +1 -1
- package/dist/generative-ui/prompt-spec.cjs +11 -11
- package/dist/generative-ui/prompt-spec.cjs.map +1 -1
- package/dist/generative-ui/prompt-spec.mjs +11 -11
- package/dist/generative-ui/prompt-spec.mjs.map +1 -1
- package/dist/generative-ui/prompt.cjs +1 -1
- package/dist/generative-ui/prompt.cjs.map +1 -1
- package/dist/generative-ui/prompt.mjs +1 -1
- package/dist/generative-ui/prompt.mjs.map +1 -1
- package/dist/generative-ui/schema-render.cjs +1 -1
- package/dist/generative-ui/schema-render.cjs.map +1 -1
- package/dist/generative-ui/schema-render.d.cts.map +1 -1
- package/dist/generative-ui/schema-render.d.mts.map +1 -1
- package/dist/generative-ui/schema-render.mjs +1 -1
- package/dist/generative-ui/schema-render.mjs.map +1 -1
- package/dist/generative-ui/types.cjs +2 -2
- package/dist/generative-ui/types.cjs.map +1 -1
- package/dist/generative-ui/types.d.cts +7 -7
- package/dist/generative-ui/types.d.cts.map +1 -1
- package/dist/generative-ui/types.d.mts +7 -7
- package/dist/generative-ui/types.d.mts.map +1 -1
- package/dist/generative-ui/types.mjs +2 -2
- package/dist/generative-ui/types.mjs.map +1 -1
- package/dist/generative-ui/validate-operation.cjs +2 -2
- package/dist/generative-ui/validate-operation.cjs.map +1 -1
- package/dist/generative-ui/validate-operation.mjs +2 -2
- package/dist/generative-ui/validate-operation.mjs.map +1 -1
- package/dist/index.umd.js +24 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/telemetry/lambda-client.cjs +1 -1
- package/dist/telemetry/lambda-client.cjs.map +1 -1
- package/dist/telemetry/lambda-client.d.cts.map +1 -1
- package/dist/telemetry/lambda-client.d.mts.map +1 -1
- package/dist/telemetry/lambda-client.mjs +1 -1
- package/dist/telemetry/lambda-client.mjs.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/a2ui-envelope.test.ts +18 -13
- package/src/__tests__/a2ui-prompts.test.ts +5 -5
- package/src/__tests__/fixtures/prompt-goldens.json +64 -64
- package/src/a2ui-envelope.ts +7 -6
- package/src/generative-ui/__tests__/render-ui-args.test.ts +7 -7
- package/src/generative-ui/__tests__/validate-operation.test.ts +19 -13
- package/src/generative-ui/child-refs.ts +5 -4
- package/src/generative-ui/prompt-spec.ts +11 -11
- package/src/generative-ui/prompt.ts +1 -1
- package/src/generative-ui/schema-render.ts +4 -1
- package/src/generative-ui/types.ts +10 -7
- package/src/generative-ui/validate-operation.ts +2 -2
- package/src/telemetry/lambda-client.ts +5 -1
- package/tsconfig.json +3 -1
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"checks": false,
|
|
8
8
|
"surfaces": false
|
|
9
9
|
},
|
|
10
|
-
"markdown": "
|
|
11
|
-
"tool": "
|
|
10
|
+
"markdown": "265596cd69dac2877242fb6f9412509a63c325d1729424c6ed108f127ad38380",
|
|
11
|
+
"tool": "2831f893c748050be0c9286ac52c5edd2758d3375d8b0e22fb27631d5d7c6153"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"flags": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"checks": false,
|
|
19
19
|
"surfaces": false
|
|
20
20
|
},
|
|
21
|
-
"markdown": "
|
|
22
|
-
"tool": "
|
|
21
|
+
"markdown": "265596cd69dac2877242fb6f9412509a63c325d1729424c6ed108f127ad38380",
|
|
22
|
+
"tool": "428bc6098febce22a187932f45bcb8e04da425904166285f8c3f038b6359ec27"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"flags": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"checks": false,
|
|
30
30
|
"surfaces": false
|
|
31
31
|
},
|
|
32
|
-
"markdown": "
|
|
33
|
-
"tool": "
|
|
32
|
+
"markdown": "8089a3aac3acb22f5d6cb7320465a9ca2c79d256dd98a4011cda968a72123407",
|
|
33
|
+
"tool": "55f1755e703874aade63bef55f0a66bf4652a151b722f354d98cccc814a79b26"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"flags": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"checks": false,
|
|
41
41
|
"surfaces": false
|
|
42
42
|
},
|
|
43
|
-
"markdown": "
|
|
44
|
-
"tool": "
|
|
43
|
+
"markdown": "ce392c2acc9ba13c92397ed3735b60b1296d7f2a09df1e979d50fe26c638ef23",
|
|
44
|
+
"tool": "daa208dec7887a3dd39a532c1ebbb031f7073d3fb52eb6fd65ea30bfb47205a2"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"flags": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"checks": false,
|
|
52
52
|
"surfaces": false
|
|
53
53
|
},
|
|
54
|
-
"markdown": "
|
|
55
|
-
"tool": "
|
|
54
|
+
"markdown": "f4e49df0b7e100ac9c26994f57b4c4affe63415f1c9c609e91f9dd74f8f7a6d4",
|
|
55
|
+
"tool": "b8c611514da84eb3ffc264fe8eea91d2525499fd2f0e75e239d605bba365ea71"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"flags": {
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"checks": false,
|
|
63
63
|
"surfaces": false
|
|
64
64
|
},
|
|
65
|
-
"markdown": "
|
|
66
|
-
"tool": "
|
|
65
|
+
"markdown": "f4e49df0b7e100ac9c26994f57b4c4affe63415f1c9c609e91f9dd74f8f7a6d4",
|
|
66
|
+
"tool": "76370c17a5cdba4f880a032d55a162138ba9daf549e8896ab22b267e08dfd499"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"flags": {
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"checks": false,
|
|
74
74
|
"surfaces": false
|
|
75
75
|
},
|
|
76
|
-
"markdown": "
|
|
77
|
-
"tool": "
|
|
76
|
+
"markdown": "5e7a0c80e08617730119cbaeb60340bf773faa2085f74d37608395b454e7b105",
|
|
77
|
+
"tool": "47ff29d2eaa301f3e0c80ae7c267a16184bf391666dae361d68cda5bdf29e7a4"
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"flags": {
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"checks": false,
|
|
85
85
|
"surfaces": false
|
|
86
86
|
},
|
|
87
|
-
"markdown": "
|
|
88
|
-
"tool": "
|
|
87
|
+
"markdown": "dda6b56c079a787437c241dc698280ab6fd53f9ec8a7c14a0c91e9cdc642466b",
|
|
88
|
+
"tool": "cd6ceb69c8ae9be058338c8f9a634e50eecf6fecff195336862cf44907b42109"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"flags": {
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"checks": true,
|
|
96
96
|
"surfaces": false
|
|
97
97
|
},
|
|
98
|
-
"markdown": "
|
|
99
|
-
"tool": "
|
|
98
|
+
"markdown": "c9540725953d422a450f55d998a73115fdc5709881680f17c98654770236e450",
|
|
99
|
+
"tool": "cf1c7f8603b8bd3227154ee523540aef8f70129d6d99480411e0992c90c92c82"
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"flags": {
|
|
@@ -106,8 +106,8 @@
|
|
|
106
106
|
"checks": true,
|
|
107
107
|
"surfaces": false
|
|
108
108
|
},
|
|
109
|
-
"markdown": "
|
|
110
|
-
"tool": "
|
|
109
|
+
"markdown": "c9540725953d422a450f55d998a73115fdc5709881680f17c98654770236e450",
|
|
110
|
+
"tool": "ca0ad9a17c5e6e7b7b0b4b3dbe6abd752de568ed626ca638a8921a97d168a577"
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
113
|
"flags": {
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"checks": true,
|
|
118
118
|
"surfaces": false
|
|
119
119
|
},
|
|
120
|
-
"markdown": "
|
|
121
|
-
"tool": "
|
|
120
|
+
"markdown": "94c31a6d083321f352018d861a31e3e6a1db85ac3ee32d53776f9e2e334663e6",
|
|
121
|
+
"tool": "d47ae391ca59acf7ec38f135a9c3c050cadb50f06c9fa4d86161d3e1be1af6f8"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"flags": {
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"checks": true,
|
|
129
129
|
"surfaces": false
|
|
130
130
|
},
|
|
131
|
-
"markdown": "
|
|
132
|
-
"tool": "
|
|
131
|
+
"markdown": "de8e220f6dadcb090ac7deeeab0595dbb6aaff019ffea0c9487c03e5104b1dee",
|
|
132
|
+
"tool": "9bb7c1e3f8a307b3eae12ff643f69087f250d50b8e2dd9958d4d238fb0122a17"
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
"flags": {
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"checks": true,
|
|
140
140
|
"surfaces": false
|
|
141
141
|
},
|
|
142
|
-
"markdown": "
|
|
143
|
-
"tool": "
|
|
142
|
+
"markdown": "ac475fb084ed732561bb88416af3966599692e278c4a511cd8726278db6344f0",
|
|
143
|
+
"tool": "56a6232073f31385f9f1f8b4713598ef9444fc4d1f4bb8a0ed781404d96ce03b"
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"flags": {
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
"checks": true,
|
|
151
151
|
"surfaces": false
|
|
152
152
|
},
|
|
153
|
-
"markdown": "
|
|
154
|
-
"tool": "
|
|
153
|
+
"markdown": "ac475fb084ed732561bb88416af3966599692e278c4a511cd8726278db6344f0",
|
|
154
|
+
"tool": "fddd878904428818a5e81266048bb03e49bdb12623c3238325b018a71a45a9f4"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
"flags": {
|
|
@@ -161,8 +161,8 @@
|
|
|
161
161
|
"checks": true,
|
|
162
162
|
"surfaces": false
|
|
163
163
|
},
|
|
164
|
-
"markdown": "
|
|
165
|
-
"tool": "
|
|
164
|
+
"markdown": "a3dada266648564dacf6286bd7dddc6efbf321b3ead4be50061faeaf3b6cfe13",
|
|
165
|
+
"tool": "993d46f71cacf10b13b615048bbf8e4c856303d82db87b17c70a8dd6439e9b80"
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
168
|
"flags": {
|
|
@@ -172,8 +172,8 @@
|
|
|
172
172
|
"checks": true,
|
|
173
173
|
"surfaces": false
|
|
174
174
|
},
|
|
175
|
-
"markdown": "
|
|
176
|
-
"tool": "
|
|
175
|
+
"markdown": "8aedaae7606007869f5530e5a0378f8143c371c103cb557c459a174bf5b1ff0d",
|
|
176
|
+
"tool": "c4b5e660ff7f9ad59b38d3410c234fb424b4fbc36a7e8999c42f31614193fc77"
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
"flags": {
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
"checks": false,
|
|
184
184
|
"surfaces": true
|
|
185
185
|
},
|
|
186
|
-
"markdown": "
|
|
187
|
-
"tool": "
|
|
186
|
+
"markdown": "265596cd69dac2877242fb6f9412509a63c325d1729424c6ed108f127ad38380",
|
|
187
|
+
"tool": "99a6ab165b6eadf8b18a925de922d119e550a3f7b8f75b98536f6424f660a326"
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
"flags": {
|
|
@@ -194,8 +194,8 @@
|
|
|
194
194
|
"checks": false,
|
|
195
195
|
"surfaces": true
|
|
196
196
|
},
|
|
197
|
-
"markdown": "
|
|
198
|
-
"tool": "
|
|
197
|
+
"markdown": "265596cd69dac2877242fb6f9412509a63c325d1729424c6ed108f127ad38380",
|
|
198
|
+
"tool": "7f6acd8deadd6ecda655d41d02699a8c80b59513fac5c1dad8d2bb2f0343c26c"
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
"flags": {
|
|
@@ -205,8 +205,8 @@
|
|
|
205
205
|
"checks": false,
|
|
206
206
|
"surfaces": true
|
|
207
207
|
},
|
|
208
|
-
"markdown": "
|
|
209
|
-
"tool": "
|
|
208
|
+
"markdown": "8089a3aac3acb22f5d6cb7320465a9ca2c79d256dd98a4011cda968a72123407",
|
|
209
|
+
"tool": "0c241ec3391e2fd2c5b3df4477e7ffe9b4f7313854bb00e196c4a35d956be3f3"
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
"flags": {
|
|
@@ -216,8 +216,8 @@
|
|
|
216
216
|
"checks": false,
|
|
217
217
|
"surfaces": true
|
|
218
218
|
},
|
|
219
|
-
"markdown": "
|
|
220
|
-
"tool": "
|
|
219
|
+
"markdown": "ce392c2acc9ba13c92397ed3735b60b1296d7f2a09df1e979d50fe26c638ef23",
|
|
220
|
+
"tool": "8e1a94fbf67daf280f6ac722ccc62075598911e39e55fd5a113646e4c6ec7fc6"
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
223
|
"flags": {
|
|
@@ -227,8 +227,8 @@
|
|
|
227
227
|
"checks": false,
|
|
228
228
|
"surfaces": true
|
|
229
229
|
},
|
|
230
|
-
"markdown": "
|
|
231
|
-
"tool": "
|
|
230
|
+
"markdown": "f4e49df0b7e100ac9c26994f57b4c4affe63415f1c9c609e91f9dd74f8f7a6d4",
|
|
231
|
+
"tool": "45e9a5a47567f2c0fff0640c3646e498f0ec8068095394a55463f845bb996193"
|
|
232
232
|
},
|
|
233
233
|
{
|
|
234
234
|
"flags": {
|
|
@@ -238,8 +238,8 @@
|
|
|
238
238
|
"checks": false,
|
|
239
239
|
"surfaces": true
|
|
240
240
|
},
|
|
241
|
-
"markdown": "
|
|
242
|
-
"tool": "
|
|
241
|
+
"markdown": "f4e49df0b7e100ac9c26994f57b4c4affe63415f1c9c609e91f9dd74f8f7a6d4",
|
|
242
|
+
"tool": "f40514ab61be567c4a6f2f5b61e934d1779e3323477ce0aa868f3f3a66f1585c"
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
"flags": {
|
|
@@ -249,8 +249,8 @@
|
|
|
249
249
|
"checks": false,
|
|
250
250
|
"surfaces": true
|
|
251
251
|
},
|
|
252
|
-
"markdown": "
|
|
253
|
-
"tool": "
|
|
252
|
+
"markdown": "5e7a0c80e08617730119cbaeb60340bf773faa2085f74d37608395b454e7b105",
|
|
253
|
+
"tool": "effee9743233f14583977f93b00133ff1fce48835e25d61f91af5113a480fd11"
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
256
|
"flags": {
|
|
@@ -260,8 +260,8 @@
|
|
|
260
260
|
"checks": false,
|
|
261
261
|
"surfaces": true
|
|
262
262
|
},
|
|
263
|
-
"markdown": "
|
|
264
|
-
"tool": "
|
|
263
|
+
"markdown": "dda6b56c079a787437c241dc698280ab6fd53f9ec8a7c14a0c91e9cdc642466b",
|
|
264
|
+
"tool": "9a36d1f42b83cfa3cb5beadb130f1b3c3555098304570c0aaa133e8130ad52ea"
|
|
265
265
|
},
|
|
266
266
|
{
|
|
267
267
|
"flags": {
|
|
@@ -271,8 +271,8 @@
|
|
|
271
271
|
"checks": true,
|
|
272
272
|
"surfaces": true
|
|
273
273
|
},
|
|
274
|
-
"markdown": "
|
|
275
|
-
"tool": "
|
|
274
|
+
"markdown": "c9540725953d422a450f55d998a73115fdc5709881680f17c98654770236e450",
|
|
275
|
+
"tool": "eb5246d342a50810de921927f3e5be58a5ecac008b8e0750c5a6cfe2037a3b28"
|
|
276
276
|
},
|
|
277
277
|
{
|
|
278
278
|
"flags": {
|
|
@@ -282,8 +282,8 @@
|
|
|
282
282
|
"checks": true,
|
|
283
283
|
"surfaces": true
|
|
284
284
|
},
|
|
285
|
-
"markdown": "
|
|
286
|
-
"tool": "
|
|
285
|
+
"markdown": "c9540725953d422a450f55d998a73115fdc5709881680f17c98654770236e450",
|
|
286
|
+
"tool": "a79bd017703e7623301e33a8c33f26346e86752e7dec59344226de004ae385c5"
|
|
287
287
|
},
|
|
288
288
|
{
|
|
289
289
|
"flags": {
|
|
@@ -293,8 +293,8 @@
|
|
|
293
293
|
"checks": true,
|
|
294
294
|
"surfaces": true
|
|
295
295
|
},
|
|
296
|
-
"markdown": "
|
|
297
|
-
"tool": "
|
|
296
|
+
"markdown": "94c31a6d083321f352018d861a31e3e6a1db85ac3ee32d53776f9e2e334663e6",
|
|
297
|
+
"tool": "a4fe3c2f2326987ba63c8f4341b0bc100057cce07392f7930f47428b493cdd87"
|
|
298
298
|
},
|
|
299
299
|
{
|
|
300
300
|
"flags": {
|
|
@@ -304,8 +304,8 @@
|
|
|
304
304
|
"checks": true,
|
|
305
305
|
"surfaces": true
|
|
306
306
|
},
|
|
307
|
-
"markdown": "
|
|
308
|
-
"tool": "
|
|
307
|
+
"markdown": "de8e220f6dadcb090ac7deeeab0595dbb6aaff019ffea0c9487c03e5104b1dee",
|
|
308
|
+
"tool": "39ee92edc486d09a15ec1860f18b2349c170b4d010233afc6607b214373b32b5"
|
|
309
309
|
},
|
|
310
310
|
{
|
|
311
311
|
"flags": {
|
|
@@ -315,8 +315,8 @@
|
|
|
315
315
|
"checks": true,
|
|
316
316
|
"surfaces": true
|
|
317
317
|
},
|
|
318
|
-
"markdown": "
|
|
319
|
-
"tool": "
|
|
318
|
+
"markdown": "ac475fb084ed732561bb88416af3966599692e278c4a511cd8726278db6344f0",
|
|
319
|
+
"tool": "f215277ed2b79d86d1ad3aa9bb040c41812741ba00a5c357fd226031a083b7aa"
|
|
320
320
|
},
|
|
321
321
|
{
|
|
322
322
|
"flags": {
|
|
@@ -326,8 +326,8 @@
|
|
|
326
326
|
"checks": true,
|
|
327
327
|
"surfaces": true
|
|
328
328
|
},
|
|
329
|
-
"markdown": "
|
|
330
|
-
"tool": "
|
|
329
|
+
"markdown": "ac475fb084ed732561bb88416af3966599692e278c4a511cd8726278db6344f0",
|
|
330
|
+
"tool": "55f7a37ae48f2c5b7ead10a407f015b398ad866912f0d3b8a1c9da74a27730ae"
|
|
331
331
|
},
|
|
332
332
|
{
|
|
333
333
|
"flags": {
|
|
@@ -337,8 +337,8 @@
|
|
|
337
337
|
"checks": true,
|
|
338
338
|
"surfaces": true
|
|
339
339
|
},
|
|
340
|
-
"markdown": "
|
|
341
|
-
"tool": "
|
|
340
|
+
"markdown": "a3dada266648564dacf6286bd7dddc6efbf321b3ead4be50061faeaf3b6cfe13",
|
|
341
|
+
"tool": "541ad9d56614d3f611f6dc0873ec87e61abb499405e50bac0bd03af3263ba035"
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
"flags": {
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
"checks": true,
|
|
349
349
|
"surfaces": true
|
|
350
350
|
},
|
|
351
|
-
"markdown": "
|
|
352
|
-
"tool": "
|
|
351
|
+
"markdown": "8aedaae7606007869f5530e5a0378f8143c371c103cb557c459a174bf5b1ff0d",
|
|
352
|
+
"tool": "8ac027462d8448d3286401e9d520dad6b8d18c8c95912fd1baf7767fbca2ae1d"
|
|
353
353
|
}
|
|
354
354
|
]
|
package/src/a2ui-envelope.ts
CHANGED
|
@@ -29,7 +29,7 @@ export const COPILOTKIT_UI_ENVELOPE_FORMAT = 3;
|
|
|
29
29
|
/** What the client renders and calls, and how the model must write UI. */
|
|
30
30
|
export interface CopilotKitUIEnvelope {
|
|
31
31
|
/** The A2UI v1.0 renderer capabilities. */
|
|
32
|
-
"
|
|
32
|
+
"1.0": {
|
|
33
33
|
/**
|
|
34
34
|
* The catalog that the client renders comes first, then the catalogs of
|
|
35
35
|
* its `extends`. An operation can name any of them.
|
|
@@ -66,7 +66,7 @@ export interface CopilotKitUIEnvelope {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
type InlineCatalog = NonNullable<
|
|
69
|
-
CopilotKitUIEnvelope["
|
|
69
|
+
CopilotKitUIEnvelope["1.0"]["inlineCatalogs"]
|
|
70
70
|
>[number];
|
|
71
71
|
type Extensions = CopilotKitUIEnvelope["metadata"]["extensions"];
|
|
72
72
|
|
|
@@ -149,7 +149,7 @@ function isInlineCatalog(value: unknown): value is InlineCatalog {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
function isCapabilities(value: unknown): value is CopilotKitUIEnvelope["
|
|
152
|
+
function isCapabilities(value: unknown): value is CopilotKitUIEnvelope["1.0"] {
|
|
153
153
|
return (
|
|
154
154
|
isRecord(value) &&
|
|
155
155
|
Array.isArray(value.supportedCatalogIds) &&
|
|
@@ -222,7 +222,7 @@ function isExtensions(value: unknown): value is Extensions {
|
|
|
222
222
|
function isEnvelope(value: unknown): value is CopilotKitUIEnvelope {
|
|
223
223
|
return (
|
|
224
224
|
isRecord(value) &&
|
|
225
|
-
isCapabilities(value["
|
|
225
|
+
isCapabilities(value["1.0"]) &&
|
|
226
226
|
isRecord(value.metadata) &&
|
|
227
227
|
isExtensions(value.metadata.extensions)
|
|
228
228
|
);
|
|
@@ -282,8 +282,9 @@ export function readCopilotKitUIEnvelope(forwardedProps: unknown) {
|
|
|
282
282
|
* ```
|
|
283
283
|
*/
|
|
284
284
|
export function envelopeToManifest(envelope: CopilotKitUIEnvelope) {
|
|
285
|
-
const { supportedCatalogIds, inlineCatalogs } = envelope["
|
|
286
|
-
|
|
285
|
+
const { supportedCatalogIds, inlineCatalogs } = envelope["1.0"];
|
|
286
|
+
// `readCopilotKitUIEnvelope` only accepts a non-empty `supportedCatalogIds`.
|
|
287
|
+
const catalogId = supportedCatalogIds[0]!;
|
|
287
288
|
const catalog = inlineCatalogs?.find(
|
|
288
289
|
(entry) => entry.catalogId === catalogId,
|
|
289
290
|
);
|
|
@@ -2,11 +2,11 @@ import { describe, expect, it } from "vitest";
|
|
|
2
2
|
import { RenderUIArgsStream, extractRenderUIArgs } from "../render-ui-args";
|
|
3
3
|
|
|
4
4
|
const opA = {
|
|
5
|
-
version: "
|
|
5
|
+
version: "1.0",
|
|
6
6
|
createSurface: { surfaceId: "s" },
|
|
7
7
|
};
|
|
8
8
|
const opB = {
|
|
9
|
-
version: "
|
|
9
|
+
version: "1.0",
|
|
10
10
|
updateComponents: {
|
|
11
11
|
surfaceId: "s",
|
|
12
12
|
components: [
|
|
@@ -20,12 +20,12 @@ const opB = {
|
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
const opC = {
|
|
23
|
-
version: "
|
|
23
|
+
version: "1.0",
|
|
24
24
|
updateDataModel: { surfaceId: "s", path: "/a", value: [1, { b: "]" }] },
|
|
25
25
|
};
|
|
26
26
|
/** One createSurface with the data model and the root inline. */
|
|
27
27
|
const inlineCreate = {
|
|
28
|
-
version: "
|
|
28
|
+
version: "1.0",
|
|
29
29
|
createSurface: {
|
|
30
30
|
surfaceId: "plan",
|
|
31
31
|
dataModel: { seats: 10, plans: [{ name: "Team" }] },
|
|
@@ -40,7 +40,7 @@ const inlineCreate = {
|
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
const functionCall = {
|
|
43
|
-
version: "
|
|
43
|
+
version: "1.0",
|
|
44
44
|
callRendererFunction: {
|
|
45
45
|
functionCallId: "f1",
|
|
46
46
|
callFunction: { "@call": "addToCart", args: { productId: "p{1}" } },
|
|
@@ -75,7 +75,7 @@ describe("extractRenderUIArgs", () => {
|
|
|
75
75
|
|
|
76
76
|
it("returns null for a balanced element that is not valid JSON", () => {
|
|
77
77
|
const text =
|
|
78
|
-
'{"target":"chat","operations":[{"version":"
|
|
78
|
+
'{"target":"chat","operations":[{"version":"1.0", bad},' +
|
|
79
79
|
JSON.stringify(opA) +
|
|
80
80
|
"]}";
|
|
81
81
|
expect(extractRenderUIArgs(text).operations).toEqual([null, opA]);
|
|
@@ -140,7 +140,7 @@ describe("RenderUIArgsStream", () => {
|
|
|
140
140
|
|
|
141
141
|
it("keeps the parser state across deltas that split strings, escapes and braces", () => {
|
|
142
142
|
const tricky = {
|
|
143
|
-
version: "
|
|
143
|
+
version: "1.0",
|
|
144
144
|
updateDataModel: { surfaceId: "s", path: "/q", value: 'a "}{" \\ ]' },
|
|
145
145
|
};
|
|
146
146
|
const text = JSON.stringify({
|
|
@@ -62,19 +62,19 @@ const functions = {
|
|
|
62
62
|
const knownSurfaces = new Set(["s1"]);
|
|
63
63
|
|
|
64
64
|
const update = (...components: unknown[]) => ({
|
|
65
|
-
version: "
|
|
65
|
+
version: "1.0",
|
|
66
66
|
updateComponents: { surfaceId: "s1", components },
|
|
67
67
|
});
|
|
68
68
|
const setData = (fields: { path?: string; value?: unknown }) => ({
|
|
69
|
-
version: "
|
|
69
|
+
version: "1.0",
|
|
70
70
|
updateDataModel: { surfaceId: "s1", ...fields },
|
|
71
71
|
});
|
|
72
72
|
const create = (fields: Record<string, unknown>) => ({
|
|
73
|
-
version: "
|
|
73
|
+
version: "1.0",
|
|
74
74
|
createSurface: { surfaceId: "s2", ...fields },
|
|
75
75
|
});
|
|
76
76
|
const callFunction = (fields: Record<string, unknown>) => ({
|
|
77
|
-
version: "
|
|
77
|
+
version: "1.0",
|
|
78
78
|
callRendererFunction: { functionCallId: "f1", ...fields },
|
|
79
79
|
});
|
|
80
80
|
/** A valid ProductCard with `props` added or replaced. */
|
|
@@ -90,23 +90,29 @@ const reasonOf = (
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
describe("validateOperation: version and kind", () => {
|
|
93
|
-
it("rejects
|
|
93
|
+
it("rejects the pre-release v1.0 spelling", () => {
|
|
94
|
+
expect(
|
|
95
|
+
reasonOf({ version: "v1.0", deleteSurface: { surfaceId: "s1" } }),
|
|
96
|
+
).toBe('unsupported version "v1.0"; use "1.0"');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("rejects a v0.9 operation with a reason that names 1.0", () => {
|
|
94
100
|
expect(
|
|
95
101
|
reasonOf({ version: "v0.9", deleteSurface: { surfaceId: "s1" } }),
|
|
96
|
-
).toBe('unsupported version "v0.9"; use "
|
|
102
|
+
).toBe('unsupported version "v0.9"; use "1.0"');
|
|
97
103
|
});
|
|
98
104
|
|
|
99
105
|
it("rejects an operation without a version", () => {
|
|
100
106
|
expect(reasonOf({ deleteSurface: { surfaceId: "s1" } })).toBe(
|
|
101
|
-
'operation needs "version":"
|
|
107
|
+
'operation needs "version":"1.0"',
|
|
102
108
|
);
|
|
103
109
|
});
|
|
104
110
|
|
|
105
111
|
it("rejects ops with zero or several kinds", () => {
|
|
106
|
-
expect(reasonOf({ version: "
|
|
112
|
+
expect(reasonOf({ version: "1.0" })).toMatch(/exactly one/);
|
|
107
113
|
expect(
|
|
108
114
|
reasonOf({
|
|
109
|
-
version: "
|
|
115
|
+
version: "1.0",
|
|
110
116
|
deleteSurface: { surfaceId: "s1" },
|
|
111
117
|
updateDataModel: { surfaceId: "s1", value: 1 },
|
|
112
118
|
}),
|
|
@@ -133,7 +139,7 @@ describe("validateOperation: createSurface", () => {
|
|
|
133
139
|
};
|
|
134
140
|
const check = (catalogId: string) =>
|
|
135
141
|
validateOperation(
|
|
136
|
-
{ version: "
|
|
142
|
+
{ version: "1.0", createSurface: { surfaceId: "s2", catalogId } },
|
|
137
143
|
options,
|
|
138
144
|
);
|
|
139
145
|
expect(check("copilotkit/standard@1")).toEqual({ ok: true });
|
|
@@ -146,13 +152,13 @@ describe("validateOperation: createSurface", () => {
|
|
|
146
152
|
|
|
147
153
|
it("rejects a createSurface without a surfaceId", () => {
|
|
148
154
|
expect(
|
|
149
|
-
reasonOf({ version: "
|
|
155
|
+
reasonOf({ version: "1.0", createSurface: { catalogId: "shop" } }),
|
|
150
156
|
).toBe("createSurface.surfaceId is required");
|
|
151
157
|
});
|
|
152
158
|
|
|
153
159
|
it("rejects an existing surface", () => {
|
|
154
160
|
expect(
|
|
155
|
-
reasonOf({ version: "
|
|
161
|
+
reasonOf({ version: "1.0", createSurface: { surfaceId: "s1" } }),
|
|
156
162
|
).toBe('surface "s1" already exists');
|
|
157
163
|
});
|
|
158
164
|
|
|
@@ -201,7 +207,7 @@ describe("validateOperation: surface updates", () => {
|
|
|
201
207
|
it("rejects updates to surfaces that do not exist", () => {
|
|
202
208
|
expect(
|
|
203
209
|
reasonOf({
|
|
204
|
-
version: "
|
|
210
|
+
version: "1.0",
|
|
205
211
|
updateComponents: {
|
|
206
212
|
surfaceId: "missing",
|
|
207
213
|
components: [{ id: "root", component: "ProductGrid" }],
|
|
@@ -107,7 +107,8 @@ export function collectChildRefs(schema: GenerativeUIJSONSchema): ChildRef[] {
|
|
|
107
107
|
);
|
|
108
108
|
const key = (ref: ChildRef) =>
|
|
109
109
|
`${ref.kind}\u0000${ref.path.join("\u0000")}`;
|
|
110
|
-
|
|
110
|
+
// `list` is not empty (checked above), so `perVariant` is not empty.
|
|
111
|
+
const shared = perVariant[0]!.filter((ref) =>
|
|
111
112
|
perVariant.every((refs) => refs.some((r) => key(r) === key(ref))),
|
|
112
113
|
);
|
|
113
114
|
shared.forEach((ref) => add([...path, ...ref.path], ref.kind));
|
|
@@ -146,8 +147,8 @@ export function childIdsAtRefs(
|
|
|
146
147
|
}
|
|
147
148
|
};
|
|
148
149
|
const visit = (value: unknown, path: readonly string[]) => {
|
|
149
|
-
if (path.length === 0) return collect(value);
|
|
150
150
|
const [head, ...rest] = path;
|
|
151
|
+
if (head === undefined) return collect(value);
|
|
151
152
|
if (head === "*") {
|
|
152
153
|
if (Array.isArray(value)) value.forEach((item) => visit(item, rest));
|
|
153
154
|
return;
|
|
@@ -173,8 +174,8 @@ export function hasBoundChildRef(
|
|
|
173
174
|
isRecord(value) && ("@path" in value || "@call" in value);
|
|
174
175
|
const visit = (value: unknown, path: readonly string[]): boolean => {
|
|
175
176
|
if (isDynamic(value)) return true;
|
|
176
|
-
if (path.length === 0) return false;
|
|
177
177
|
const [head, ...rest] = path;
|
|
178
|
+
if (head === undefined) return false;
|
|
178
179
|
if (head === "*") {
|
|
179
180
|
return Array.isArray(value) && value.some((item) => visit(item, rest));
|
|
180
181
|
}
|
|
@@ -197,8 +198,8 @@ export function mapAtChildRef(
|
|
|
197
198
|
path: readonly string[],
|
|
198
199
|
replace: (found: unknown) => unknown,
|
|
199
200
|
): unknown {
|
|
200
|
-
if (path.length === 0) return replace(value);
|
|
201
201
|
const [head, ...rest] = path;
|
|
202
|
+
if (head === undefined) return replace(value);
|
|
202
203
|
if (head === "*") {
|
|
203
204
|
if (!Array.isArray(value)) return value;
|
|
204
205
|
return value.map((item) => mapAtChildRef(item, rest, replace));
|
|
@@ -134,8 +134,8 @@ export function defaultGenerativeUIPromptSpec(): GenerativeUIPromptSpec {
|
|
|
134
134
|
"Open a fence with ```a2ui target=<id> to show the surface in a named target. Use only target ids from the schema. When a target limits its components, its surfaces can use only those components.",
|
|
135
135
|
"Inside a fence, write one JSON object per line and nothing else. No comments, no trailing commas, no pretty-printing.",
|
|
136
136
|
"Keep each operation whole on its line.",
|
|
137
|
-
'Give every operation "version":"
|
|
138
|
-
'Start a surface with one createSurface. Put all the initial data in "dataModel" and the "root" component in "components". Then write the children in updateComponents lines, so that they show while you write:\n ```a2ui\n {"version":"
|
|
137
|
+
'Give every operation "version":"1.0".',
|
|
138
|
+
'Start a surface with one createSurface. Put all the initial data in "dataModel" and the "root" component in "components". Then write the children in updateComponents lines, so that they show while you write:\n ```a2ui\n {"version":"1.0","createSurface":{"surfaceId":"plan-picker","dataModel":{ ...initial data... },"components":[{"id":"root","component":"<Name>","children":["seats","pick"]}]}}\n {"version":"1.0","updateComponents":{"surfaceId":"plan-picker","components":[ ...the children... ]}}\n ```',
|
|
139
139
|
'Keep "dataModel" flat: top-level keys such as "seats" or "form", never one wrapper object around everything. Check that every { and [ you open in a line is closed.',
|
|
140
140
|
'Every surface renders from the component with id "root". Make every other component reachable from "root" through slots.',
|
|
141
141
|
"Send every component you reference in the same reply. If a surface gets long, make it smaller rather than leave components out.",
|
|
@@ -156,7 +156,7 @@ export function defaultGenerativeUIPromptSpec(): GenerativeUIPromptSpec {
|
|
|
156
156
|
'For a computed list (chart data, template items) use series. Its description under Functions in the schema gives the rules and an example. Bind the "data" of a Chart or the "items" of a List to it; a template path stays a literal path.',
|
|
157
157
|
'Bind a writable prop to let the user edit it: "value":{"@path":"/form/email"}. The user\'s input goes to that path.',
|
|
158
158
|
'The value of a ChoicePicker is a list of strings, also for one choice. SegmentedControl, RadioGroup and Select take one string. Option values are always strings: for a yes/no choice use "yes" and "no", not true and false.',
|
|
159
|
-
'To change data, write updateDataModel with a "path" and a "value": {"version":"
|
|
159
|
+
'To change data, write updateDataModel with a "path" and a "value": {"version":"1.0","updateDataModel":{"surfaceId":"plan-picker","path":"/seats","value":12}}. Always give "value".',
|
|
160
160
|
'Set "value":null to delete the key at "path".',
|
|
161
161
|
{
|
|
162
162
|
when: ["events"],
|
|
@@ -206,9 +206,9 @@ export function defaultGenerativeUIPromptSpec(): GenerativeUIPromptSpec {
|
|
|
206
206
|
{
|
|
207
207
|
when: ["agentCalls"],
|
|
208
208
|
items: [
|
|
209
|
-
'To run an app function now, with no click, write a callRendererFunction line in a fence: {"version":"
|
|
209
|
+
'To run an app function now, with no click, write a callRendererFunction line in a fence: {"version":"1.0","callRendererFunction":{"functionCallId":"<unique id>","callFunction":{"@call":"<function>","args":{...}}}}. It needs no surface.',
|
|
210
210
|
"Give every callRendererFunction a new functionCallId. Call only a function that the schema marks UI or agent, or agent only; a function with no mark is for the UI only. A function marked agent only is only for callRendererFunction: do not bind an event to it.",
|
|
211
|
-
'The result of a callRendererFunction comes back to you as a developer message: {"version":"
|
|
211
|
+
'The result of a callRendererFunction comes back to you as a developer message: {"version":"1.0","rendererFunctionResponse":{"functionCallId":"<id>","value":...}}. If the call failed, it has "error" in place of "value". Then you get a new turn.',
|
|
212
212
|
"Do not guess the result of a callRendererFunction. Wait for the developer message.",
|
|
213
213
|
],
|
|
214
214
|
},
|
|
@@ -223,14 +223,14 @@ export function defaultGenerativeUIPromptSpec(): GenerativeUIPromptSpec {
|
|
|
223
223
|
intro: `Call \`${GENERATIVE_UI_RENDER_TOOL}\` to show UI. Arguments: \`target\` first, then \`operations\` (A2UI v1.0 operations, applied in order).`,
|
|
224
224
|
whenToShow: GENERATIVE_UI_WHEN_TO_SHOW,
|
|
225
225
|
operations: [
|
|
226
|
-
'{"version":"
|
|
227
|
-
'{"version":"
|
|
228
|
-
'{"version":"
|
|
229
|
-
'{"version":"
|
|
226
|
+
'{"version":"1.0","createSurface":{"surfaceId":"<new id>","dataModel":{...},"components":[{"id":"root","component":"<Name>","children":["<child id>"]}]}}: the first operation of a new surface. "dataModel" and "components" are optional.',
|
|
227
|
+
'{"version":"1.0","updateComponents":{"surfaceId":"<id>","components":[<component>, ...]}}: add or replace components by id.',
|
|
228
|
+
'{"version":"1.0","updateDataModel":{"surfaceId":"<id>","path":"/some/path","value":<json>}}: set the value at "path". Always give "value". "value":null deletes the key at "path".',
|
|
229
|
+
'{"version":"1.0","deleteSurface":{"surfaceId":"<id>"}}: remove the surface.',
|
|
230
230
|
{
|
|
231
231
|
when: ["agentCalls"],
|
|
232
232
|
items: [
|
|
233
|
-
'{"version":"
|
|
233
|
+
'{"version":"1.0","callRendererFunction":{"functionCallId":"<unique id>","callFunction":{"@call":"<function>","args":{...}}}}: run an app function now, with no click. It needs no surface.',
|
|
234
234
|
],
|
|
235
235
|
},
|
|
236
236
|
],
|
|
@@ -273,7 +273,7 @@ export function defaultGenerativeUIPromptSpec(): GenerativeUIPromptSpec {
|
|
|
273
273
|
when: ["agentCalls"],
|
|
274
274
|
items: [
|
|
275
275
|
"Give every callRendererFunction a new functionCallId. Call only a function marked (UI or agent) or (agent only); a function with no mark is for the UI only. A function marked (agent only) is only for callRendererFunction: do not bind an event to it.",
|
|
276
|
-
'The result of a callRendererFunction comes back to you in a new turn, as a developer message: {"version":"
|
|
276
|
+
'The result of a callRendererFunction comes back to you in a new turn, as a developer message: {"version":"1.0","rendererFunctionResponse":{"functionCallId":"<id>","value":...}}. If the call failed, it has "error" in place of "value". Do not wait for the result in this reply, and do not guess it.',
|
|
277
277
|
],
|
|
278
278
|
},
|
|
279
279
|
],
|
|
@@ -111,7 +111,7 @@ export function buildGenerativeUIPrompt(
|
|
|
111
111
|
`## Generative UI
|
|
112
112
|
${intro}
|
|
113
113
|
|
|
114
|
-
${when}Every operation has "version":"
|
|
114
|
+
${when}Every operation has "version":"1.0" and exactly one of:
|
|
115
115
|
${operations.map((op) => `- ${op}`).join("\n")}
|
|
116
116
|
|
|
117
117
|
Rules:
|