@effect-uai/responses 0.2.0 → 0.4.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/OpenAIEmbedding.d.mts +53 -0
- package/dist/OpenAIEmbedding.d.mts.map +1 -0
- package/dist/OpenAIEmbedding.mjs +157 -0
- package/dist/OpenAIEmbedding.mjs.map +1 -0
- package/dist/Responses.d.mts +96 -0
- package/dist/Responses.d.mts.map +1 -0
- package/dist/Responses.mjs +194 -0
- package/dist/Responses.mjs.map +1 -0
- package/dist/codec.d.mts +133 -0
- package/dist/codec.d.mts.map +1 -0
- package/dist/codec.mjs +218 -0
- package/dist/codec.mjs.map +1 -0
- package/dist/index.d.mts +6 -828
- package/dist/index.mjs +6 -525
- package/dist/models.d.mts +25 -0
- package/dist/models.d.mts.map +1 -0
- package/dist/models.mjs +1 -0
- package/dist/streamEvents.d.mts +607 -0
- package/dist/streamEvents.d.mts.map +1 -0
- package/dist/streamEvents.mjs +170 -0
- package/dist/streamEvents.mjs.map +1 -0
- package/package.json +20 -12
- package/src/OpenAIEmbedding.ts +275 -0
- package/src/Responses.ts +15 -17
- package/src/codec.ts +75 -66
- package/src/index.ts +3 -2
- package/src/models.ts +18 -0
- package/src/streamEvents.ts +48 -52
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { TurnEvent } from "@effect-uai/core/Turn";
|
|
3
|
+
|
|
4
|
+
//#region src/streamEvents.d.ts
|
|
5
|
+
declare namespace streamEvents_d_exports {
|
|
6
|
+
export { CallIdLookup, KnownProviderEvent, ProviderEvent, eventToDeltas, makeCallIdLookup };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Internal: union of variants we actually know how to decode from the wire.
|
|
10
|
+
* Used as the decode target; failures are caught and re-emitted as `Unknown`.
|
|
11
|
+
*/
|
|
12
|
+
declare const KnownProviderEvent: Schema.Union<readonly [Schema.Struct<{
|
|
13
|
+
readonly type: Schema.Literal<"response.output_item.added">;
|
|
14
|
+
readonly item: Schema.Union<readonly [Schema.Struct<{
|
|
15
|
+
readonly type: Schema.Literal<"message">;
|
|
16
|
+
readonly id: Schema.optional<Schema.String>;
|
|
17
|
+
readonly role: Schema.Literal<"assistant">;
|
|
18
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
19
|
+
readonly type: Schema.Literal<"output_text">;
|
|
20
|
+
readonly text: Schema.String;
|
|
21
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
22
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
23
|
+
readonly url: Schema.String;
|
|
24
|
+
readonly start_index: Schema.Number;
|
|
25
|
+
readonly end_index: Schema.Number;
|
|
26
|
+
readonly title: Schema.String;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
29
|
+
readonly file_id: Schema.String;
|
|
30
|
+
readonly index: Schema.Number;
|
|
31
|
+
}>, Schema.Struct<{
|
|
32
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
33
|
+
readonly container_id: Schema.String;
|
|
34
|
+
readonly file_id: Schema.String;
|
|
35
|
+
readonly start_index: Schema.Number;
|
|
36
|
+
readonly end_index: Schema.Number;
|
|
37
|
+
}>, Schema.Struct<{
|
|
38
|
+
readonly type: Schema.Literal<"file_path">;
|
|
39
|
+
readonly file_id: Schema.String;
|
|
40
|
+
readonly index: Schema.Number;
|
|
41
|
+
}>]>>>>;
|
|
42
|
+
}>, Schema.Struct<{
|
|
43
|
+
readonly type: Schema.Literal<"refusal">;
|
|
44
|
+
readonly refusal: Schema.String;
|
|
45
|
+
}>]>>;
|
|
46
|
+
}>, Schema.Struct<{
|
|
47
|
+
readonly type: Schema.Literal<"function_call">;
|
|
48
|
+
readonly id: Schema.optional<Schema.String>;
|
|
49
|
+
readonly call_id: Schema.String;
|
|
50
|
+
readonly name: Schema.String;
|
|
51
|
+
readonly arguments: Schema.String;
|
|
52
|
+
}>, Schema.Struct<{
|
|
53
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
54
|
+
readonly id: Schema.optional<Schema.String>;
|
|
55
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
56
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
57
|
+
readonly text: Schema.String;
|
|
58
|
+
}>>>;
|
|
59
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
60
|
+
}>]>;
|
|
61
|
+
}>, Schema.Struct<{
|
|
62
|
+
readonly type: Schema.Literal<"response.output_text.delta">;
|
|
63
|
+
readonly delta: Schema.String;
|
|
64
|
+
}>, Schema.Struct<{
|
|
65
|
+
readonly type: Schema.Literal<"response.function_call_arguments.delta">;
|
|
66
|
+
readonly item_id: Schema.String;
|
|
67
|
+
readonly delta: Schema.String;
|
|
68
|
+
}>, Schema.Struct<{
|
|
69
|
+
readonly type: Schema.Literal<"response.reasoning_text.delta">;
|
|
70
|
+
readonly delta: Schema.String;
|
|
71
|
+
}>, Schema.Struct<{
|
|
72
|
+
readonly type: Schema.Literal<"response.reasoning_summary_text.delta">;
|
|
73
|
+
readonly delta: Schema.String;
|
|
74
|
+
}>, Schema.Struct<{
|
|
75
|
+
readonly type: Schema.Literal<"response.refusal.delta">;
|
|
76
|
+
readonly delta: Schema.String;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly type: Schema.Literal<"response.refusal.done">;
|
|
79
|
+
readonly refusal: Schema.optional<Schema.String>;
|
|
80
|
+
}>, Schema.Struct<{
|
|
81
|
+
readonly type: Schema.Literal<"response.completed">;
|
|
82
|
+
readonly response: Schema.Struct<{
|
|
83
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
84
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
85
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"message">;
|
|
87
|
+
readonly id: Schema.optional<Schema.String>;
|
|
88
|
+
readonly role: Schema.Literal<"assistant">;
|
|
89
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
90
|
+
readonly type: Schema.Literal<"output_text">;
|
|
91
|
+
readonly text: Schema.String;
|
|
92
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
93
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
94
|
+
readonly url: Schema.String;
|
|
95
|
+
readonly start_index: Schema.Number;
|
|
96
|
+
readonly end_index: Schema.Number;
|
|
97
|
+
readonly title: Schema.String;
|
|
98
|
+
}>, Schema.Struct<{
|
|
99
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
100
|
+
readonly file_id: Schema.String;
|
|
101
|
+
readonly index: Schema.Number;
|
|
102
|
+
}>, Schema.Struct<{
|
|
103
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
104
|
+
readonly container_id: Schema.String;
|
|
105
|
+
readonly file_id: Schema.String;
|
|
106
|
+
readonly start_index: Schema.Number;
|
|
107
|
+
readonly end_index: Schema.Number;
|
|
108
|
+
}>, Schema.Struct<{
|
|
109
|
+
readonly type: Schema.Literal<"file_path">;
|
|
110
|
+
readonly file_id: Schema.String;
|
|
111
|
+
readonly index: Schema.Number;
|
|
112
|
+
}>]>>>>;
|
|
113
|
+
}>, Schema.Struct<{
|
|
114
|
+
readonly type: Schema.Literal<"refusal">;
|
|
115
|
+
readonly refusal: Schema.String;
|
|
116
|
+
}>]>>;
|
|
117
|
+
}>, Schema.Struct<{
|
|
118
|
+
readonly type: Schema.Literal<"function_call">;
|
|
119
|
+
readonly id: Schema.optional<Schema.String>;
|
|
120
|
+
readonly call_id: Schema.String;
|
|
121
|
+
readonly name: Schema.String;
|
|
122
|
+
readonly arguments: Schema.String;
|
|
123
|
+
}>, Schema.Struct<{
|
|
124
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
125
|
+
readonly id: Schema.optional<Schema.String>;
|
|
126
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
127
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
128
|
+
readonly text: Schema.String;
|
|
129
|
+
}>>>;
|
|
130
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
131
|
+
}>]>>>>;
|
|
132
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
133
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
134
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
135
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
136
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
137
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
138
|
+
}>>>;
|
|
139
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
140
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
141
|
+
}>>>;
|
|
142
|
+
}>>>;
|
|
143
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
144
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
145
|
+
}>>>;
|
|
146
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
147
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
148
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
149
|
+
}>>>;
|
|
150
|
+
}>;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly type: Schema.Literal<"response.incomplete">;
|
|
153
|
+
readonly response: Schema.Struct<{
|
|
154
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
155
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
156
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
157
|
+
readonly type: Schema.Literal<"message">;
|
|
158
|
+
readonly id: Schema.optional<Schema.String>;
|
|
159
|
+
readonly role: Schema.Literal<"assistant">;
|
|
160
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
161
|
+
readonly type: Schema.Literal<"output_text">;
|
|
162
|
+
readonly text: Schema.String;
|
|
163
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
164
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
165
|
+
readonly url: Schema.String;
|
|
166
|
+
readonly start_index: Schema.Number;
|
|
167
|
+
readonly end_index: Schema.Number;
|
|
168
|
+
readonly title: Schema.String;
|
|
169
|
+
}>, Schema.Struct<{
|
|
170
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
171
|
+
readonly file_id: Schema.String;
|
|
172
|
+
readonly index: Schema.Number;
|
|
173
|
+
}>, Schema.Struct<{
|
|
174
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
175
|
+
readonly container_id: Schema.String;
|
|
176
|
+
readonly file_id: Schema.String;
|
|
177
|
+
readonly start_index: Schema.Number;
|
|
178
|
+
readonly end_index: Schema.Number;
|
|
179
|
+
}>, Schema.Struct<{
|
|
180
|
+
readonly type: Schema.Literal<"file_path">;
|
|
181
|
+
readonly file_id: Schema.String;
|
|
182
|
+
readonly index: Schema.Number;
|
|
183
|
+
}>]>>>>;
|
|
184
|
+
}>, Schema.Struct<{
|
|
185
|
+
readonly type: Schema.Literal<"refusal">;
|
|
186
|
+
readonly refusal: Schema.String;
|
|
187
|
+
}>]>>;
|
|
188
|
+
}>, Schema.Struct<{
|
|
189
|
+
readonly type: Schema.Literal<"function_call">;
|
|
190
|
+
readonly id: Schema.optional<Schema.String>;
|
|
191
|
+
readonly call_id: Schema.String;
|
|
192
|
+
readonly name: Schema.String;
|
|
193
|
+
readonly arguments: Schema.String;
|
|
194
|
+
}>, Schema.Struct<{
|
|
195
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
196
|
+
readonly id: Schema.optional<Schema.String>;
|
|
197
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
198
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
199
|
+
readonly text: Schema.String;
|
|
200
|
+
}>>>;
|
|
201
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
202
|
+
}>]>>>>;
|
|
203
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
204
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
205
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
206
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
207
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
208
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
209
|
+
}>>>;
|
|
210
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
211
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
212
|
+
}>>>;
|
|
213
|
+
}>>>;
|
|
214
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
215
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
216
|
+
}>>>;
|
|
217
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
218
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
219
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
220
|
+
}>>>;
|
|
221
|
+
}>;
|
|
222
|
+
}>, Schema.Struct<{
|
|
223
|
+
readonly type: Schema.Literal<"response.failed">;
|
|
224
|
+
readonly response: Schema.Struct<{
|
|
225
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
226
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
227
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
228
|
+
readonly type: Schema.Literal<"message">;
|
|
229
|
+
readonly id: Schema.optional<Schema.String>;
|
|
230
|
+
readonly role: Schema.Literal<"assistant">;
|
|
231
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
232
|
+
readonly type: Schema.Literal<"output_text">;
|
|
233
|
+
readonly text: Schema.String;
|
|
234
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
235
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
236
|
+
readonly url: Schema.String;
|
|
237
|
+
readonly start_index: Schema.Number;
|
|
238
|
+
readonly end_index: Schema.Number;
|
|
239
|
+
readonly title: Schema.String;
|
|
240
|
+
}>, Schema.Struct<{
|
|
241
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
242
|
+
readonly file_id: Schema.String;
|
|
243
|
+
readonly index: Schema.Number;
|
|
244
|
+
}>, Schema.Struct<{
|
|
245
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
246
|
+
readonly container_id: Schema.String;
|
|
247
|
+
readonly file_id: Schema.String;
|
|
248
|
+
readonly start_index: Schema.Number;
|
|
249
|
+
readonly end_index: Schema.Number;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly type: Schema.Literal<"file_path">;
|
|
252
|
+
readonly file_id: Schema.String;
|
|
253
|
+
readonly index: Schema.Number;
|
|
254
|
+
}>]>>>>;
|
|
255
|
+
}>, Schema.Struct<{
|
|
256
|
+
readonly type: Schema.Literal<"refusal">;
|
|
257
|
+
readonly refusal: Schema.String;
|
|
258
|
+
}>]>>;
|
|
259
|
+
}>, Schema.Struct<{
|
|
260
|
+
readonly type: Schema.Literal<"function_call">;
|
|
261
|
+
readonly id: Schema.optional<Schema.String>;
|
|
262
|
+
readonly call_id: Schema.String;
|
|
263
|
+
readonly name: Schema.String;
|
|
264
|
+
readonly arguments: Schema.String;
|
|
265
|
+
}>, Schema.Struct<{
|
|
266
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
267
|
+
readonly id: Schema.optional<Schema.String>;
|
|
268
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
269
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
270
|
+
readonly text: Schema.String;
|
|
271
|
+
}>>>;
|
|
272
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
273
|
+
}>]>>>>;
|
|
274
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
275
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
276
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
277
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
278
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
279
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
280
|
+
}>>>;
|
|
281
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
282
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
283
|
+
}>>>;
|
|
284
|
+
}>>>;
|
|
285
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
286
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
287
|
+
}>>>;
|
|
288
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
289
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
290
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
291
|
+
}>>>;
|
|
292
|
+
}>;
|
|
293
|
+
}>, Schema.Struct<{
|
|
294
|
+
readonly type: Schema.Literal<"error">;
|
|
295
|
+
readonly message: Schema.optional<Schema.String>;
|
|
296
|
+
readonly code: Schema.optional<Schema.String>;
|
|
297
|
+
}>]>;
|
|
298
|
+
/**
|
|
299
|
+
* Public: every event the native stream can emit. Discriminated on `type`.
|
|
300
|
+
* The `_unknown` branch closes the cardinality so downstream `Match.exhaustive`
|
|
301
|
+
* cannot silently miss a wire event we didn't model.
|
|
302
|
+
*/
|
|
303
|
+
declare const ProviderEvent: Schema.Union<readonly [Schema.Struct<{
|
|
304
|
+
readonly type: Schema.Literal<"response.output_item.added">;
|
|
305
|
+
readonly item: Schema.Union<readonly [Schema.Struct<{
|
|
306
|
+
readonly type: Schema.Literal<"message">;
|
|
307
|
+
readonly id: Schema.optional<Schema.String>;
|
|
308
|
+
readonly role: Schema.Literal<"assistant">;
|
|
309
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
310
|
+
readonly type: Schema.Literal<"output_text">;
|
|
311
|
+
readonly text: Schema.String;
|
|
312
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
313
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
314
|
+
readonly url: Schema.String;
|
|
315
|
+
readonly start_index: Schema.Number;
|
|
316
|
+
readonly end_index: Schema.Number;
|
|
317
|
+
readonly title: Schema.String;
|
|
318
|
+
}>, Schema.Struct<{
|
|
319
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
320
|
+
readonly file_id: Schema.String;
|
|
321
|
+
readonly index: Schema.Number;
|
|
322
|
+
}>, Schema.Struct<{
|
|
323
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
324
|
+
readonly container_id: Schema.String;
|
|
325
|
+
readonly file_id: Schema.String;
|
|
326
|
+
readonly start_index: Schema.Number;
|
|
327
|
+
readonly end_index: Schema.Number;
|
|
328
|
+
}>, Schema.Struct<{
|
|
329
|
+
readonly type: Schema.Literal<"file_path">;
|
|
330
|
+
readonly file_id: Schema.String;
|
|
331
|
+
readonly index: Schema.Number;
|
|
332
|
+
}>]>>>>;
|
|
333
|
+
}>, Schema.Struct<{
|
|
334
|
+
readonly type: Schema.Literal<"refusal">;
|
|
335
|
+
readonly refusal: Schema.String;
|
|
336
|
+
}>]>>;
|
|
337
|
+
}>, Schema.Struct<{
|
|
338
|
+
readonly type: Schema.Literal<"function_call">;
|
|
339
|
+
readonly id: Schema.optional<Schema.String>;
|
|
340
|
+
readonly call_id: Schema.String;
|
|
341
|
+
readonly name: Schema.String;
|
|
342
|
+
readonly arguments: Schema.String;
|
|
343
|
+
}>, Schema.Struct<{
|
|
344
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
345
|
+
readonly id: Schema.optional<Schema.String>;
|
|
346
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
347
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
348
|
+
readonly text: Schema.String;
|
|
349
|
+
}>>>;
|
|
350
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
351
|
+
}>]>;
|
|
352
|
+
}>, Schema.Struct<{
|
|
353
|
+
readonly type: Schema.Literal<"response.output_text.delta">;
|
|
354
|
+
readonly delta: Schema.String;
|
|
355
|
+
}>, Schema.Struct<{
|
|
356
|
+
readonly type: Schema.Literal<"response.function_call_arguments.delta">;
|
|
357
|
+
readonly item_id: Schema.String;
|
|
358
|
+
readonly delta: Schema.String;
|
|
359
|
+
}>, Schema.Struct<{
|
|
360
|
+
readonly type: Schema.Literal<"response.reasoning_text.delta">;
|
|
361
|
+
readonly delta: Schema.String;
|
|
362
|
+
}>, Schema.Struct<{
|
|
363
|
+
readonly type: Schema.Literal<"response.reasoning_summary_text.delta">;
|
|
364
|
+
readonly delta: Schema.String;
|
|
365
|
+
}>, Schema.Struct<{
|
|
366
|
+
readonly type: Schema.Literal<"response.refusal.delta">;
|
|
367
|
+
readonly delta: Schema.String;
|
|
368
|
+
}>, Schema.Struct<{
|
|
369
|
+
readonly type: Schema.Literal<"response.refusal.done">;
|
|
370
|
+
readonly refusal: Schema.optional<Schema.String>;
|
|
371
|
+
}>, Schema.Struct<{
|
|
372
|
+
readonly type: Schema.Literal<"response.completed">;
|
|
373
|
+
readonly response: Schema.Struct<{
|
|
374
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
375
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
376
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
377
|
+
readonly type: Schema.Literal<"message">;
|
|
378
|
+
readonly id: Schema.optional<Schema.String>;
|
|
379
|
+
readonly role: Schema.Literal<"assistant">;
|
|
380
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
381
|
+
readonly type: Schema.Literal<"output_text">;
|
|
382
|
+
readonly text: Schema.String;
|
|
383
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
384
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
385
|
+
readonly url: Schema.String;
|
|
386
|
+
readonly start_index: Schema.Number;
|
|
387
|
+
readonly end_index: Schema.Number;
|
|
388
|
+
readonly title: Schema.String;
|
|
389
|
+
}>, Schema.Struct<{
|
|
390
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
391
|
+
readonly file_id: Schema.String;
|
|
392
|
+
readonly index: Schema.Number;
|
|
393
|
+
}>, Schema.Struct<{
|
|
394
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
395
|
+
readonly container_id: Schema.String;
|
|
396
|
+
readonly file_id: Schema.String;
|
|
397
|
+
readonly start_index: Schema.Number;
|
|
398
|
+
readonly end_index: Schema.Number;
|
|
399
|
+
}>, Schema.Struct<{
|
|
400
|
+
readonly type: Schema.Literal<"file_path">;
|
|
401
|
+
readonly file_id: Schema.String;
|
|
402
|
+
readonly index: Schema.Number;
|
|
403
|
+
}>]>>>>;
|
|
404
|
+
}>, Schema.Struct<{
|
|
405
|
+
readonly type: Schema.Literal<"refusal">;
|
|
406
|
+
readonly refusal: Schema.String;
|
|
407
|
+
}>]>>;
|
|
408
|
+
}>, Schema.Struct<{
|
|
409
|
+
readonly type: Schema.Literal<"function_call">;
|
|
410
|
+
readonly id: Schema.optional<Schema.String>;
|
|
411
|
+
readonly call_id: Schema.String;
|
|
412
|
+
readonly name: Schema.String;
|
|
413
|
+
readonly arguments: Schema.String;
|
|
414
|
+
}>, Schema.Struct<{
|
|
415
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
416
|
+
readonly id: Schema.optional<Schema.String>;
|
|
417
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
418
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
419
|
+
readonly text: Schema.String;
|
|
420
|
+
}>>>;
|
|
421
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
422
|
+
}>]>>>>;
|
|
423
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
424
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
425
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
426
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
427
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
428
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
429
|
+
}>>>;
|
|
430
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
431
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
432
|
+
}>>>;
|
|
433
|
+
}>>>;
|
|
434
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
435
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
436
|
+
}>>>;
|
|
437
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
438
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
439
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
440
|
+
}>>>;
|
|
441
|
+
}>;
|
|
442
|
+
}>, Schema.Struct<{
|
|
443
|
+
readonly type: Schema.Literal<"response.incomplete">;
|
|
444
|
+
readonly response: Schema.Struct<{
|
|
445
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
446
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
447
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
448
|
+
readonly type: Schema.Literal<"message">;
|
|
449
|
+
readonly id: Schema.optional<Schema.String>;
|
|
450
|
+
readonly role: Schema.Literal<"assistant">;
|
|
451
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
452
|
+
readonly type: Schema.Literal<"output_text">;
|
|
453
|
+
readonly text: Schema.String;
|
|
454
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
455
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
456
|
+
readonly url: Schema.String;
|
|
457
|
+
readonly start_index: Schema.Number;
|
|
458
|
+
readonly end_index: Schema.Number;
|
|
459
|
+
readonly title: Schema.String;
|
|
460
|
+
}>, Schema.Struct<{
|
|
461
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
462
|
+
readonly file_id: Schema.String;
|
|
463
|
+
readonly index: Schema.Number;
|
|
464
|
+
}>, Schema.Struct<{
|
|
465
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
466
|
+
readonly container_id: Schema.String;
|
|
467
|
+
readonly file_id: Schema.String;
|
|
468
|
+
readonly start_index: Schema.Number;
|
|
469
|
+
readonly end_index: Schema.Number;
|
|
470
|
+
}>, Schema.Struct<{
|
|
471
|
+
readonly type: Schema.Literal<"file_path">;
|
|
472
|
+
readonly file_id: Schema.String;
|
|
473
|
+
readonly index: Schema.Number;
|
|
474
|
+
}>]>>>>;
|
|
475
|
+
}>, Schema.Struct<{
|
|
476
|
+
readonly type: Schema.Literal<"refusal">;
|
|
477
|
+
readonly refusal: Schema.String;
|
|
478
|
+
}>]>>;
|
|
479
|
+
}>, Schema.Struct<{
|
|
480
|
+
readonly type: Schema.Literal<"function_call">;
|
|
481
|
+
readonly id: Schema.optional<Schema.String>;
|
|
482
|
+
readonly call_id: Schema.String;
|
|
483
|
+
readonly name: Schema.String;
|
|
484
|
+
readonly arguments: Schema.String;
|
|
485
|
+
}>, Schema.Struct<{
|
|
486
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
487
|
+
readonly id: Schema.optional<Schema.String>;
|
|
488
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
489
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
490
|
+
readonly text: Schema.String;
|
|
491
|
+
}>>>;
|
|
492
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
493
|
+
}>]>>>>;
|
|
494
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
495
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
496
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
497
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
498
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
499
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
500
|
+
}>>>;
|
|
501
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
502
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
503
|
+
}>>>;
|
|
504
|
+
}>>>;
|
|
505
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
506
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
507
|
+
}>>>;
|
|
508
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
509
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
510
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
511
|
+
}>>>;
|
|
512
|
+
}>;
|
|
513
|
+
}>, Schema.Struct<{
|
|
514
|
+
readonly type: Schema.Literal<"response.failed">;
|
|
515
|
+
readonly response: Schema.Struct<{
|
|
516
|
+
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
517
|
+
readonly status: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
518
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
519
|
+
readonly type: Schema.Literal<"message">;
|
|
520
|
+
readonly id: Schema.optional<Schema.String>;
|
|
521
|
+
readonly role: Schema.Literal<"assistant">;
|
|
522
|
+
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
523
|
+
readonly type: Schema.Literal<"output_text">;
|
|
524
|
+
readonly text: Schema.String;
|
|
525
|
+
readonly annotations: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
526
|
+
readonly type: Schema.Literal<"url_citation">;
|
|
527
|
+
readonly url: Schema.String;
|
|
528
|
+
readonly start_index: Schema.Number;
|
|
529
|
+
readonly end_index: Schema.Number;
|
|
530
|
+
readonly title: Schema.String;
|
|
531
|
+
}>, Schema.Struct<{
|
|
532
|
+
readonly type: Schema.Literal<"file_citation">;
|
|
533
|
+
readonly file_id: Schema.String;
|
|
534
|
+
readonly index: Schema.Number;
|
|
535
|
+
}>, Schema.Struct<{
|
|
536
|
+
readonly type: Schema.Literal<"container_file_citation">;
|
|
537
|
+
readonly container_id: Schema.String;
|
|
538
|
+
readonly file_id: Schema.String;
|
|
539
|
+
readonly start_index: Schema.Number;
|
|
540
|
+
readonly end_index: Schema.Number;
|
|
541
|
+
}>, Schema.Struct<{
|
|
542
|
+
readonly type: Schema.Literal<"file_path">;
|
|
543
|
+
readonly file_id: Schema.String;
|
|
544
|
+
readonly index: Schema.Number;
|
|
545
|
+
}>]>>>>;
|
|
546
|
+
}>, Schema.Struct<{
|
|
547
|
+
readonly type: Schema.Literal<"refusal">;
|
|
548
|
+
readonly refusal: Schema.String;
|
|
549
|
+
}>]>>;
|
|
550
|
+
}>, Schema.Struct<{
|
|
551
|
+
readonly type: Schema.Literal<"function_call">;
|
|
552
|
+
readonly id: Schema.optional<Schema.String>;
|
|
553
|
+
readonly call_id: Schema.String;
|
|
554
|
+
readonly name: Schema.String;
|
|
555
|
+
readonly arguments: Schema.String;
|
|
556
|
+
}>, Schema.Struct<{
|
|
557
|
+
readonly type: Schema.Literal<"reasoning">;
|
|
558
|
+
readonly id: Schema.optional<Schema.String>;
|
|
559
|
+
readonly summary: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
560
|
+
readonly type: Schema.Literal<"summary_text">;
|
|
561
|
+
readonly text: Schema.String;
|
|
562
|
+
}>>>;
|
|
563
|
+
readonly encrypted_content: Schema.optional<Schema.String>;
|
|
564
|
+
}>]>>>>;
|
|
565
|
+
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
566
|
+
readonly input_tokens: Schema.optional<Schema.Number>;
|
|
567
|
+
readonly output_tokens: Schema.optional<Schema.Number>;
|
|
568
|
+
readonly total_tokens: Schema.optional<Schema.Number>;
|
|
569
|
+
readonly input_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
570
|
+
readonly cached_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
571
|
+
}>>>;
|
|
572
|
+
readonly output_tokens_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
573
|
+
readonly reasoning_tokens: Schema.optional<Schema.NullOr<Schema.Number>>;
|
|
574
|
+
}>>>;
|
|
575
|
+
}>>>;
|
|
576
|
+
readonly incomplete_details: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
577
|
+
readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
578
|
+
}>>>;
|
|
579
|
+
readonly error: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
580
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
581
|
+
readonly message: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
582
|
+
}>>>;
|
|
583
|
+
}>;
|
|
584
|
+
}>, Schema.Struct<{
|
|
585
|
+
readonly type: Schema.Literal<"error">;
|
|
586
|
+
readonly message: Schema.optional<Schema.String>;
|
|
587
|
+
readonly code: Schema.optional<Schema.String>;
|
|
588
|
+
}>, Schema.Struct<{
|
|
589
|
+
readonly type: Schema.Literal<"_unknown">;
|
|
590
|
+
readonly raw: Schema.Unknown;
|
|
591
|
+
}>]>;
|
|
592
|
+
type ProviderEvent = typeof ProviderEvent.Type;
|
|
593
|
+
type CallIdLookup = {
|
|
594
|
+
readonly resolve: (itemId: string) => string | undefined;
|
|
595
|
+
readonly remember: (itemId: string, callId: string) => void;
|
|
596
|
+
};
|
|
597
|
+
declare const makeCallIdLookup: () => CallIdLookup;
|
|
598
|
+
/**
|
|
599
|
+
* Translate a decoded provider event into zero-or-more `TurnEvent`s.
|
|
600
|
+
* Mutates `lookup` to record `(item_id → call_id)` from `output_item.added`
|
|
601
|
+
* so subsequent `function_call_arguments.delta` events can be tagged with
|
|
602
|
+
* the right call id.
|
|
603
|
+
*/
|
|
604
|
+
declare const eventToDeltas: (event: ProviderEvent, lookup: CallIdLookup) => ReadonlyArray<TurnEvent>;
|
|
605
|
+
//#endregion
|
|
606
|
+
export { CallIdLookup, KnownProviderEvent, ProviderEvent, eventToDeltas, makeCallIdLookup, streamEvents_d_exports as t };
|
|
607
|
+
//# sourceMappingURL=streamEvents.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamEvents.d.mts","names":[],"sources":["../src/streamEvents.ts"],"mappings":";;;;;;;;;;;cAkFa,kBAAA,EAAkB,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmBlB,aAAA,EAAa,MAAA,CAAA,KAAA,WAAA,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAcd,aAAA,UAAuB,aAAA,CAAc,IAAA;AAAA,KAKrC,YAAA;EAAA,SACD,OAAA,GAAU,MAAA;EAAA,SACV,QAAA,GAAW,MAAA,UAAgB,MAAA;AAAA;AAAA,cAGzB,gBAAA,QAAuB,YAAA;;;;;;;cAgBvB,aAAA,GACX,KAAA,EAAO,aAAA,EACP,MAAA,EAAQ,YAAA,KACP,aAAA,CAAc,SAAA"}
|