@ai-sdk/openai 4.0.97 → 4.0.99
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 +23 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +179 -122
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +37 -44
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +151 -100
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +52 -8
- package/package.json +4 -3
- package/src/chat/openai-chat-api.ts +1 -1
- package/src/completion/openai-completion-api.ts +1 -1
- package/src/files/openai-files.ts +1 -11
- package/src/image/openai-image-model-options.ts +40 -39
- package/src/live/openai-realtime-model-live.ts +13 -4
- package/src/openai-batch.ts +2 -2
- package/src/openai-decision-model.ts +71 -50
- package/src/openai-error.ts +22 -14
- package/src/responses/convert-openai-responses-usage.ts +6 -0
- package/src/responses/convert-to-openai-responses-input.ts +23 -11
- package/src/responses/openai-responses-api.ts +230 -192
- package/src/responses/openai-responses-language-model-options.ts +4 -2
- package/src/responses/openai-responses-language-model.ts +11 -0
- package/src/tool/computer.ts +64 -58
- package/src/tool/file-search.ts +15 -12
- package/src/tool/mcp.ts +13 -11
- package/src/tool/shell.ts +28 -21
- package/src/transcription/openai-transcription-api.ts +1 -0
- package/src/transcription/openai-transcription-model.ts +29 -10
|
@@ -8,152 +8,172 @@ import {
|
|
|
8
8
|
import { z } from 'zod/v4';
|
|
9
9
|
import type { OpenAIResponsesToolResultOptions } from './openai-responses-language-model-options';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
z.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
)
|
|
11
|
+
let cachedJsonValueSchema: z.ZodType<JSONValue> | undefined;
|
|
12
|
+
const jsonValueSchema = (): z.ZodType<JSONValue> =>
|
|
13
|
+
(cachedJsonValueSchema ??= z.lazy(() =>
|
|
14
|
+
z.union([
|
|
15
|
+
z.string(),
|
|
16
|
+
z.number(),
|
|
17
|
+
z.boolean(),
|
|
18
|
+
z.null(),
|
|
19
|
+
z.array(jsonValueSchema()),
|
|
20
|
+
z.record(z.string(), jsonValueSchema().optional()),
|
|
21
|
+
]),
|
|
22
|
+
));
|
|
21
23
|
|
|
22
|
-
const jsonObjectSchema =
|
|
24
|
+
const jsonObjectSchema = () =>
|
|
25
|
+
z.record(z.string(), jsonValueSchema().optional());
|
|
26
|
+
|
|
27
|
+
const openaiResponsesUsageSchema = () =>
|
|
28
|
+
z.intersection(
|
|
29
|
+
jsonObjectSchema(),
|
|
30
|
+
z.object({
|
|
31
|
+
input_tokens: z.number(),
|
|
32
|
+
input_tokens_details: z
|
|
33
|
+
.intersection(
|
|
34
|
+
jsonObjectSchema(),
|
|
35
|
+
z.object({
|
|
36
|
+
cached_tokens: z.number().nullish(),
|
|
37
|
+
cache_write_tokens: z.number().nullish(),
|
|
38
|
+
cache_write_tokens_details: z
|
|
39
|
+
.intersection(
|
|
40
|
+
jsonObjectSchema(),
|
|
41
|
+
z.object({
|
|
42
|
+
ttl_30m_tokens: z.number().nullish(),
|
|
43
|
+
ttl_12h_tokens: z.number().nullish(),
|
|
44
|
+
}),
|
|
45
|
+
)
|
|
46
|
+
.nullish(),
|
|
47
|
+
orchestration_input_tokens: z.number().nullish(),
|
|
48
|
+
orchestration_input_cached_tokens: z.number().nullish(),
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
.nullish(),
|
|
52
|
+
output_tokens: z.number(),
|
|
53
|
+
output_tokens_details: z
|
|
54
|
+
.intersection(
|
|
55
|
+
jsonObjectSchema(),
|
|
56
|
+
z.object({
|
|
57
|
+
reasoning_tokens: z.number().nullish(),
|
|
58
|
+
orchestration_output_tokens: z.number().nullish(),
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
.nullish(),
|
|
62
|
+
total_tokens: z.number().optional(),
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
23
65
|
|
|
24
|
-
const
|
|
25
|
-
jsonObjectSchema,
|
|
66
|
+
const openaiResponsesComputerSafetyCheckSchema = () =>
|
|
26
67
|
z.object({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
z.object({
|
|
32
|
-
cached_tokens: z.number().nullish(),
|
|
33
|
-
cache_write_tokens: z.number().nullish(),
|
|
34
|
-
orchestration_input_tokens: z.number().nullish(),
|
|
35
|
-
orchestration_input_cached_tokens: z.number().nullish(),
|
|
36
|
-
}),
|
|
37
|
-
)
|
|
38
|
-
.nullish(),
|
|
39
|
-
output_tokens: z.number(),
|
|
40
|
-
output_tokens_details: z
|
|
41
|
-
.intersection(
|
|
42
|
-
jsonObjectSchema,
|
|
43
|
-
z.object({
|
|
44
|
-
reasoning_tokens: z.number().nullish(),
|
|
45
|
-
orchestration_output_tokens: z.number().nullish(),
|
|
46
|
-
}),
|
|
47
|
-
)
|
|
48
|
-
.nullish(),
|
|
49
|
-
total_tokens: z.number().optional(),
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
68
|
+
id: z.string(),
|
|
69
|
+
code: z.string().nullish(),
|
|
70
|
+
message: z.string().nullish(),
|
|
71
|
+
});
|
|
52
72
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
const openaiResponsesComputerActionSchema = () =>
|
|
74
|
+
z.discriminatedUnion('type', [
|
|
75
|
+
z.object({
|
|
76
|
+
type: z.literal('click'),
|
|
77
|
+
button: z.enum(['left', 'right', 'wheel', 'back', 'forward']),
|
|
78
|
+
x: z.number(),
|
|
79
|
+
y: z.number(),
|
|
80
|
+
keys: z.array(z.string()).nullish(),
|
|
81
|
+
}),
|
|
82
|
+
z.object({
|
|
83
|
+
type: z.literal('double_click'),
|
|
84
|
+
x: z.number(),
|
|
85
|
+
y: z.number(),
|
|
86
|
+
keys: z.array(z.string()).nullish(),
|
|
87
|
+
}),
|
|
88
|
+
z.object({
|
|
89
|
+
type: z.literal('drag'),
|
|
90
|
+
path: z.array(z.object({ x: z.number(), y: z.number() })),
|
|
91
|
+
keys: z.array(z.string()).nullish(),
|
|
92
|
+
}),
|
|
93
|
+
z.object({
|
|
94
|
+
type: z.literal('keypress'),
|
|
95
|
+
keys: z.array(z.string()),
|
|
96
|
+
}),
|
|
97
|
+
z.object({
|
|
98
|
+
type: z.literal('move'),
|
|
99
|
+
x: z.number(),
|
|
100
|
+
y: z.number(),
|
|
101
|
+
keys: z.array(z.string()).nullish(),
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
type: z.literal('screenshot'),
|
|
105
|
+
}),
|
|
106
|
+
z.object({
|
|
107
|
+
type: z.literal('scroll'),
|
|
108
|
+
x: z.number(),
|
|
109
|
+
y: z.number(),
|
|
110
|
+
scroll_x: z.number(),
|
|
111
|
+
scroll_y: z.number(),
|
|
112
|
+
keys: z.array(z.string()).nullish(),
|
|
113
|
+
}),
|
|
114
|
+
z.object({
|
|
115
|
+
type: z.literal('type'),
|
|
116
|
+
text: z.string(),
|
|
117
|
+
}),
|
|
118
|
+
z.object({
|
|
119
|
+
type: z.literal('wait'),
|
|
120
|
+
}),
|
|
121
|
+
]);
|
|
58
122
|
|
|
59
|
-
const
|
|
60
|
-
z.object({
|
|
61
|
-
type: z.literal('click'),
|
|
62
|
-
button: z.enum(['left', 'right', 'wheel', 'back', 'forward']),
|
|
63
|
-
x: z.number(),
|
|
64
|
-
y: z.number(),
|
|
65
|
-
keys: z.array(z.string()).nullish(),
|
|
66
|
-
}),
|
|
67
|
-
z.object({
|
|
68
|
-
type: z.literal('double_click'),
|
|
69
|
-
x: z.number(),
|
|
70
|
-
y: z.number(),
|
|
71
|
-
keys: z.array(z.string()).nullish(),
|
|
72
|
-
}),
|
|
73
|
-
z.object({
|
|
74
|
-
type: z.literal('drag'),
|
|
75
|
-
path: z.array(z.object({ x: z.number(), y: z.number() })),
|
|
76
|
-
keys: z.array(z.string()).nullish(),
|
|
77
|
-
}),
|
|
123
|
+
const openaiResponsesComputerCallSchema = () =>
|
|
78
124
|
z.object({
|
|
79
|
-
type: z.literal('
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
z.
|
|
92
|
-
type: z.literal('
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}),
|
|
99
|
-
z.object({
|
|
100
|
-
type: z.literal('type'),
|
|
101
|
-
text: z.string(),
|
|
102
|
-
}),
|
|
103
|
-
z.object({
|
|
104
|
-
type: z.literal('wait'),
|
|
105
|
-
}),
|
|
106
|
-
]);
|
|
125
|
+
type: z.literal('computer_call'),
|
|
126
|
+
id: z.string(),
|
|
127
|
+
call_id: z.string().nullish(),
|
|
128
|
+
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
129
|
+
action: openaiResponsesComputerActionSchema().nullish(),
|
|
130
|
+
actions: z.array(openaiResponsesComputerActionSchema()).nullish(),
|
|
131
|
+
pending_safety_checks: z
|
|
132
|
+
.array(openaiResponsesComputerSafetyCheckSchema())
|
|
133
|
+
.nullish(),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const openaiResponsesToolCallerSchema = () =>
|
|
137
|
+
z.discriminatedUnion('type', [
|
|
138
|
+
z.object({ type: z.literal('direct') }),
|
|
139
|
+
z.object({
|
|
140
|
+
type: z.literal('program'),
|
|
141
|
+
caller_id: z.string(),
|
|
142
|
+
}),
|
|
143
|
+
]);
|
|
107
144
|
|
|
108
|
-
const
|
|
109
|
-
type: z.literal('computer_call'),
|
|
110
|
-
id: z.string(),
|
|
111
|
-
call_id: z.string().nullish(),
|
|
112
|
-
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
113
|
-
action: openaiResponsesComputerActionSchema.nullish(),
|
|
114
|
-
actions: z.array(openaiResponsesComputerActionSchema).nullish(),
|
|
115
|
-
pending_safety_checks: z
|
|
116
|
-
.array(openaiResponsesComputerSafetyCheckSchema)
|
|
117
|
-
.nullish(),
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const openaiResponsesToolCallerSchema = z.discriminatedUnion('type', [
|
|
121
|
-
z.object({ type: z.literal('direct') }),
|
|
145
|
+
const openaiResponsesProgramSchema = () =>
|
|
122
146
|
z.object({
|
|
123
147
|
type: z.literal('program'),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
148
|
+
id: z.string(),
|
|
149
|
+
call_id: z.string(),
|
|
150
|
+
code: z.string(),
|
|
151
|
+
fingerprint: z.string(),
|
|
152
|
+
});
|
|
127
153
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
timeout_ms: z.number().optional(),
|
|
152
|
-
user: z.string().optional(),
|
|
153
|
-
working_directory: z.string().optional(),
|
|
154
|
-
env: z.record(z.string(), z.string()).optional(),
|
|
155
|
-
}),
|
|
156
|
-
});
|
|
154
|
+
const openaiResponsesProgramOutputSchema = () =>
|
|
155
|
+
z.object({
|
|
156
|
+
type: z.literal('program_output'),
|
|
157
|
+
id: z.string(),
|
|
158
|
+
call_id: z.string(),
|
|
159
|
+
result: z.string(),
|
|
160
|
+
status: z.enum(['completed', 'incomplete']),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const openaiResponsesLocalShellCallSchema = () =>
|
|
164
|
+
z.object({
|
|
165
|
+
type: z.literal('local_shell_call'),
|
|
166
|
+
id: z.string(),
|
|
167
|
+
call_id: z.string(),
|
|
168
|
+
action: z.object({
|
|
169
|
+
type: z.literal('exec'),
|
|
170
|
+
command: z.array(z.string()),
|
|
171
|
+
timeout_ms: z.number().optional(),
|
|
172
|
+
user: z.string().optional(),
|
|
173
|
+
working_directory: z.string().optional(),
|
|
174
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
175
|
+
}),
|
|
176
|
+
});
|
|
157
177
|
|
|
158
178
|
export type OpenAIResponsesInput = Array<OpenAIResponsesInputItem>;
|
|
159
179
|
|
|
@@ -220,6 +240,11 @@ export type OpenAIResponsesApplyPatchOperationDiffDoneChunk = {
|
|
|
220
240
|
diff: string;
|
|
221
241
|
};
|
|
222
242
|
|
|
243
|
+
export type OpenAIResponsesPromptCacheBreakpoint = {
|
|
244
|
+
mode: 'explicit';
|
|
245
|
+
ttl?: '30m' | '12h';
|
|
246
|
+
};
|
|
247
|
+
|
|
223
248
|
export type OpenAIResponsesSystemMessage = {
|
|
224
249
|
type?: 'message';
|
|
225
250
|
role: 'system' | 'developer';
|
|
@@ -228,7 +253,7 @@ export type OpenAIResponsesSystemMessage = {
|
|
|
228
253
|
| Array<{
|
|
229
254
|
type: 'input_text';
|
|
230
255
|
text: string;
|
|
231
|
-
prompt_cache_breakpoint?:
|
|
256
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
232
257
|
}>;
|
|
233
258
|
};
|
|
234
259
|
|
|
@@ -239,33 +264,33 @@ export type OpenAIResponsesUserMessage = {
|
|
|
239
264
|
| {
|
|
240
265
|
type: 'input_text';
|
|
241
266
|
text: string;
|
|
242
|
-
prompt_cache_breakpoint?:
|
|
267
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
243
268
|
}
|
|
244
269
|
| {
|
|
245
270
|
type: 'input_image';
|
|
246
271
|
image_url: string;
|
|
247
|
-
prompt_cache_breakpoint?:
|
|
272
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
248
273
|
}
|
|
249
274
|
| {
|
|
250
275
|
type: 'input_image';
|
|
251
276
|
file_id: string;
|
|
252
|
-
prompt_cache_breakpoint?:
|
|
277
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
253
278
|
}
|
|
254
279
|
| {
|
|
255
280
|
type: 'input_file';
|
|
256
281
|
file_url: string;
|
|
257
|
-
prompt_cache_breakpoint?:
|
|
282
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
258
283
|
}
|
|
259
284
|
| {
|
|
260
285
|
type: 'input_file';
|
|
261
286
|
filename: string;
|
|
262
287
|
file_data: string;
|
|
263
|
-
prompt_cache_breakpoint?:
|
|
288
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
264
289
|
}
|
|
265
290
|
| {
|
|
266
291
|
type: 'input_file';
|
|
267
292
|
file_id: string;
|
|
268
|
-
prompt_cache_breakpoint?:
|
|
293
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
269
294
|
}
|
|
270
295
|
>;
|
|
271
296
|
};
|
|
@@ -297,33 +322,33 @@ export type OpenAIResponsesFunctionCallOutput = {
|
|
|
297
322
|
| {
|
|
298
323
|
type: 'input_text';
|
|
299
324
|
text: string;
|
|
300
|
-
prompt_cache_breakpoint?:
|
|
325
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
301
326
|
}
|
|
302
327
|
| {
|
|
303
328
|
type: 'input_image';
|
|
304
329
|
image_url: string;
|
|
305
|
-
prompt_cache_breakpoint?:
|
|
330
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
306
331
|
}
|
|
307
332
|
| {
|
|
308
333
|
type: 'input_image';
|
|
309
334
|
file_id: string;
|
|
310
|
-
prompt_cache_breakpoint?:
|
|
335
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
311
336
|
}
|
|
312
337
|
| {
|
|
313
338
|
type: 'input_file';
|
|
314
339
|
filename: string;
|
|
315
340
|
file_data: string;
|
|
316
|
-
prompt_cache_breakpoint?:
|
|
341
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
317
342
|
}
|
|
318
343
|
| {
|
|
319
344
|
type: 'input_file';
|
|
320
345
|
file_url: string;
|
|
321
|
-
prompt_cache_breakpoint?:
|
|
346
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
322
347
|
}
|
|
323
348
|
| {
|
|
324
349
|
type: 'input_file';
|
|
325
350
|
file_id: string;
|
|
326
|
-
prompt_cache_breakpoint?:
|
|
351
|
+
prompt_cache_breakpoint?: OpenAIResponsesPromptCacheBreakpoint;
|
|
327
352
|
}
|
|
328
353
|
>;
|
|
329
354
|
caller?: OpenAIResponsesToolCaller;
|
|
@@ -378,11 +403,11 @@ export type OpenAIResponsesMcpApprovalResponse = {
|
|
|
378
403
|
};
|
|
379
404
|
|
|
380
405
|
export type OpenAIResponsesComputerAction = InferSchema<
|
|
381
|
-
typeof openaiResponsesComputerActionSchema
|
|
406
|
+
ReturnType<typeof openaiResponsesComputerActionSchema>
|
|
382
407
|
>;
|
|
383
408
|
|
|
384
409
|
export type OpenAIResponsesComputerCall = InferSchema<
|
|
385
|
-
typeof openaiResponsesComputerCallSchema
|
|
410
|
+
ReturnType<typeof openaiResponsesComputerCallSchema>
|
|
386
411
|
>;
|
|
387
412
|
|
|
388
413
|
export type OpenAIResponsesComputerCallOutput = {
|
|
@@ -402,7 +427,7 @@ export type OpenAIResponsesComputerCallOutput = {
|
|
|
402
427
|
};
|
|
403
428
|
|
|
404
429
|
export type OpenAIResponsesLocalShellCall = InferSchema<
|
|
405
|
-
typeof openaiResponsesLocalShellCallSchema
|
|
430
|
+
ReturnType<typeof openaiResponsesLocalShellCallSchema>
|
|
406
431
|
>;
|
|
407
432
|
|
|
408
433
|
export type OpenAIResponsesLocalShellCallOutput = {
|
|
@@ -778,27 +803,29 @@ export type OpenAIResponsesReasoning = {
|
|
|
778
803
|
// Captured from the Responses API when OpenAI returned an early
|
|
779
804
|
// insufficient_quota stream error after HTTP 200. This shape differs from the
|
|
780
805
|
// currently documented ResponseErrorEvent below.
|
|
781
|
-
const openaiResponsesNestedErrorChunkSchema =
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
})
|
|
806
|
+
const openaiResponsesNestedErrorChunkSchema = () =>
|
|
807
|
+
z.object({
|
|
808
|
+
type: z.literal('error'),
|
|
809
|
+
sequence_number: z.number(),
|
|
810
|
+
error: z.object({
|
|
811
|
+
type: z.string(),
|
|
812
|
+
code: z.string().nullish(),
|
|
813
|
+
message: z.string(),
|
|
814
|
+
param: z.string().nullish(),
|
|
815
|
+
}),
|
|
816
|
+
});
|
|
791
817
|
|
|
792
818
|
// Current OpenAI OpenAPI docs define ResponseErrorEvent with top-level
|
|
793
819
|
// code/message/param fields:
|
|
794
820
|
// https://developers.openai.com/api/reference/resources/responses/streaming-events
|
|
795
|
-
const openaiResponsesErrorChunkSchema =
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
821
|
+
const openaiResponsesErrorChunkSchema = () =>
|
|
822
|
+
z.object({
|
|
823
|
+
type: z.literal('error'),
|
|
824
|
+
sequence_number: z.number(),
|
|
825
|
+
code: z.string().nullish(),
|
|
826
|
+
message: z.string(),
|
|
827
|
+
param: z.string().nullish(),
|
|
828
|
+
});
|
|
802
829
|
|
|
803
830
|
/**
|
|
804
831
|
* Chunk types explicitly modeled by openaiResponsesChunkSchema. Keep this set
|
|
@@ -907,7 +934,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
907
934
|
type: z.enum(['response.completed', 'response.incomplete']),
|
|
908
935
|
response: z.object({
|
|
909
936
|
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
910
|
-
usage: openaiResponsesUsageSchema.nullish(),
|
|
937
|
+
usage: openaiResponsesUsageSchema().nullish(),
|
|
911
938
|
reasoning: z
|
|
912
939
|
.object({
|
|
913
940
|
context: z.string().nullish(),
|
|
@@ -927,7 +954,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
927
954
|
})
|
|
928
955
|
.nullish(),
|
|
929
956
|
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
930
|
-
usage: openaiResponsesUsageSchema.nullish(),
|
|
957
|
+
usage: openaiResponsesUsageSchema().nullish(),
|
|
931
958
|
reasoning: z
|
|
932
959
|
.object({
|
|
933
960
|
context: z.string().nullish(),
|
|
@@ -976,21 +1003,21 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
976
1003
|
arguments: z.string(),
|
|
977
1004
|
async: z.boolean().nullish(),
|
|
978
1005
|
namespace: z.string().nullish(),
|
|
979
|
-
caller: openaiResponsesToolCallerSchema.nullish(),
|
|
1006
|
+
caller: openaiResponsesToolCallerSchema().nullish(),
|
|
980
1007
|
}),
|
|
981
|
-
openaiResponsesProgramSchema,
|
|
982
|
-
openaiResponsesProgramOutputSchema,
|
|
1008
|
+
openaiResponsesProgramSchema(),
|
|
1009
|
+
openaiResponsesProgramOutputSchema(),
|
|
983
1010
|
z.object({
|
|
984
1011
|
type: z.literal('web_search_call'),
|
|
985
1012
|
id: z.string(),
|
|
986
1013
|
status: z.string(),
|
|
987
1014
|
}),
|
|
988
|
-
openaiResponsesComputerCallSchema,
|
|
1015
|
+
openaiResponsesComputerCallSchema(),
|
|
989
1016
|
z.object({
|
|
990
1017
|
type: z.literal('file_search_call'),
|
|
991
1018
|
id: z.string(),
|
|
992
1019
|
}),
|
|
993
|
-
openaiResponsesLocalShellCallSchema,
|
|
1020
|
+
openaiResponsesLocalShellCallSchema(),
|
|
994
1021
|
z.object({
|
|
995
1022
|
type: z.literal('image_generation_call'),
|
|
996
1023
|
id: z.string(),
|
|
@@ -1061,6 +1088,8 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1061
1088
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1062
1089
|
action: z.object({
|
|
1063
1090
|
commands: z.array(z.string()),
|
|
1091
|
+
timeout_ms: z.number().nullish(),
|
|
1092
|
+
max_output_length: z.number().nullish(),
|
|
1064
1093
|
}),
|
|
1065
1094
|
}),
|
|
1066
1095
|
z.object({
|
|
@@ -1073,6 +1102,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1073
1102
|
id: z.string(),
|
|
1074
1103
|
call_id: z.string(),
|
|
1075
1104
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1105
|
+
max_output_length: z.number().nullish(),
|
|
1076
1106
|
output: z.array(
|
|
1077
1107
|
z.object({
|
|
1078
1108
|
stdout: z.string(),
|
|
@@ -1101,7 +1131,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1101
1131
|
execution: z.enum(['server', 'client']),
|
|
1102
1132
|
call_id: z.string().nullable(),
|
|
1103
1133
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1104
|
-
tools: z.array(z.record(z.string(), jsonValueSchema.optional())),
|
|
1134
|
+
tools: z.array(z.record(z.string(), jsonValueSchema().optional())),
|
|
1105
1135
|
}),
|
|
1106
1136
|
]),
|
|
1107
1137
|
}),
|
|
@@ -1128,10 +1158,10 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1128
1158
|
async: z.boolean().nullish(),
|
|
1129
1159
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1130
1160
|
namespace: z.string().nullish(),
|
|
1131
|
-
caller: openaiResponsesToolCallerSchema.nullish(),
|
|
1161
|
+
caller: openaiResponsesToolCallerSchema().nullish(),
|
|
1132
1162
|
}),
|
|
1133
|
-
openaiResponsesProgramSchema,
|
|
1134
|
-
openaiResponsesProgramOutputSchema,
|
|
1163
|
+
openaiResponsesProgramSchema(),
|
|
1164
|
+
openaiResponsesProgramOutputSchema(),
|
|
1135
1165
|
z.object({
|
|
1136
1166
|
type: z.literal('custom_tool_call'),
|
|
1137
1167
|
id: z.string(),
|
|
@@ -1210,8 +1240,8 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1210
1240
|
)
|
|
1211
1241
|
.nullish(),
|
|
1212
1242
|
}),
|
|
1213
|
-
openaiResponsesLocalShellCallSchema,
|
|
1214
|
-
openaiResponsesComputerCallSchema,
|
|
1243
|
+
openaiResponsesLocalShellCallSchema(),
|
|
1244
|
+
openaiResponsesComputerCallSchema(),
|
|
1215
1245
|
z.object({
|
|
1216
1246
|
type: z.literal('mcp_call'),
|
|
1217
1247
|
id: z.string(),
|
|
@@ -1296,6 +1326,8 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1296
1326
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1297
1327
|
action: z.object({
|
|
1298
1328
|
commands: z.array(z.string()),
|
|
1329
|
+
timeout_ms: z.number().nullish(),
|
|
1330
|
+
max_output_length: z.number().nullish(),
|
|
1299
1331
|
}),
|
|
1300
1332
|
}),
|
|
1301
1333
|
z.object({
|
|
@@ -1308,6 +1340,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1308
1340
|
id: z.string(),
|
|
1309
1341
|
call_id: z.string(),
|
|
1310
1342
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1343
|
+
max_output_length: z.number().nullish(),
|
|
1311
1344
|
output: z.array(
|
|
1312
1345
|
z.object({
|
|
1313
1346
|
stdout: z.string(),
|
|
@@ -1336,7 +1369,7 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1336
1369
|
execution: z.enum(['server', 'client']),
|
|
1337
1370
|
call_id: z.string().nullable(),
|
|
1338
1371
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1339
|
-
tools: z.array(z.record(z.string(), jsonValueSchema.optional())),
|
|
1372
|
+
tools: z.array(z.record(z.string(), jsonValueSchema().optional())),
|
|
1340
1373
|
}),
|
|
1341
1374
|
]),
|
|
1342
1375
|
}),
|
|
@@ -1441,8 +1474,8 @@ export const openaiResponsesChunkSchema = lazySchema(() =>
|
|
|
1441
1474
|
output_index: z.number(),
|
|
1442
1475
|
diff: z.string(),
|
|
1443
1476
|
}),
|
|
1444
|
-
openaiResponsesNestedErrorChunkSchema,
|
|
1445
|
-
openaiResponsesErrorChunkSchema,
|
|
1477
|
+
openaiResponsesNestedErrorChunkSchema(),
|
|
1478
|
+
openaiResponsesErrorChunkSchema(),
|
|
1446
1479
|
z
|
|
1447
1480
|
.object({ type: z.string() })
|
|
1448
1481
|
.loose()
|
|
@@ -1620,7 +1653,7 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1620
1653
|
id: z.string(),
|
|
1621
1654
|
result: z.string(),
|
|
1622
1655
|
}),
|
|
1623
|
-
openaiResponsesLocalShellCallSchema,
|
|
1656
|
+
openaiResponsesLocalShellCallSchema(),
|
|
1624
1657
|
z.object({
|
|
1625
1658
|
type: z.literal('function_call'),
|
|
1626
1659
|
call_id: z.string(),
|
|
@@ -1629,10 +1662,10 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1629
1662
|
id: z.string(),
|
|
1630
1663
|
async: z.boolean().nullish(),
|
|
1631
1664
|
namespace: z.string().nullish(),
|
|
1632
|
-
caller: openaiResponsesToolCallerSchema.nullish(),
|
|
1665
|
+
caller: openaiResponsesToolCallerSchema().nullish(),
|
|
1633
1666
|
}),
|
|
1634
|
-
openaiResponsesProgramSchema,
|
|
1635
|
-
openaiResponsesProgramOutputSchema,
|
|
1667
|
+
openaiResponsesProgramSchema(),
|
|
1668
|
+
openaiResponsesProgramOutputSchema(),
|
|
1636
1669
|
z.object({
|
|
1637
1670
|
type: z.literal('custom_tool_call'),
|
|
1638
1671
|
call_id: z.string(),
|
|
@@ -1641,7 +1674,7 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1641
1674
|
id: z.string(),
|
|
1642
1675
|
async: z.boolean().nullish(),
|
|
1643
1676
|
}),
|
|
1644
|
-
openaiResponsesComputerCallSchema,
|
|
1677
|
+
openaiResponsesComputerCallSchema(),
|
|
1645
1678
|
z.object({
|
|
1646
1679
|
type: z.literal('reasoning'),
|
|
1647
1680
|
id: z.string(),
|
|
@@ -1737,6 +1770,8 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1737
1770
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1738
1771
|
action: z.object({
|
|
1739
1772
|
commands: z.array(z.string()),
|
|
1773
|
+
timeout_ms: z.number().nullish(),
|
|
1774
|
+
max_output_length: z.number().nullish(),
|
|
1740
1775
|
}),
|
|
1741
1776
|
}),
|
|
1742
1777
|
z.object({
|
|
@@ -1749,6 +1784,7 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1749
1784
|
id: z.string(),
|
|
1750
1785
|
call_id: z.string(),
|
|
1751
1786
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1787
|
+
max_output_length: z.number().nullish(),
|
|
1752
1788
|
output: z.array(
|
|
1753
1789
|
z.object({
|
|
1754
1790
|
stdout: z.string(),
|
|
@@ -1777,7 +1813,9 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1777
1813
|
execution: z.enum(['server', 'client']),
|
|
1778
1814
|
call_id: z.string().nullable(),
|
|
1779
1815
|
status: z.enum(['in_progress', 'completed', 'incomplete']),
|
|
1780
|
-
tools: z.array(
|
|
1816
|
+
tools: z.array(
|
|
1817
|
+
z.record(z.string(), jsonValueSchema().optional()),
|
|
1818
|
+
),
|
|
1781
1819
|
}),
|
|
1782
1820
|
]),
|
|
1783
1821
|
)
|
|
@@ -1789,7 +1827,7 @@ export const openaiResponsesResponseSchema = lazySchema(() =>
|
|
|
1789
1827
|
})
|
|
1790
1828
|
.nullish(),
|
|
1791
1829
|
incomplete_details: z.object({ reason: z.string() }).nullish(),
|
|
1792
|
-
usage: openaiResponsesUsageSchema.nullish(),
|
|
1830
|
+
usage: openaiResponsesUsageSchema().nullish(),
|
|
1793
1831
|
}),
|
|
1794
1832
|
),
|
|
1795
1833
|
);
|