@kortyx/stream 0.6.1 → 0.8.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 +20 -0
- package/README.md +40 -6
- package/dist/browser-BLO5Ge4b.d.ts +256 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +3 -8
- package/dist/browser.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +45 -19
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
- package/dist/browser-DBfCMmkm.d.ts +0 -616
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
declare const StreamChunkSchema: z.ZodUnion<[z.ZodObject<{
|
|
4
|
-
type: z.ZodLiteral<"session">;
|
|
5
|
-
sessionId: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
type?: "session";
|
|
8
|
-
sessionId?: string;
|
|
9
|
-
}, {
|
|
10
|
-
type?: "session";
|
|
11
|
-
sessionId?: string;
|
|
12
|
-
}>, z.ZodObject<{
|
|
13
|
-
type: z.ZodLiteral<"status">;
|
|
14
|
-
message: z.ZodString;
|
|
15
|
-
node: z.ZodOptional<z.ZodString>;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
type?: "status";
|
|
18
|
-
message?: string;
|
|
19
|
-
node?: string;
|
|
20
|
-
}, {
|
|
21
|
-
type?: "status";
|
|
22
|
-
message?: string;
|
|
23
|
-
node?: string;
|
|
24
|
-
}>, z.ZodObject<{
|
|
25
|
-
type: z.ZodLiteral<"message">;
|
|
26
|
-
content: z.ZodString;
|
|
27
|
-
node: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
type?: "message";
|
|
30
|
-
node?: string;
|
|
31
|
-
content?: string;
|
|
32
|
-
}, {
|
|
33
|
-
type?: "message";
|
|
34
|
-
node?: string;
|
|
35
|
-
content?: string;
|
|
36
|
-
}>, z.ZodObject<{
|
|
37
|
-
type: z.ZodLiteral<"text-start">;
|
|
38
|
-
node: z.ZodOptional<z.ZodString>;
|
|
39
|
-
id: z.ZodOptional<z.ZodString>;
|
|
40
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
41
|
-
segmentId: z.ZodOptional<z.ZodString>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
type?: "text-start";
|
|
44
|
-
id?: string;
|
|
45
|
-
node?: string;
|
|
46
|
-
opId?: string;
|
|
47
|
-
segmentId?: string;
|
|
48
|
-
}, {
|
|
49
|
-
type?: "text-start";
|
|
50
|
-
id?: string;
|
|
51
|
-
node?: string;
|
|
52
|
-
opId?: string;
|
|
53
|
-
segmentId?: string;
|
|
54
|
-
}>, z.ZodObject<{
|
|
55
|
-
type: z.ZodLiteral<"text-delta">;
|
|
56
|
-
delta: z.ZodString;
|
|
57
|
-
node: z.ZodOptional<z.ZodString>;
|
|
58
|
-
id: z.ZodOptional<z.ZodString>;
|
|
59
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
60
|
-
segmentId: z.ZodOptional<z.ZodString>;
|
|
61
|
-
}, "strip", z.ZodTypeAny, {
|
|
62
|
-
type?: "text-delta";
|
|
63
|
-
id?: string;
|
|
64
|
-
node?: string;
|
|
65
|
-
delta?: string;
|
|
66
|
-
opId?: string;
|
|
67
|
-
segmentId?: string;
|
|
68
|
-
}, {
|
|
69
|
-
type?: "text-delta";
|
|
70
|
-
id?: string;
|
|
71
|
-
node?: string;
|
|
72
|
-
delta?: string;
|
|
73
|
-
opId?: string;
|
|
74
|
-
segmentId?: string;
|
|
75
|
-
}>, z.ZodObject<{
|
|
76
|
-
type: z.ZodLiteral<"text-end">;
|
|
77
|
-
node: z.ZodOptional<z.ZodString>;
|
|
78
|
-
id: z.ZodOptional<z.ZodString>;
|
|
79
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
80
|
-
segmentId: z.ZodOptional<z.ZodString>;
|
|
81
|
-
}, "strip", z.ZodTypeAny, {
|
|
82
|
-
type?: "text-end";
|
|
83
|
-
id?: string;
|
|
84
|
-
node?: string;
|
|
85
|
-
opId?: string;
|
|
86
|
-
segmentId?: string;
|
|
87
|
-
}, {
|
|
88
|
-
type?: "text-end";
|
|
89
|
-
id?: string;
|
|
90
|
-
node?: string;
|
|
91
|
-
opId?: string;
|
|
92
|
-
segmentId?: string;
|
|
93
|
-
}>, z.ZodObject<{
|
|
94
|
-
type: z.ZodLiteral<"tool-result">;
|
|
95
|
-
tool: z.ZodOptional<z.ZodString>;
|
|
96
|
-
node: z.ZodOptional<z.ZodString>;
|
|
97
|
-
content: z.ZodUnknown;
|
|
98
|
-
}, "strip", z.ZodTypeAny, {
|
|
99
|
-
type?: "tool-result";
|
|
100
|
-
node?: string;
|
|
101
|
-
content?: unknown;
|
|
102
|
-
tool?: string;
|
|
103
|
-
}, {
|
|
104
|
-
type?: "tool-result";
|
|
105
|
-
node?: string;
|
|
106
|
-
content?: unknown;
|
|
107
|
-
tool?: string;
|
|
108
|
-
}>, z.ZodObject<{
|
|
109
|
-
type: z.ZodLiteral<"interrupt">;
|
|
110
|
-
requestId: z.ZodString;
|
|
111
|
-
resumeToken: z.ZodString;
|
|
112
|
-
workflow: z.ZodOptional<z.ZodString>;
|
|
113
|
-
node: z.ZodOptional<z.ZodString>;
|
|
114
|
-
id: z.ZodOptional<z.ZodString>;
|
|
115
|
-
opId: z.ZodOptional<z.ZodString>;
|
|
116
|
-
schemaId: z.ZodOptional<z.ZodString>;
|
|
117
|
-
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
118
|
-
input: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
119
|
-
kind: z.ZodLiteral<"text">;
|
|
120
|
-
multiple: z.ZodBoolean;
|
|
121
|
-
question: z.ZodOptional<z.ZodString>;
|
|
122
|
-
id: z.ZodOptional<z.ZodString>;
|
|
123
|
-
schemaId: z.ZodOptional<z.ZodString>;
|
|
124
|
-
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
125
|
-
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
-
options: z.ZodOptional<z.ZodArray<z.ZodNever, "many">>;
|
|
127
|
-
}, "strip", z.ZodTypeAny, {
|
|
128
|
-
options?: never[];
|
|
129
|
-
kind?: "text";
|
|
130
|
-
schemaId?: string;
|
|
131
|
-
schemaVersion?: string;
|
|
132
|
-
id?: string;
|
|
133
|
-
multiple?: boolean;
|
|
134
|
-
question?: string;
|
|
135
|
-
meta?: Record<string, unknown>;
|
|
136
|
-
}, {
|
|
137
|
-
options?: never[];
|
|
138
|
-
kind?: "text";
|
|
139
|
-
schemaId?: string;
|
|
140
|
-
schemaVersion?: string;
|
|
141
|
-
id?: string;
|
|
142
|
-
multiple?: boolean;
|
|
143
|
-
question?: string;
|
|
144
|
-
meta?: Record<string, unknown>;
|
|
145
|
-
}>, z.ZodObject<{
|
|
146
|
-
kind: z.ZodEnum<["choice", "multi-choice"]>;
|
|
147
|
-
multiple: z.ZodBoolean;
|
|
148
|
-
question: z.ZodString;
|
|
149
|
-
id: z.ZodOptional<z.ZodString>;
|
|
150
|
-
schemaId: z.ZodOptional<z.ZodString>;
|
|
151
|
-
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
152
|
-
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
153
|
-
options: z.ZodArray<z.ZodObject<{
|
|
154
|
-
id: z.ZodString;
|
|
155
|
-
label: z.ZodString;
|
|
156
|
-
description: z.ZodOptional<z.ZodString>;
|
|
157
|
-
}, "strip", z.ZodTypeAny, {
|
|
158
|
-
id?: string;
|
|
159
|
-
label?: string;
|
|
160
|
-
description?: string;
|
|
161
|
-
}, {
|
|
162
|
-
id?: string;
|
|
163
|
-
label?: string;
|
|
164
|
-
description?: string;
|
|
165
|
-
}>, "many">;
|
|
166
|
-
}, "strip", z.ZodTypeAny, {
|
|
167
|
-
options?: {
|
|
168
|
-
id?: string;
|
|
169
|
-
label?: string;
|
|
170
|
-
description?: string;
|
|
171
|
-
}[];
|
|
172
|
-
kind?: "choice" | "multi-choice";
|
|
173
|
-
schemaId?: string;
|
|
174
|
-
schemaVersion?: string;
|
|
175
|
-
id?: string;
|
|
176
|
-
multiple?: boolean;
|
|
177
|
-
question?: string;
|
|
178
|
-
meta?: Record<string, unknown>;
|
|
179
|
-
}, {
|
|
180
|
-
options?: {
|
|
181
|
-
id?: string;
|
|
182
|
-
label?: string;
|
|
183
|
-
description?: string;
|
|
184
|
-
}[];
|
|
185
|
-
kind?: "choice" | "multi-choice";
|
|
186
|
-
schemaId?: string;
|
|
187
|
-
schemaVersion?: string;
|
|
188
|
-
id?: string;
|
|
189
|
-
multiple?: boolean;
|
|
190
|
-
question?: string;
|
|
191
|
-
meta?: Record<string, unknown>;
|
|
192
|
-
}>]>;
|
|
193
|
-
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
type?: "interrupt";
|
|
196
|
-
schemaId?: string;
|
|
197
|
-
schemaVersion?: string;
|
|
198
|
-
id?: string;
|
|
199
|
-
node?: string;
|
|
200
|
-
opId?: string;
|
|
201
|
-
requestId?: string;
|
|
202
|
-
resumeToken?: string;
|
|
203
|
-
workflow?: string;
|
|
204
|
-
input?: {
|
|
205
|
-
options?: never[];
|
|
206
|
-
kind?: "text";
|
|
207
|
-
schemaId?: string;
|
|
208
|
-
schemaVersion?: string;
|
|
209
|
-
id?: string;
|
|
210
|
-
multiple?: boolean;
|
|
211
|
-
question?: string;
|
|
212
|
-
meta?: Record<string, unknown>;
|
|
213
|
-
} | {
|
|
214
|
-
options?: {
|
|
215
|
-
id?: string;
|
|
216
|
-
label?: string;
|
|
217
|
-
description?: string;
|
|
218
|
-
}[];
|
|
219
|
-
kind?: "choice" | "multi-choice";
|
|
220
|
-
schemaId?: string;
|
|
221
|
-
schemaVersion?: string;
|
|
222
|
-
id?: string;
|
|
223
|
-
multiple?: boolean;
|
|
224
|
-
question?: string;
|
|
225
|
-
meta?: Record<string, unknown>;
|
|
226
|
-
};
|
|
227
|
-
meta?: Record<string, unknown>;
|
|
228
|
-
}, {
|
|
229
|
-
type?: "interrupt";
|
|
230
|
-
schemaId?: string;
|
|
231
|
-
schemaVersion?: string;
|
|
232
|
-
id?: string;
|
|
233
|
-
node?: string;
|
|
234
|
-
opId?: string;
|
|
235
|
-
requestId?: string;
|
|
236
|
-
resumeToken?: string;
|
|
237
|
-
workflow?: string;
|
|
238
|
-
input?: {
|
|
239
|
-
options?: never[];
|
|
240
|
-
kind?: "text";
|
|
241
|
-
schemaId?: string;
|
|
242
|
-
schemaVersion?: string;
|
|
243
|
-
id?: string;
|
|
244
|
-
multiple?: boolean;
|
|
245
|
-
question?: string;
|
|
246
|
-
meta?: Record<string, unknown>;
|
|
247
|
-
} | {
|
|
248
|
-
options?: {
|
|
249
|
-
id?: string;
|
|
250
|
-
label?: string;
|
|
251
|
-
description?: string;
|
|
252
|
-
}[];
|
|
253
|
-
kind?: "choice" | "multi-choice";
|
|
254
|
-
schemaId?: string;
|
|
255
|
-
schemaVersion?: string;
|
|
256
|
-
id?: string;
|
|
257
|
-
multiple?: boolean;
|
|
258
|
-
question?: string;
|
|
259
|
-
meta?: Record<string, unknown>;
|
|
260
|
-
};
|
|
261
|
-
meta?: Record<string, unknown>;
|
|
262
|
-
}>, z.ZodUnion<[z.ZodObject<{
|
|
263
|
-
type: z.ZodLiteral<"structured-data">;
|
|
264
|
-
streamId: z.ZodString;
|
|
265
|
-
dataType: z.ZodString;
|
|
266
|
-
schemaId: z.ZodOptional<z.ZodString>;
|
|
267
|
-
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
268
|
-
id: z.ZodOptional<z.ZodString>;
|
|
269
|
-
node: z.ZodOptional<z.ZodString>;
|
|
270
|
-
} & {
|
|
271
|
-
kind: z.ZodLiteral<"set">;
|
|
272
|
-
path: z.ZodString;
|
|
273
|
-
value: z.ZodUnknown;
|
|
274
|
-
}, "strip", z.ZodTypeAny, {
|
|
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;
|
|
283
|
-
id?: string;
|
|
284
|
-
node?: string;
|
|
285
|
-
}, {
|
|
286
|
-
type?: "structured-data";
|
|
287
|
-
value?: unknown;
|
|
288
|
-
path?: string;
|
|
289
|
-
streamId?: string;
|
|
290
|
-
dataType?: string;
|
|
291
|
-
kind?: "set";
|
|
292
|
-
schemaId?: string;
|
|
293
|
-
schemaVersion?: string;
|
|
294
|
-
id?: string;
|
|
295
|
-
node?: string;
|
|
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[];
|
|
319
|
-
}, {
|
|
320
|
-
type?: "structured-data";
|
|
321
|
-
path?: string;
|
|
322
|
-
streamId?: string;
|
|
323
|
-
dataType?: string;
|
|
324
|
-
kind?: "append";
|
|
325
|
-
schemaId?: string;
|
|
326
|
-
schemaVersion?: string;
|
|
327
|
-
id?: string;
|
|
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";
|
|
348
|
-
schemaId?: string;
|
|
349
|
-
schemaVersion?: string;
|
|
350
|
-
id?: string;
|
|
351
|
-
node?: string;
|
|
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;
|
|
364
|
-
}>, z.ZodObject<{
|
|
365
|
-
type: z.ZodLiteral<"structured-data">;
|
|
366
|
-
streamId: z.ZodString;
|
|
367
|
-
dataType: z.ZodString;
|
|
368
|
-
schemaId: z.ZodOptional<z.ZodString>;
|
|
369
|
-
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
370
|
-
id: z.ZodOptional<z.ZodString>;
|
|
371
|
-
node: z.ZodOptional<z.ZodString>;
|
|
372
|
-
} & {
|
|
373
|
-
kind: z.ZodLiteral<"final">;
|
|
374
|
-
data: z.ZodUnknown;
|
|
375
|
-
}, "strip", z.ZodTypeAny, {
|
|
376
|
-
type?: "structured-data";
|
|
377
|
-
streamId?: string;
|
|
378
|
-
dataType?: string;
|
|
379
|
-
kind?: "final";
|
|
380
|
-
schemaId?: string;
|
|
381
|
-
schemaVersion?: string;
|
|
382
|
-
id?: string;
|
|
383
|
-
node?: string;
|
|
384
|
-
data?: unknown;
|
|
385
|
-
}, {
|
|
386
|
-
type?: "structured-data";
|
|
387
|
-
streamId?: string;
|
|
388
|
-
dataType?: string;
|
|
389
|
-
kind?: "final";
|
|
390
|
-
schemaId?: string;
|
|
391
|
-
schemaVersion?: string;
|
|
392
|
-
id?: string;
|
|
393
|
-
node?: string;
|
|
394
|
-
data?: unknown;
|
|
395
|
-
}>]>, z.ZodObject<{
|
|
396
|
-
type: z.ZodLiteral<"transition">;
|
|
397
|
-
transitionTo: z.ZodString;
|
|
398
|
-
payload: z.ZodOptional<z.ZodAny>;
|
|
399
|
-
}, "strip", z.ZodTypeAny, {
|
|
400
|
-
type?: "transition";
|
|
401
|
-
transitionTo?: string;
|
|
402
|
-
payload?: any;
|
|
403
|
-
}, {
|
|
404
|
-
type?: "transition";
|
|
405
|
-
transitionTo?: string;
|
|
406
|
-
payload?: any;
|
|
407
|
-
}>, z.ZodObject<{
|
|
408
|
-
type: z.ZodLiteral<"done">;
|
|
409
|
-
data: z.ZodOptional<z.ZodAny>;
|
|
410
|
-
}, "strip", z.ZodTypeAny, {
|
|
411
|
-
type?: "done";
|
|
412
|
-
data?: any;
|
|
413
|
-
}, {
|
|
414
|
-
type?: "done";
|
|
415
|
-
data?: any;
|
|
416
|
-
}>, z.ZodObject<{
|
|
417
|
-
type: z.ZodLiteral<"error">;
|
|
418
|
-
message: z.ZodString;
|
|
419
|
-
}, "strip", z.ZodTypeAny, {
|
|
420
|
-
type?: "error";
|
|
421
|
-
message?: string;
|
|
422
|
-
}, {
|
|
423
|
-
type?: "error";
|
|
424
|
-
message?: string;
|
|
425
|
-
}>]>;
|
|
426
|
-
type StreamChunk = z.infer<typeof StreamChunkSchema>;
|
|
427
|
-
|
|
428
|
-
interface ConsumeStreamHandlers {
|
|
429
|
-
onChunk?: (chunk: StreamChunk) => undefined | boolean | Promise<boolean | undefined>;
|
|
430
|
-
onDone?: () => void | Promise<void>;
|
|
431
|
-
onError?: (error: Error, chunk?: StreamChunk) => void | Promise<void>;
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Consume a stream of StreamChunk events with callback handlers.
|
|
435
|
-
* Returns when a `done` chunk is seen, the stream ends, or `onChunk` returns `false`.
|
|
436
|
-
*/
|
|
437
|
-
declare function consumeStream(stream: AsyncIterable<StreamChunk>, handlers?: ConsumeStreamHandlers): Promise<void>;
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Reads a server-sent event (SSE) Response body and yields StreamChunk objects.
|
|
441
|
-
*/
|
|
442
|
-
declare function readStream(body: ReadableStream<Uint8Array> | null): AsyncGenerator<StreamChunk, void, void>;
|
|
443
|
-
|
|
444
|
-
interface StreamFromRouteArgs<TBody = unknown> {
|
|
445
|
-
endpoint: string;
|
|
446
|
-
body: TBody;
|
|
447
|
-
method?: string | undefined;
|
|
448
|
-
fetchImpl?: typeof fetch;
|
|
449
|
-
headers?: Record<string, string> | undefined;
|
|
450
|
-
}
|
|
451
|
-
declare function streamFromRoute<TBody = unknown>(args: StreamFromRouteArgs<TBody>): AsyncGenerator<StreamChunk, void, void>;
|
|
452
|
-
|
|
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 };
|