@kortyx/stream 0.5.2 → 0.6.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/CHANGELOG.md +9 -0
- package/dist/{browser-ojdAqLMO.d.ts → browser-DBfCMmkm.d.ts} +289 -112
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +139 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +4 -15
- package/dist/index.js +248 -110
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @chatbot-core/types
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/kortyx-io/kortyx/compare/stream-v0.5.2...stream-v0.6.0) (2026-04-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **hooks:** support incremental structured data streaming ([05e9678](https://github.com/kortyx-io/kortyx/commit/05e96789a9a132549c9245b1feb76d20916da42a))
|
|
9
|
+
* **hooks:** support incremental structured data streaming ([05e9678](https://github.com/kortyx-io/kortyx/commit/05e96789a9a132549c9245b1feb76d20916da42a))
|
|
10
|
+
* **hooks:** support incremental structured data streaming ([4023fda](https://github.com/kortyx-io/kortyx/commit/4023fda42bfecc81782e474e6d442b379a3fa3d4))
|
|
11
|
+
|
|
3
12
|
## [0.5.2](https://github.com/kortyx-io/kortyx/compare/stream-v0.5.1...stream-v0.5.2) (2026-04-12)
|
|
4
13
|
|
|
5
14
|
|
|
@@ -14,12 +14,12 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
14
14
|
message: z.ZodString;
|
|
15
15
|
node: z.ZodOptional<z.ZodString>;
|
|
16
16
|
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
message?: string;
|
|
18
17
|
type?: "status";
|
|
18
|
+
message?: string;
|
|
19
19
|
node?: string;
|
|
20
20
|
}, {
|
|
21
|
-
message?: string;
|
|
22
21
|
type?: "status";
|
|
22
|
+
message?: string;
|
|
23
23
|
node?: string;
|
|
24
24
|
}>, z.ZodObject<{
|
|
25
25
|
type: z.ZodLiteral<"message">;
|
|
@@ -42,14 +42,14 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
type?: "text-start";
|
|
44
44
|
id?: string;
|
|
45
|
-
opId?: string;
|
|
46
45
|
node?: string;
|
|
46
|
+
opId?: string;
|
|
47
47
|
segmentId?: string;
|
|
48
48
|
}, {
|
|
49
49
|
type?: "text-start";
|
|
50
50
|
id?: string;
|
|
51
|
-
opId?: string;
|
|
52
51
|
node?: string;
|
|
52
|
+
opId?: string;
|
|
53
53
|
segmentId?: string;
|
|
54
54
|
}>, z.ZodObject<{
|
|
55
55
|
type: z.ZodLiteral<"text-delta">;
|
|
@@ -61,17 +61,17 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
type?: "text-delta";
|
|
63
63
|
id?: string;
|
|
64
|
-
opId?: string;
|
|
65
64
|
node?: string;
|
|
66
|
-
segmentId?: string;
|
|
67
65
|
delta?: string;
|
|
66
|
+
opId?: string;
|
|
67
|
+
segmentId?: string;
|
|
68
68
|
}, {
|
|
69
69
|
type?: "text-delta";
|
|
70
70
|
id?: string;
|
|
71
|
-
opId?: string;
|
|
72
71
|
node?: string;
|
|
73
|
-
segmentId?: string;
|
|
74
72
|
delta?: string;
|
|
73
|
+
opId?: string;
|
|
74
|
+
segmentId?: string;
|
|
75
75
|
}>, z.ZodObject<{
|
|
76
76
|
type: z.ZodLiteral<"text-end">;
|
|
77
77
|
node: z.ZodOptional<z.ZodString>;
|
|
@@ -81,14 +81,14 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
81
81
|
}, "strip", z.ZodTypeAny, {
|
|
82
82
|
type?: "text-end";
|
|
83
83
|
id?: string;
|
|
84
|
-
opId?: string;
|
|
85
84
|
node?: string;
|
|
85
|
+
opId?: string;
|
|
86
86
|
segmentId?: string;
|
|
87
87
|
}, {
|
|
88
88
|
type?: "text-end";
|
|
89
89
|
id?: string;
|
|
90
|
-
opId?: string;
|
|
91
90
|
node?: string;
|
|
91
|
+
opId?: string;
|
|
92
92
|
segmentId?: string;
|
|
93
93
|
}>, z.ZodObject<{
|
|
94
94
|
type: z.ZodLiteral<"tool-result">;
|
|
@@ -126,19 +126,19 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
126
126
|
options: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
128
|
options?: never[];
|
|
129
|
-
|
|
129
|
+
kind?: "text";
|
|
130
130
|
schemaId?: string;
|
|
131
131
|
schemaVersion?: string;
|
|
132
|
-
|
|
132
|
+
id?: string;
|
|
133
133
|
multiple?: boolean;
|
|
134
134
|
question?: string;
|
|
135
135
|
meta?: Record<string, unknown>;
|
|
136
136
|
}, {
|
|
137
137
|
options?: never[];
|
|
138
|
-
|
|
138
|
+
kind?: "text";
|
|
139
139
|
schemaId?: string;
|
|
140
140
|
schemaVersion?: string;
|
|
141
|
-
|
|
141
|
+
id?: string;
|
|
142
142
|
multiple?: boolean;
|
|
143
143
|
question?: string;
|
|
144
144
|
meta?: Record<string, unknown>;
|
|
@@ -169,10 +169,10 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
169
169
|
label?: string;
|
|
170
170
|
description?: string;
|
|
171
171
|
}[];
|
|
172
|
-
|
|
172
|
+
kind?: "choice" | "multi-choice";
|
|
173
173
|
schemaId?: string;
|
|
174
174
|
schemaVersion?: string;
|
|
175
|
-
|
|
175
|
+
id?: string;
|
|
176
176
|
multiple?: boolean;
|
|
177
177
|
question?: string;
|
|
178
178
|
meta?: Record<string, unknown>;
|
|
@@ -182,10 +182,10 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
182
182
|
label?: string;
|
|
183
183
|
description?: string;
|
|
184
184
|
}[];
|
|
185
|
-
|
|
185
|
+
kind?: "choice" | "multi-choice";
|
|
186
186
|
schemaId?: string;
|
|
187
187
|
schemaVersion?: string;
|
|
188
|
-
|
|
188
|
+
id?: string;
|
|
189
189
|
multiple?: boolean;
|
|
190
190
|
question?: string;
|
|
191
191
|
meta?: Record<string, unknown>;
|
|
@@ -193,20 +193,20 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
193
193
|
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
194
194
|
}, "strip", z.ZodTypeAny, {
|
|
195
195
|
type?: "interrupt";
|
|
196
|
-
id?: string;
|
|
197
196
|
schemaId?: string;
|
|
198
197
|
schemaVersion?: string;
|
|
199
|
-
|
|
198
|
+
id?: string;
|
|
200
199
|
node?: string;
|
|
200
|
+
opId?: string;
|
|
201
201
|
requestId?: string;
|
|
202
202
|
resumeToken?: string;
|
|
203
203
|
workflow?: string;
|
|
204
204
|
input?: {
|
|
205
205
|
options?: never[];
|
|
206
|
-
|
|
206
|
+
kind?: "text";
|
|
207
207
|
schemaId?: string;
|
|
208
208
|
schemaVersion?: string;
|
|
209
|
-
|
|
209
|
+
id?: string;
|
|
210
210
|
multiple?: boolean;
|
|
211
211
|
question?: string;
|
|
212
212
|
meta?: Record<string, unknown>;
|
|
@@ -216,10 +216,10 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
216
216
|
label?: string;
|
|
217
217
|
description?: string;
|
|
218
218
|
}[];
|
|
219
|
-
|
|
219
|
+
kind?: "choice" | "multi-choice";
|
|
220
220
|
schemaId?: string;
|
|
221
221
|
schemaVersion?: string;
|
|
222
|
-
|
|
222
|
+
id?: string;
|
|
223
223
|
multiple?: boolean;
|
|
224
224
|
question?: string;
|
|
225
225
|
meta?: Record<string, unknown>;
|
|
@@ -227,20 +227,20 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
227
227
|
meta?: Record<string, unknown>;
|
|
228
228
|
}, {
|
|
229
229
|
type?: "interrupt";
|
|
230
|
-
id?: string;
|
|
231
230
|
schemaId?: string;
|
|
232
231
|
schemaVersion?: string;
|
|
233
|
-
|
|
232
|
+
id?: string;
|
|
234
233
|
node?: string;
|
|
234
|
+
opId?: string;
|
|
235
235
|
requestId?: string;
|
|
236
236
|
resumeToken?: string;
|
|
237
237
|
workflow?: string;
|
|
238
238
|
input?: {
|
|
239
239
|
options?: never[];
|
|
240
|
-
|
|
240
|
+
kind?: "text";
|
|
241
241
|
schemaId?: string;
|
|
242
242
|
schemaVersion?: string;
|
|
243
|
-
|
|
243
|
+
id?: string;
|
|
244
244
|
multiple?: boolean;
|
|
245
245
|
question?: string;
|
|
246
246
|
meta?: Record<string, unknown>;
|
|
@@ -250,10 +250,10 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
250
250
|
label?: string;
|
|
251
251
|
description?: string;
|
|
252
252
|
}[];
|
|
253
|
-
|
|
253
|
+
kind?: "choice" | "multi-choice";
|
|
254
254
|
schemaId?: string;
|
|
255
255
|
schemaVersion?: string;
|
|
256
|
-
|
|
256
|
+
id?: string;
|
|
257
257
|
multiple?: boolean;
|
|
258
258
|
question?: string;
|
|
259
259
|
meta?: Record<string, unknown>;
|
|
@@ -261,121 +261,135 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
261
261
|
meta?: Record<string, unknown>;
|
|
262
262
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
263
263
|
type: z.ZodLiteral<"structured-data">;
|
|
264
|
-
|
|
264
|
+
streamId: z.ZodString;
|
|
265
|
+
dataType: z.ZodString;
|
|
265
266
|
schemaId: z.ZodOptional<z.ZodString>;
|
|
266
267
|
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
267
268
|
id: z.ZodOptional<z.ZodString>;
|
|
268
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
269
269
|
node: z.ZodOptional<z.ZodString>;
|
|
270
270
|
} & {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
id: z.ZodString;
|
|
275
|
-
title: z.ZodString;
|
|
276
|
-
company: z.ZodString;
|
|
277
|
-
location: z.ZodString;
|
|
278
|
-
match: z.ZodNumber;
|
|
279
|
-
}, "strip", z.ZodTypeAny, {
|
|
280
|
-
id?: string;
|
|
281
|
-
title?: string;
|
|
282
|
-
company?: string;
|
|
283
|
-
location?: string;
|
|
284
|
-
match?: number;
|
|
285
|
-
}, {
|
|
286
|
-
id?: string;
|
|
287
|
-
title?: string;
|
|
288
|
-
company?: string;
|
|
289
|
-
location?: string;
|
|
290
|
-
match?: number;
|
|
291
|
-
}>, "many">;
|
|
292
|
-
reasoning: z.ZodOptional<z.ZodString>;
|
|
293
|
-
}, "strip", z.ZodTypeAny, {
|
|
294
|
-
jobs?: {
|
|
295
|
-
id?: string;
|
|
296
|
-
title?: string;
|
|
297
|
-
company?: string;
|
|
298
|
-
location?: string;
|
|
299
|
-
match?: number;
|
|
300
|
-
}[];
|
|
301
|
-
reasoning?: string;
|
|
302
|
-
}, {
|
|
303
|
-
jobs?: {
|
|
304
|
-
id?: string;
|
|
305
|
-
title?: string;
|
|
306
|
-
company?: string;
|
|
307
|
-
location?: string;
|
|
308
|
-
match?: number;
|
|
309
|
-
}[];
|
|
310
|
-
reasoning?: string;
|
|
311
|
-
}>;
|
|
271
|
+
kind: z.ZodLiteral<"set">;
|
|
272
|
+
path: z.ZodString;
|
|
273
|
+
value: z.ZodUnknown;
|
|
312
274
|
}, "strip", z.ZodTypeAny, {
|
|
313
275
|
type?: "structured-data";
|
|
276
|
+
value?: unknown;
|
|
277
|
+
path?: string;
|
|
278
|
+
streamId?: string;
|
|
279
|
+
dataType?: string;
|
|
280
|
+
kind?: "set";
|
|
281
|
+
schemaId?: string;
|
|
282
|
+
schemaVersion?: string;
|
|
314
283
|
id?: string;
|
|
315
|
-
|
|
316
|
-
|
|
284
|
+
node?: string;
|
|
285
|
+
}, {
|
|
286
|
+
type?: "structured-data";
|
|
287
|
+
value?: unknown;
|
|
288
|
+
path?: string;
|
|
289
|
+
streamId?: string;
|
|
290
|
+
dataType?: string;
|
|
291
|
+
kind?: "set";
|
|
317
292
|
schemaId?: string;
|
|
318
293
|
schemaVersion?: string;
|
|
319
|
-
|
|
294
|
+
id?: string;
|
|
320
295
|
node?: string;
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
296
|
+
}>, z.ZodObject<{
|
|
297
|
+
type: z.ZodLiteral<"structured-data">;
|
|
298
|
+
streamId: z.ZodString;
|
|
299
|
+
dataType: z.ZodString;
|
|
300
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
301
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
302
|
+
id: z.ZodOptional<z.ZodString>;
|
|
303
|
+
node: z.ZodOptional<z.ZodString>;
|
|
304
|
+
} & {
|
|
305
|
+
kind: z.ZodLiteral<"append">;
|
|
306
|
+
path: z.ZodString;
|
|
307
|
+
items: z.ZodArray<z.ZodUnknown, "many">;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
type?: "structured-data";
|
|
310
|
+
path?: string;
|
|
311
|
+
streamId?: string;
|
|
312
|
+
dataType?: string;
|
|
313
|
+
kind?: "append";
|
|
314
|
+
schemaId?: string;
|
|
315
|
+
schemaVersion?: string;
|
|
316
|
+
id?: string;
|
|
317
|
+
node?: string;
|
|
318
|
+
items?: unknown[];
|
|
331
319
|
}, {
|
|
332
320
|
type?: "structured-data";
|
|
321
|
+
path?: string;
|
|
322
|
+
streamId?: string;
|
|
323
|
+
dataType?: string;
|
|
324
|
+
kind?: "append";
|
|
325
|
+
schemaId?: string;
|
|
326
|
+
schemaVersion?: string;
|
|
333
327
|
id?: string;
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
node?: string;
|
|
329
|
+
items?: unknown[];
|
|
330
|
+
}>, z.ZodObject<{
|
|
331
|
+
type: z.ZodLiteral<"structured-data">;
|
|
332
|
+
streamId: z.ZodString;
|
|
333
|
+
dataType: z.ZodString;
|
|
334
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
335
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
336
|
+
id: z.ZodOptional<z.ZodString>;
|
|
337
|
+
node: z.ZodOptional<z.ZodString>;
|
|
338
|
+
} & {
|
|
339
|
+
kind: z.ZodLiteral<"text-delta">;
|
|
340
|
+
path: z.ZodString;
|
|
341
|
+
delta: z.ZodString;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
type?: "structured-data";
|
|
344
|
+
path?: string;
|
|
345
|
+
streamId?: string;
|
|
346
|
+
dataType?: string;
|
|
347
|
+
kind?: "text-delta";
|
|
336
348
|
schemaId?: string;
|
|
337
349
|
schemaVersion?: string;
|
|
338
|
-
|
|
350
|
+
id?: string;
|
|
339
351
|
node?: string;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
352
|
+
delta?: string;
|
|
353
|
+
}, {
|
|
354
|
+
type?: "structured-data";
|
|
355
|
+
path?: string;
|
|
356
|
+
streamId?: string;
|
|
357
|
+
dataType?: string;
|
|
358
|
+
kind?: "text-delta";
|
|
359
|
+
schemaId?: string;
|
|
360
|
+
schemaVersion?: string;
|
|
361
|
+
id?: string;
|
|
362
|
+
node?: string;
|
|
363
|
+
delta?: string;
|
|
350
364
|
}>, z.ZodObject<{
|
|
351
365
|
type: z.ZodLiteral<"structured-data">;
|
|
352
|
-
|
|
353
|
-
|
|
366
|
+
streamId: z.ZodString;
|
|
367
|
+
dataType: z.ZodString;
|
|
354
368
|
schemaId: z.ZodOptional<z.ZodString>;
|
|
355
369
|
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
356
370
|
id: z.ZodOptional<z.ZodString>;
|
|
357
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
358
371
|
node: z.ZodOptional<z.ZodString>;
|
|
359
372
|
} & {
|
|
373
|
+
kind: z.ZodLiteral<"final">;
|
|
360
374
|
data: z.ZodUnknown;
|
|
361
375
|
}, "strip", z.ZodTypeAny, {
|
|
362
376
|
type?: "structured-data";
|
|
363
|
-
|
|
377
|
+
streamId?: string;
|
|
364
378
|
dataType?: string;
|
|
365
|
-
|
|
379
|
+
kind?: "final";
|
|
366
380
|
schemaId?: string;
|
|
367
381
|
schemaVersion?: string;
|
|
368
|
-
|
|
382
|
+
id?: string;
|
|
369
383
|
node?: string;
|
|
370
384
|
data?: unknown;
|
|
371
385
|
}, {
|
|
372
386
|
type?: "structured-data";
|
|
373
|
-
|
|
387
|
+
streamId?: string;
|
|
374
388
|
dataType?: string;
|
|
375
|
-
|
|
389
|
+
kind?: "final";
|
|
376
390
|
schemaId?: string;
|
|
377
391
|
schemaVersion?: string;
|
|
378
|
-
|
|
392
|
+
id?: string;
|
|
379
393
|
node?: string;
|
|
380
394
|
data?: unknown;
|
|
381
395
|
}>]>, z.ZodObject<{
|
|
@@ -403,16 +417,16 @@ declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
403
417
|
type: z.ZodLiteral<"error">;
|
|
404
418
|
message: z.ZodString;
|
|
405
419
|
}, "strip", z.ZodTypeAny, {
|
|
406
|
-
message?: string;
|
|
407
420
|
type?: "error";
|
|
408
|
-
}, {
|
|
409
421
|
message?: string;
|
|
422
|
+
}, {
|
|
410
423
|
type?: "error";
|
|
424
|
+
message?: string;
|
|
411
425
|
}>]>;
|
|
412
426
|
type StreamChunk = z.infer<typeof StreamChunkSchema>;
|
|
413
427
|
|
|
414
428
|
interface ConsumeStreamHandlers {
|
|
415
|
-
onChunk?: (chunk: StreamChunk) =>
|
|
429
|
+
onChunk?: (chunk: StreamChunk) => undefined | boolean | Promise<boolean | undefined>;
|
|
416
430
|
onDone?: () => void | Promise<void>;
|
|
417
431
|
onError?: (error: Error, chunk?: StreamChunk) => void | Promise<void>;
|
|
418
432
|
}
|
|
@@ -436,4 +450,167 @@ interface StreamFromRouteArgs<TBody = unknown> {
|
|
|
436
450
|
}
|
|
437
451
|
declare function streamFromRoute<TBody = unknown>(args: StreamFromRouteArgs<TBody>): AsyncGenerator<StreamChunk, void, void>;
|
|
438
452
|
|
|
439
|
-
|
|
453
|
+
declare const StructuredDataChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
454
|
+
type: z.ZodLiteral<"structured-data">;
|
|
455
|
+
streamId: z.ZodString;
|
|
456
|
+
dataType: z.ZodString;
|
|
457
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
458
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
459
|
+
id: z.ZodOptional<z.ZodString>;
|
|
460
|
+
node: z.ZodOptional<z.ZodString>;
|
|
461
|
+
} & {
|
|
462
|
+
kind: z.ZodLiteral<"set">;
|
|
463
|
+
path: z.ZodString;
|
|
464
|
+
value: z.ZodUnknown;
|
|
465
|
+
}, "strip", z.ZodTypeAny, {
|
|
466
|
+
type?: "structured-data";
|
|
467
|
+
value?: unknown;
|
|
468
|
+
path?: string;
|
|
469
|
+
streamId?: string;
|
|
470
|
+
dataType?: string;
|
|
471
|
+
kind?: "set";
|
|
472
|
+
schemaId?: string;
|
|
473
|
+
schemaVersion?: string;
|
|
474
|
+
id?: string;
|
|
475
|
+
node?: string;
|
|
476
|
+
}, {
|
|
477
|
+
type?: "structured-data";
|
|
478
|
+
value?: unknown;
|
|
479
|
+
path?: string;
|
|
480
|
+
streamId?: string;
|
|
481
|
+
dataType?: string;
|
|
482
|
+
kind?: "set";
|
|
483
|
+
schemaId?: string;
|
|
484
|
+
schemaVersion?: string;
|
|
485
|
+
id?: string;
|
|
486
|
+
node?: string;
|
|
487
|
+
}>, z.ZodObject<{
|
|
488
|
+
type: z.ZodLiteral<"structured-data">;
|
|
489
|
+
streamId: z.ZodString;
|
|
490
|
+
dataType: z.ZodString;
|
|
491
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
492
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
493
|
+
id: z.ZodOptional<z.ZodString>;
|
|
494
|
+
node: z.ZodOptional<z.ZodString>;
|
|
495
|
+
} & {
|
|
496
|
+
kind: z.ZodLiteral<"append">;
|
|
497
|
+
path: z.ZodString;
|
|
498
|
+
items: z.ZodArray<z.ZodUnknown, "many">;
|
|
499
|
+
}, "strip", z.ZodTypeAny, {
|
|
500
|
+
type?: "structured-data";
|
|
501
|
+
path?: string;
|
|
502
|
+
streamId?: string;
|
|
503
|
+
dataType?: string;
|
|
504
|
+
kind?: "append";
|
|
505
|
+
schemaId?: string;
|
|
506
|
+
schemaVersion?: string;
|
|
507
|
+
id?: string;
|
|
508
|
+
node?: string;
|
|
509
|
+
items?: unknown[];
|
|
510
|
+
}, {
|
|
511
|
+
type?: "structured-data";
|
|
512
|
+
path?: string;
|
|
513
|
+
streamId?: string;
|
|
514
|
+
dataType?: string;
|
|
515
|
+
kind?: "append";
|
|
516
|
+
schemaId?: string;
|
|
517
|
+
schemaVersion?: string;
|
|
518
|
+
id?: string;
|
|
519
|
+
node?: string;
|
|
520
|
+
items?: unknown[];
|
|
521
|
+
}>, z.ZodObject<{
|
|
522
|
+
type: z.ZodLiteral<"structured-data">;
|
|
523
|
+
streamId: z.ZodString;
|
|
524
|
+
dataType: z.ZodString;
|
|
525
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
526
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
527
|
+
id: z.ZodOptional<z.ZodString>;
|
|
528
|
+
node: z.ZodOptional<z.ZodString>;
|
|
529
|
+
} & {
|
|
530
|
+
kind: z.ZodLiteral<"text-delta">;
|
|
531
|
+
path: z.ZodString;
|
|
532
|
+
delta: z.ZodString;
|
|
533
|
+
}, "strip", z.ZodTypeAny, {
|
|
534
|
+
type?: "structured-data";
|
|
535
|
+
path?: string;
|
|
536
|
+
streamId?: string;
|
|
537
|
+
dataType?: string;
|
|
538
|
+
kind?: "text-delta";
|
|
539
|
+
schemaId?: string;
|
|
540
|
+
schemaVersion?: string;
|
|
541
|
+
id?: string;
|
|
542
|
+
node?: string;
|
|
543
|
+
delta?: string;
|
|
544
|
+
}, {
|
|
545
|
+
type?: "structured-data";
|
|
546
|
+
path?: string;
|
|
547
|
+
streamId?: string;
|
|
548
|
+
dataType?: string;
|
|
549
|
+
kind?: "text-delta";
|
|
550
|
+
schemaId?: string;
|
|
551
|
+
schemaVersion?: string;
|
|
552
|
+
id?: string;
|
|
553
|
+
node?: string;
|
|
554
|
+
delta?: string;
|
|
555
|
+
}>, z.ZodObject<{
|
|
556
|
+
type: z.ZodLiteral<"structured-data">;
|
|
557
|
+
streamId: z.ZodString;
|
|
558
|
+
dataType: z.ZodString;
|
|
559
|
+
schemaId: z.ZodOptional<z.ZodString>;
|
|
560
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
561
|
+
id: z.ZodOptional<z.ZodString>;
|
|
562
|
+
node: z.ZodOptional<z.ZodString>;
|
|
563
|
+
} & {
|
|
564
|
+
kind: z.ZodLiteral<"final">;
|
|
565
|
+
data: z.ZodUnknown;
|
|
566
|
+
}, "strip", z.ZodTypeAny, {
|
|
567
|
+
type?: "structured-data";
|
|
568
|
+
streamId?: string;
|
|
569
|
+
dataType?: string;
|
|
570
|
+
kind?: "final";
|
|
571
|
+
schemaId?: string;
|
|
572
|
+
schemaVersion?: string;
|
|
573
|
+
id?: string;
|
|
574
|
+
node?: string;
|
|
575
|
+
data?: unknown;
|
|
576
|
+
}, {
|
|
577
|
+
type?: "structured-data";
|
|
578
|
+
streamId?: string;
|
|
579
|
+
dataType?: string;
|
|
580
|
+
kind?: "final";
|
|
581
|
+
schemaId?: string;
|
|
582
|
+
schemaVersion?: string;
|
|
583
|
+
id?: string;
|
|
584
|
+
node?: string;
|
|
585
|
+
data?: unknown;
|
|
586
|
+
}>]>;
|
|
587
|
+
type StructuredDataChunk = z.infer<typeof StructuredDataChunkSchema>;
|
|
588
|
+
|
|
589
|
+
type StructuredStreamState<TData = unknown> = {
|
|
590
|
+
streamId: string;
|
|
591
|
+
dataType: string;
|
|
592
|
+
status: "streaming" | "done";
|
|
593
|
+
data: TData;
|
|
594
|
+
node?: string;
|
|
595
|
+
id?: string;
|
|
596
|
+
schemaId?: string;
|
|
597
|
+
schemaVersion?: string;
|
|
598
|
+
};
|
|
599
|
+
declare function applyStructuredChunk<TData = unknown>(current: StructuredStreamState<TData> | undefined, chunk: StructuredDataChunk): StructuredStreamState<TData>;
|
|
600
|
+
declare function reduceStructuredChunks<TData = unknown>(chunks: StructuredDataChunk[]): Record<string, StructuredStreamState<TData>>;
|
|
601
|
+
|
|
602
|
+
type StructuredStreamAccumulator<TData = unknown> = {
|
|
603
|
+
apply: (chunk: StructuredDataChunk) => StructuredStreamState<TData>;
|
|
604
|
+
applyStreamChunk: (chunk: StreamChunk) => StructuredStreamState<TData> | undefined;
|
|
605
|
+
get: (streamId: string) => StructuredStreamState<TData> | undefined;
|
|
606
|
+
has: (streamId: string) => boolean;
|
|
607
|
+
delete: (streamId: string) => boolean;
|
|
608
|
+
clear: () => void;
|
|
609
|
+
size: () => number;
|
|
610
|
+
entries: () => Array<[string, StructuredStreamState<TData>]>;
|
|
611
|
+
values: () => StructuredStreamState<TData>[];
|
|
612
|
+
toRecord: () => Record<string, StructuredStreamState<TData>>;
|
|
613
|
+
};
|
|
614
|
+
declare function createStructuredStreamAccumulator<TData = unknown>(initialChunks?: Iterable<StructuredDataChunk>): StructuredStreamAccumulator<TData>;
|
|
615
|
+
|
|
616
|
+
export { type ConsumeStreamHandlers as C, type StreamChunk as S, type StructuredDataChunk as a, StreamChunkSchema as b, type StreamFromRouteArgs as c, StructuredDataChunkSchema as d, type StructuredStreamAccumulator as e, type StructuredStreamState as f, applyStructuredChunk as g, consumeStream as h, createStructuredStreamAccumulator as i, reduceStructuredChunks as j, readStream as r, streamFromRoute as s };
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as ConsumeStreamHandlers, S as StreamChunk,
|
|
1
|
+
export { C as ConsumeStreamHandlers, S as StreamChunk, c as StreamFromRouteArgs, a as StructuredDataChunk, e as StructuredStreamAccumulator, f as StructuredStreamState, g as applyStructuredChunk, h as consumeStream, i as createStructuredStreamAccumulator, r as readStream, j as reduceStructuredChunks, s as streamFromRoute } from './browser-DBfCMmkm.js';
|
|
2
2
|
import 'zod';
|