@oh-my-pi/pi-ai 17.1.0 → 17.1.2
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 +35 -0
- package/dist/types/auth-broker/client.d.ts +12 -1
- package/dist/types/auth-broker/remote-store.d.ts +10 -1
- package/dist/types/auth-broker/types.d.ts +21 -1
- package/dist/types/auth-broker/wire-schemas.d.ts +55 -0
- package/dist/types/auth-gateway/types.d.ts +5 -1
- package/dist/types/auth-storage.d.ts +50 -2
- package/dist/types/providers/anthropic-wire.d.ts +29 -2
- package/dist/types/providers/anthropic.d.ts +1 -1
- package/dist/types/providers/openai-codex/request-transformer.d.ts +8 -2
- package/dist/types/providers/openai-codex-responses.d.ts +22 -1
- package/dist/types/providers/openai-responses-server-schema.d.ts +346 -8
- package/dist/types/providers/openai-shared.d.ts +8 -4
- package/dist/types/types.d.ts +102 -1
- package/dist/types/usage.d.ts +50 -0
- package/dist/types/utils/tool-choice.d.ts +2 -0
- package/package.json +4 -4
- package/src/auth-broker/client.ts +39 -0
- package/src/auth-broker/remote-store.ts +76 -3
- package/src/auth-broker/server.ts +40 -0
- package/src/auth-broker/types.ts +25 -1
- package/src/auth-broker/wire-schemas.ts +71 -0
- package/src/auth-gateway/server.ts +6 -1
- package/src/auth-gateway/types.ts +4 -2
- package/src/auth-storage.ts +230 -1
- package/src/providers/anthropic-messages-server.ts +47 -3
- package/src/providers/anthropic-wire.ts +41 -0
- package/src/providers/anthropic.ts +81 -33
- package/src/providers/azure-openai-responses.ts +34 -16
- package/src/providers/ollama.ts +2 -0
- package/src/providers/openai-codex/request-transformer.ts +54 -25
- package/src/providers/openai-codex-responses.ts +229 -35
- package/src/providers/openai-responses-server-schema.ts +125 -10
- package/src/providers/openai-responses-server.ts +268 -117
- package/src/providers/openai-responses.ts +15 -0
- package/src/providers/openai-shared.ts +217 -51
- package/src/providers/transform-messages.ts +8 -0
- package/src/types.ts +88 -1
- package/src/usage/zai.ts +3 -3
- package/src/usage.ts +55 -0
- package/src/utils/leaked-thinking-stream.ts +38 -1
- package/src/utils/tool-choice.ts +2 -0
- package/src/utils.ts +5 -5
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import type { EasyInputMessage, ResponseCreateParams, ResponseFunctionToolCall, ResponseInputContent, ResponseInputItem, ResponseOutputMessage, ResponseReasoningItem, Tool as ResponsesTool } from "./openai-responses-wire.js";
|
|
11
11
|
declare const inputImageBlockSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
12
12
|
type: "input_image";
|
|
13
|
-
detail?: "auto" | "high" | "low" | undefined;
|
|
13
|
+
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
14
14
|
image_url?: string | undefined;
|
|
15
15
|
file_id?: string | undefined;
|
|
16
16
|
}, {}>;
|
|
@@ -19,6 +19,7 @@ declare const inputFileBlockSchema: import("arktype/internal/variants/object.ts"
|
|
|
19
19
|
file_id?: string | undefined;
|
|
20
20
|
filename?: string | undefined;
|
|
21
21
|
file_data?: string | undefined;
|
|
22
|
+
file_url?: string | undefined;
|
|
22
23
|
}, {}>;
|
|
23
24
|
declare const outputRefusalSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
24
25
|
type: "refusal";
|
|
@@ -36,6 +37,117 @@ declare const customToolCallOutputItemSchema: import("arktype/internal/variants/
|
|
|
36
37
|
call_id: string;
|
|
37
38
|
output: string;
|
|
38
39
|
}, {}>;
|
|
40
|
+
declare const computerCallItemSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
41
|
+
type: "computer_call";
|
|
42
|
+
id: string;
|
|
43
|
+
call_id: string;
|
|
44
|
+
action?: {
|
|
45
|
+
type: "click";
|
|
46
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
keys?: string[] | null | undefined;
|
|
50
|
+
} | {
|
|
51
|
+
type: "double_click";
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
keys: string[] | null;
|
|
55
|
+
} | {
|
|
56
|
+
type: "drag";
|
|
57
|
+
path: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}[];
|
|
61
|
+
keys?: string[] | null | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
type: "keypress";
|
|
64
|
+
keys: string[];
|
|
65
|
+
} | {
|
|
66
|
+
type: "move";
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
keys?: string[] | null | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
type: "screenshot";
|
|
72
|
+
} | {
|
|
73
|
+
type: "scroll";
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
scroll_x: number;
|
|
77
|
+
scroll_y: number;
|
|
78
|
+
keys?: string[] | null | undefined;
|
|
79
|
+
} | {
|
|
80
|
+
type: "type";
|
|
81
|
+
text: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: "wait";
|
|
84
|
+
} | undefined;
|
|
85
|
+
actions?: ({
|
|
86
|
+
type: "click";
|
|
87
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
88
|
+
x: number;
|
|
89
|
+
y: number;
|
|
90
|
+
keys?: string[] | null | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: "double_click";
|
|
93
|
+
x: number;
|
|
94
|
+
y: number;
|
|
95
|
+
keys: string[] | null;
|
|
96
|
+
} | {
|
|
97
|
+
type: "drag";
|
|
98
|
+
path: {
|
|
99
|
+
x: number;
|
|
100
|
+
y: number;
|
|
101
|
+
}[];
|
|
102
|
+
keys?: string[] | null | undefined;
|
|
103
|
+
} | {
|
|
104
|
+
type: "keypress";
|
|
105
|
+
keys: string[];
|
|
106
|
+
} | {
|
|
107
|
+
type: "move";
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
keys?: string[] | null | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
type: "screenshot";
|
|
113
|
+
} | {
|
|
114
|
+
type: "scroll";
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
scroll_x: number;
|
|
118
|
+
scroll_y: number;
|
|
119
|
+
keys?: string[] | null | undefined;
|
|
120
|
+
} | {
|
|
121
|
+
type: "type";
|
|
122
|
+
text: string;
|
|
123
|
+
} | {
|
|
124
|
+
type: "wait";
|
|
125
|
+
})[] | undefined;
|
|
126
|
+
pending_safety_checks: {
|
|
127
|
+
id: string;
|
|
128
|
+
code?: string | null | undefined;
|
|
129
|
+
message?: string | null | undefined;
|
|
130
|
+
}[];
|
|
131
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
132
|
+
}, {}>;
|
|
133
|
+
declare const computerCallOutputItemSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
134
|
+
type: "computer_call_output";
|
|
135
|
+
id?: string | null | undefined;
|
|
136
|
+
call_id: string;
|
|
137
|
+
output: {
|
|
138
|
+
type: "computer_screenshot";
|
|
139
|
+
image_url: string;
|
|
140
|
+
} | {
|
|
141
|
+
type: "computer_screenshot";
|
|
142
|
+
file_id: string;
|
|
143
|
+
};
|
|
144
|
+
acknowledged_safety_checks?: {
|
|
145
|
+
id: string;
|
|
146
|
+
code?: string | null | undefined;
|
|
147
|
+
message?: string | null | undefined;
|
|
148
|
+
}[] | null | undefined;
|
|
149
|
+
status?: "completed" | "failed" | "in_progress" | "incomplete" | null | undefined;
|
|
150
|
+
}, {}>;
|
|
39
151
|
/**
|
|
40
152
|
* Direct mapping to standard types.
|
|
41
153
|
*/
|
|
@@ -50,7 +162,7 @@ export declare const inputItemSchema: import("arktype/internal/variants/object.t
|
|
|
50
162
|
text: string;
|
|
51
163
|
} | {
|
|
52
164
|
type: "input_image";
|
|
53
|
-
detail?: "auto" | "high" | "low" | undefined;
|
|
165
|
+
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
54
166
|
image_url?: string | undefined;
|
|
55
167
|
file_id?: string | undefined;
|
|
56
168
|
} | {
|
|
@@ -58,6 +170,7 @@ export declare const inputItemSchema: import("arktype/internal/variants/object.t
|
|
|
58
170
|
file_id?: string | undefined;
|
|
59
171
|
filename?: string | undefined;
|
|
60
172
|
file_data?: string | undefined;
|
|
173
|
+
file_url?: string | undefined;
|
|
61
174
|
})[] | undefined;
|
|
62
175
|
} | {
|
|
63
176
|
type?: "message" | undefined;
|
|
@@ -70,7 +183,7 @@ export declare const inputItemSchema: import("arktype/internal/variants/object.t
|
|
|
70
183
|
text: string;
|
|
71
184
|
} | {
|
|
72
185
|
type: "input_image";
|
|
73
|
-
detail?: "auto" | "high" | "low" | undefined;
|
|
186
|
+
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
74
187
|
image_url?: string | undefined;
|
|
75
188
|
file_id?: string | undefined;
|
|
76
189
|
} | {
|
|
@@ -78,6 +191,7 @@ export declare const inputItemSchema: import("arktype/internal/variants/object.t
|
|
|
78
191
|
file_id?: string | undefined;
|
|
79
192
|
filename?: string | undefined;
|
|
80
193
|
file_data?: string | undefined;
|
|
194
|
+
file_url?: string | undefined;
|
|
81
195
|
})[] | undefined;
|
|
82
196
|
} | {
|
|
83
197
|
type?: "message" | undefined;
|
|
@@ -135,6 +249,115 @@ export declare const inputItemSchema: import("arktype/internal/variants/object.t
|
|
|
135
249
|
type: "custom_tool_call_output";
|
|
136
250
|
call_id: string;
|
|
137
251
|
output: string;
|
|
252
|
+
} | {
|
|
253
|
+
type: "computer_call";
|
|
254
|
+
id: string;
|
|
255
|
+
call_id: string;
|
|
256
|
+
action?: {
|
|
257
|
+
type: "click";
|
|
258
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
259
|
+
x: number;
|
|
260
|
+
y: number;
|
|
261
|
+
keys?: string[] | null | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
type: "double_click";
|
|
264
|
+
x: number;
|
|
265
|
+
y: number;
|
|
266
|
+
keys: string[] | null;
|
|
267
|
+
} | {
|
|
268
|
+
type: "drag";
|
|
269
|
+
path: {
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
}[];
|
|
273
|
+
keys?: string[] | null | undefined;
|
|
274
|
+
} | {
|
|
275
|
+
type: "keypress";
|
|
276
|
+
keys: string[];
|
|
277
|
+
} | {
|
|
278
|
+
type: "move";
|
|
279
|
+
x: number;
|
|
280
|
+
y: number;
|
|
281
|
+
keys?: string[] | null | undefined;
|
|
282
|
+
} | {
|
|
283
|
+
type: "screenshot";
|
|
284
|
+
} | {
|
|
285
|
+
type: "scroll";
|
|
286
|
+
x: number;
|
|
287
|
+
y: number;
|
|
288
|
+
scroll_x: number;
|
|
289
|
+
scroll_y: number;
|
|
290
|
+
keys?: string[] | null | undefined;
|
|
291
|
+
} | {
|
|
292
|
+
type: "type";
|
|
293
|
+
text: string;
|
|
294
|
+
} | {
|
|
295
|
+
type: "wait";
|
|
296
|
+
} | undefined;
|
|
297
|
+
actions?: ({
|
|
298
|
+
type: "click";
|
|
299
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
300
|
+
x: number;
|
|
301
|
+
y: number;
|
|
302
|
+
keys?: string[] | null | undefined;
|
|
303
|
+
} | {
|
|
304
|
+
type: "double_click";
|
|
305
|
+
x: number;
|
|
306
|
+
y: number;
|
|
307
|
+
keys: string[] | null;
|
|
308
|
+
} | {
|
|
309
|
+
type: "drag";
|
|
310
|
+
path: {
|
|
311
|
+
x: number;
|
|
312
|
+
y: number;
|
|
313
|
+
}[];
|
|
314
|
+
keys?: string[] | null | undefined;
|
|
315
|
+
} | {
|
|
316
|
+
type: "keypress";
|
|
317
|
+
keys: string[];
|
|
318
|
+
} | {
|
|
319
|
+
type: "move";
|
|
320
|
+
x: number;
|
|
321
|
+
y: number;
|
|
322
|
+
keys?: string[] | null | undefined;
|
|
323
|
+
} | {
|
|
324
|
+
type: "screenshot";
|
|
325
|
+
} | {
|
|
326
|
+
type: "scroll";
|
|
327
|
+
x: number;
|
|
328
|
+
y: number;
|
|
329
|
+
scroll_x: number;
|
|
330
|
+
scroll_y: number;
|
|
331
|
+
keys?: string[] | null | undefined;
|
|
332
|
+
} | {
|
|
333
|
+
type: "type";
|
|
334
|
+
text: string;
|
|
335
|
+
} | {
|
|
336
|
+
type: "wait";
|
|
337
|
+
})[] | undefined;
|
|
338
|
+
pending_safety_checks: {
|
|
339
|
+
id: string;
|
|
340
|
+
code?: string | null | undefined;
|
|
341
|
+
message?: string | null | undefined;
|
|
342
|
+
}[];
|
|
343
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
344
|
+
} | {
|
|
345
|
+
type: "computer_call_output";
|
|
346
|
+
id?: string | null | undefined;
|
|
347
|
+
call_id: string;
|
|
348
|
+
output: {
|
|
349
|
+
type: "computer_screenshot";
|
|
350
|
+
image_url: string;
|
|
351
|
+
} | {
|
|
352
|
+
type: "computer_screenshot";
|
|
353
|
+
file_id: string;
|
|
354
|
+
};
|
|
355
|
+
acknowledged_safety_checks?: {
|
|
356
|
+
id: string;
|
|
357
|
+
code?: string | null | undefined;
|
|
358
|
+
message?: string | null | undefined;
|
|
359
|
+
}[] | null | undefined;
|
|
360
|
+
status?: "completed" | "failed" | "in_progress" | "incomplete" | null | undefined;
|
|
138
361
|
} | {
|
|
139
362
|
type: string;
|
|
140
363
|
}, {}>;
|
|
@@ -147,6 +370,8 @@ export type OpenAIResponsesFunctionCallOutputItem = ResponseInputItem.FunctionCa
|
|
|
147
370
|
/** Inferred shape of the custom tool call input item (no canonical SDK alias). */
|
|
148
371
|
export type OpenAIResponsesCustomToolCallItem = typeof customToolCallItemSchema.infer;
|
|
149
372
|
export type OpenAIResponsesCustomToolCallOutputItem = typeof customToolCallOutputItemSchema.infer;
|
|
373
|
+
export type OpenAIResponsesComputerCallItem = typeof computerCallItemSchema.infer;
|
|
374
|
+
export type OpenAIResponsesComputerCallOutputItem = typeof computerCallOutputItemSchema.infer;
|
|
150
375
|
export type OpenAIResponsesInputImageBlock = typeof inputImageBlockSchema.infer;
|
|
151
376
|
export type OpenAIResponsesInputFileBlock = typeof inputFileBlockSchema.infer;
|
|
152
377
|
export type OpenAIResponsesOutputRefusalBlock = typeof outputRefusalSchema.infer;
|
|
@@ -166,7 +391,7 @@ export declare const toolChoiceSchema: import("arktype").BaseType<"auto" | "none
|
|
|
166
391
|
type: "custom";
|
|
167
392
|
name: string;
|
|
168
393
|
} | {
|
|
169
|
-
type: "code_interpreter" | "computer_use_preview" | "file_search" | "image_generation" | "mcp" | "web_search_preview";
|
|
394
|
+
type: "code_interpreter" | "computer" | "computer_use_preview" | "file_search" | "image_generation" | "mcp" | "web_search_preview";
|
|
170
395
|
} | {
|
|
171
396
|
type: "allowed_tools";
|
|
172
397
|
mode: "auto" | "required";
|
|
@@ -193,7 +418,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
193
418
|
text: string;
|
|
194
419
|
} | {
|
|
195
420
|
type: "input_image";
|
|
196
|
-
detail?: "auto" | "high" | "low" | undefined;
|
|
421
|
+
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
197
422
|
image_url?: string | undefined;
|
|
198
423
|
file_id?: string | undefined;
|
|
199
424
|
} | {
|
|
@@ -201,6 +426,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
201
426
|
file_id?: string | undefined;
|
|
202
427
|
filename?: string | undefined;
|
|
203
428
|
file_data?: string | undefined;
|
|
429
|
+
file_url?: string | undefined;
|
|
204
430
|
})[] | undefined;
|
|
205
431
|
} | {
|
|
206
432
|
type?: "message" | undefined;
|
|
@@ -213,7 +439,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
213
439
|
text: string;
|
|
214
440
|
} | {
|
|
215
441
|
type: "input_image";
|
|
216
|
-
detail?: "auto" | "high" | "low" | undefined;
|
|
442
|
+
detail?: "auto" | "high" | "low" | "original" | undefined;
|
|
217
443
|
image_url?: string | undefined;
|
|
218
444
|
file_id?: string | undefined;
|
|
219
445
|
} | {
|
|
@@ -221,6 +447,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
221
447
|
file_id?: string | undefined;
|
|
222
448
|
filename?: string | undefined;
|
|
223
449
|
file_data?: string | undefined;
|
|
450
|
+
file_url?: string | undefined;
|
|
224
451
|
})[] | undefined;
|
|
225
452
|
} | {
|
|
226
453
|
type?: "message" | undefined;
|
|
@@ -278,6 +505,115 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
278
505
|
type: "custom_tool_call_output";
|
|
279
506
|
call_id: string;
|
|
280
507
|
output: string;
|
|
508
|
+
} | {
|
|
509
|
+
type: "computer_call";
|
|
510
|
+
id: string;
|
|
511
|
+
call_id: string;
|
|
512
|
+
action?: {
|
|
513
|
+
type: "click";
|
|
514
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
515
|
+
x: number;
|
|
516
|
+
y: number;
|
|
517
|
+
keys?: string[] | null | undefined;
|
|
518
|
+
} | {
|
|
519
|
+
type: "double_click";
|
|
520
|
+
x: number;
|
|
521
|
+
y: number;
|
|
522
|
+
keys: string[] | null;
|
|
523
|
+
} | {
|
|
524
|
+
type: "drag";
|
|
525
|
+
path: {
|
|
526
|
+
x: number;
|
|
527
|
+
y: number;
|
|
528
|
+
}[];
|
|
529
|
+
keys?: string[] | null | undefined;
|
|
530
|
+
} | {
|
|
531
|
+
type: "keypress";
|
|
532
|
+
keys: string[];
|
|
533
|
+
} | {
|
|
534
|
+
type: "move";
|
|
535
|
+
x: number;
|
|
536
|
+
y: number;
|
|
537
|
+
keys?: string[] | null | undefined;
|
|
538
|
+
} | {
|
|
539
|
+
type: "screenshot";
|
|
540
|
+
} | {
|
|
541
|
+
type: "scroll";
|
|
542
|
+
x: number;
|
|
543
|
+
y: number;
|
|
544
|
+
scroll_x: number;
|
|
545
|
+
scroll_y: number;
|
|
546
|
+
keys?: string[] | null | undefined;
|
|
547
|
+
} | {
|
|
548
|
+
type: "type";
|
|
549
|
+
text: string;
|
|
550
|
+
} | {
|
|
551
|
+
type: "wait";
|
|
552
|
+
} | undefined;
|
|
553
|
+
actions?: ({
|
|
554
|
+
type: "click";
|
|
555
|
+
button: "back" | "forward" | "left" | "right" | "wheel";
|
|
556
|
+
x: number;
|
|
557
|
+
y: number;
|
|
558
|
+
keys?: string[] | null | undefined;
|
|
559
|
+
} | {
|
|
560
|
+
type: "double_click";
|
|
561
|
+
x: number;
|
|
562
|
+
y: number;
|
|
563
|
+
keys: string[] | null;
|
|
564
|
+
} | {
|
|
565
|
+
type: "drag";
|
|
566
|
+
path: {
|
|
567
|
+
x: number;
|
|
568
|
+
y: number;
|
|
569
|
+
}[];
|
|
570
|
+
keys?: string[] | null | undefined;
|
|
571
|
+
} | {
|
|
572
|
+
type: "keypress";
|
|
573
|
+
keys: string[];
|
|
574
|
+
} | {
|
|
575
|
+
type: "move";
|
|
576
|
+
x: number;
|
|
577
|
+
y: number;
|
|
578
|
+
keys?: string[] | null | undefined;
|
|
579
|
+
} | {
|
|
580
|
+
type: "screenshot";
|
|
581
|
+
} | {
|
|
582
|
+
type: "scroll";
|
|
583
|
+
x: number;
|
|
584
|
+
y: number;
|
|
585
|
+
scroll_x: number;
|
|
586
|
+
scroll_y: number;
|
|
587
|
+
keys?: string[] | null | undefined;
|
|
588
|
+
} | {
|
|
589
|
+
type: "type";
|
|
590
|
+
text: string;
|
|
591
|
+
} | {
|
|
592
|
+
type: "wait";
|
|
593
|
+
})[] | undefined;
|
|
594
|
+
pending_safety_checks: {
|
|
595
|
+
id: string;
|
|
596
|
+
code?: string | null | undefined;
|
|
597
|
+
message?: string | null | undefined;
|
|
598
|
+
}[];
|
|
599
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
600
|
+
} | {
|
|
601
|
+
type: "computer_call_output";
|
|
602
|
+
id?: string | null | undefined;
|
|
603
|
+
call_id: string;
|
|
604
|
+
output: {
|
|
605
|
+
type: "computer_screenshot";
|
|
606
|
+
image_url: string;
|
|
607
|
+
} | {
|
|
608
|
+
type: "computer_screenshot";
|
|
609
|
+
file_id: string;
|
|
610
|
+
};
|
|
611
|
+
acknowledged_safety_checks?: {
|
|
612
|
+
id: string;
|
|
613
|
+
code?: string | null | undefined;
|
|
614
|
+
message?: string | null | undefined;
|
|
615
|
+
}[] | null | undefined;
|
|
616
|
+
status?: "completed" | "failed" | "in_progress" | "incomplete" | null | undefined;
|
|
281
617
|
} | {
|
|
282
618
|
type: string;
|
|
283
619
|
})[] | undefined;
|
|
@@ -290,6 +626,8 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
290
626
|
[x: string]: unknown;
|
|
291
627
|
} | undefined;
|
|
292
628
|
strict?: boolean | undefined;
|
|
629
|
+
} | {
|
|
630
|
+
type: "computer";
|
|
293
631
|
} | {
|
|
294
632
|
type: string;
|
|
295
633
|
})[] | undefined;
|
|
@@ -300,7 +638,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
300
638
|
type: "custom";
|
|
301
639
|
name: string;
|
|
302
640
|
} | {
|
|
303
|
-
type: "code_interpreter" | "computer_use_preview" | "file_search" | "image_generation" | "mcp" | "web_search_preview";
|
|
641
|
+
type: "code_interpreter" | "computer" | "computer_use_preview" | "file_search" | "image_generation" | "mcp" | "web_search_preview";
|
|
304
642
|
} | {
|
|
305
643
|
type: "allowed_tools";
|
|
306
644
|
mode: "auto" | "required";
|
|
@@ -328,7 +666,7 @@ export declare const openaiResponsesRequestSchema: import("arktype/internal/vari
|
|
|
328
666
|
presence_penalty?: number | undefined;
|
|
329
667
|
frequency_penalty?: number | undefined;
|
|
330
668
|
background?: unknown;
|
|
331
|
-
include?:
|
|
669
|
+
include?: string[] | null | undefined;
|
|
332
670
|
prompt?: unknown;
|
|
333
671
|
safety_identifier?: unknown;
|
|
334
672
|
text?: unknown;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Effort } from "@oh-my-pi/pi-catalog/effort";
|
|
2
2
|
import type { OpenAICompat, OpenAIReasoningDisableMode, OpenAIStreamMarkupHealingPattern, OpenRouterRouting, ResolvedOpenAICompat, ResolvedOpenAIResponsesCompat, ResolvedOpenAISharedCompat, VercelGatewayRouting } from "@oh-my-pi/pi-catalog/types";
|
|
3
|
-
import { type Api, type AssistantMessage, type CacheRetention, type Context, type ImageContent, type Message, type MessageAttribution, type Model, type ServiceTier, type StopReason, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingContent, type Tool, type ToolCall, type ToolResultMessage, type Usage } from "../types.js";
|
|
3
|
+
import { type Api, type AssistantMessage, type CacheRetention, type ComputerToolCallMetadata, type Context, type ImageContent, type Message, type MessageAttribution, type Model, type ServiceTier, type StopReason, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingContent, type Tool, type ToolCall, type ToolResultMessage, type Usage } from "../types.js";
|
|
4
4
|
export type { OpenAIPromptCacheOptions } from "../types.js";
|
|
5
5
|
import { kStreamingLastParseLen, kStreamingPartialJson } from "../utils/block-symbols.js";
|
|
6
6
|
import type { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
7
7
|
import type { CapturedHttpErrorResponse } from "../utils/http-inspector.js";
|
|
8
8
|
import type { ChatCompletionCreateParamsStreaming } from "./openai-chat-wire.js";
|
|
9
9
|
import type { InputItem } from "./openai-codex/request-transformer.js";
|
|
10
|
-
import type { ResponseContentPartAddedEvent, ResponseCreateParamsStreaming, ResponseInput, ResponseInputContent, ResponseInputItem, ResponseOutputItem, ResponseOutputMessage, ResponseReasoningItem, ResponseStatus, ResponseStreamEvent } from "./openai-responses-wire.js";
|
|
10
|
+
import type { ResponseComputerToolCall, ResponseContentPartAddedEvent, ResponseCreateParamsStreaming, ResponseInput, ResponseInputContent, ResponseInputItem, ResponseOutputItem, ResponseOutputMessage, ResponseReasoningItem, ResponseStatus, ResponseStreamEvent } from "./openai-responses-wire.js";
|
|
11
11
|
/**
|
|
12
12
|
* Keyless-provider sentinel. Custom providers configured with `auth: none`
|
|
13
13
|
* (models.yml) have no credential, so the coding-agent resolves their API key
|
|
@@ -356,6 +356,8 @@ export declare function normalizeResponsesToolCallIdForTransform(id: string, mod
|
|
|
356
356
|
export declare function collectKnownCallIds(messages: ResponseInput): Set<string>;
|
|
357
357
|
/** Scan replay items for call_ids that were originally custom tool calls. */
|
|
358
358
|
export declare function collectCustomCallIds(messages: ResponseInput): Set<string>;
|
|
359
|
+
/** Scan replay items for call_ids that were originally native computer calls. */
|
|
360
|
+
export declare function collectComputerCallIds(messages: ResponseInput): Set<string>;
|
|
359
361
|
/**
|
|
360
362
|
* Convert orphan `function_call_output` / `custom_tool_call_output` items —
|
|
361
363
|
* those whose `call_id` has no matching preceding `function_call` /
|
|
@@ -413,9 +415,9 @@ export interface BuildResponsesInputOptions<TApi extends Api> {
|
|
|
413
415
|
preserveAssistantMessageIds?: boolean;
|
|
414
416
|
}
|
|
415
417
|
export declare function buildResponsesInput<TApi extends Api>(options: BuildResponsesInputOptions<TApi>): ResponseInput;
|
|
416
|
-
export declare function convertResponsesAssistantMessage<TApi extends Api>(assistantMsg: AssistantMessage, model: Model<TApi>, msgIndex: number, knownCallIds: Set<string>, includeThinkingSignatures?: boolean, customCallIds?: Set<string>, preserveMessageIds?: boolean, supportsCustomToolCalls?: boolean, customToolWireNameMap?: ReadonlyMap<string, string>): ResponseInput;
|
|
418
|
+
export declare function convertResponsesAssistantMessage<TApi extends Api>(assistantMsg: AssistantMessage, model: Model<TApi>, msgIndex: number, knownCallIds: Set<string>, includeThinkingSignatures?: boolean, customCallIds?: Set<string>, preserveMessageIds?: boolean, supportsCustomToolCalls?: boolean, customToolWireNameMap?: ReadonlyMap<string, string>, computerCallIds?: Set<string>): ResponseInput;
|
|
417
419
|
/** Appends one tool result while keeping consecutive outputs ahead of its synthetic image messages. */
|
|
418
|
-
export declare function appendResponsesToolResultMessages<TApi extends Api>(messages: ResponseInput, toolResult: ToolResultMessage, model: Model<TApi>, strictResponsesPairing: boolean, supportsImageDetailOriginal: boolean, knownCallIds: ReadonlySet<string>, customCallIds?: ReadonlySet<string>, supportsCustomToolCalls?: boolean): void;
|
|
420
|
+
export declare function appendResponsesToolResultMessages<TApi extends Api>(messages: ResponseInput, toolResult: ToolResultMessage, model: Model<TApi>, strictResponsesPairing: boolean, supportsImageDetailOriginal: boolean, knownCallIds: ReadonlySet<string>, customCallIds?: ReadonlySet<string>, supportsCustomToolCalls?: boolean, computerCallIds?: ReadonlySet<string>): void;
|
|
419
421
|
/**
|
|
420
422
|
* Per-block accumulation helpers shared by the two Responses decode loops —
|
|
421
423
|
* {@link processResponsesStream} (generic Responses) and the Codex stream
|
|
@@ -495,8 +497,10 @@ export interface ProcessResponsesStreamOptions {
|
|
|
495
497
|
*/
|
|
496
498
|
requestServiceTier?: ServiceTier;
|
|
497
499
|
}
|
|
500
|
+
export declare function computerCallMetadata(item: ResponseComputerToolCall): ComputerToolCallMetadata;
|
|
498
501
|
export declare function processResponsesStream<TApi extends Api>(openaiStream: AsyncIterable<ResponseStreamEvent>, output: AssistantMessage, stream: AssistantMessageEventStream, model: Model<TApi>, options?: ProcessResponsesStreamOptions): Promise<void>;
|
|
499
502
|
export declare function mapOpenAIResponsesStopReason(status: ResponseStatus | undefined): StopReason;
|
|
503
|
+
export declare function hasExecutableIncompleteResponsesToolCalls(output: AssistantMessage): boolean;
|
|
500
504
|
/**
|
|
501
505
|
* Finalize any streamed toolCall block whose `output_item.done` never arrived
|
|
502
506
|
* (lossy proxy, or a terminal event that raced the per-item done): parse the
|
package/dist/types/types.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export interface TokenTaskBudget {
|
|
|
59
59
|
remaining?: number;
|
|
60
60
|
}
|
|
61
61
|
export type MessageAttribution = "user" | "agent";
|
|
62
|
+
export type NativeToolMarker = {
|
|
63
|
+
type: "computer";
|
|
64
|
+
};
|
|
62
65
|
export type ToolChoice = "auto" | "none" | "any" | "required" | {
|
|
63
66
|
type: "function";
|
|
64
67
|
name: string;
|
|
@@ -70,6 +73,8 @@ export type ToolChoice = "auto" | "none" | "any" | "required" | {
|
|
|
70
73
|
} | {
|
|
71
74
|
type: "tool";
|
|
72
75
|
name: string;
|
|
76
|
+
} | {
|
|
77
|
+
type: "computer";
|
|
73
78
|
};
|
|
74
79
|
export type CacheRetention = "none" | "short" | "long";
|
|
75
80
|
/**
|
|
@@ -197,6 +202,7 @@ export interface OpenAIPromptCacheOptions {
|
|
|
197
202
|
/** By default, mark one existing block from stable history; `none` suppresses that marker. */
|
|
198
203
|
breakpoint?: "latest-stable-message" | "none";
|
|
199
204
|
}
|
|
205
|
+
export type OpenAIResponseInclude = "file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs";
|
|
200
206
|
export interface StreamOptions {
|
|
201
207
|
temperature?: number;
|
|
202
208
|
topP?: number;
|
|
@@ -243,6 +249,8 @@ export interface StreamOptions {
|
|
|
243
249
|
* For example, Anthropic uses `user_id` for abuse tracking and rate limiting.
|
|
244
250
|
*/
|
|
245
251
|
metadata?: Record<string, unknown>;
|
|
252
|
+
/** OpenAI Responses/Codex response fields to include verbatim. */
|
|
253
|
+
include?: OpenAIResponseInclude[];
|
|
246
254
|
/**
|
|
247
255
|
* Config options for the thinking/response loop guard.
|
|
248
256
|
*/
|
|
@@ -468,6 +476,25 @@ export interface AnthropicFallbackContent {
|
|
|
468
476
|
model: string;
|
|
469
477
|
};
|
|
470
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* Verbatim Anthropic web-search call/result retained for same-provider
|
|
481
|
+
* history replay. Other providers discard it in `transformMessages`.
|
|
482
|
+
*/
|
|
483
|
+
export interface AnthropicServerToolContent {
|
|
484
|
+
type: "anthropicServerTool";
|
|
485
|
+
block: {
|
|
486
|
+
type: "server_tool_use";
|
|
487
|
+
id: string;
|
|
488
|
+
name: "web_search";
|
|
489
|
+
input?: Record<string, unknown> | null;
|
|
490
|
+
[key: string]: unknown;
|
|
491
|
+
} | {
|
|
492
|
+
type: "web_search_tool_result";
|
|
493
|
+
tool_use_id: string;
|
|
494
|
+
content: unknown;
|
|
495
|
+
[key: string]: unknown;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
471
498
|
export interface ImageContent {
|
|
472
499
|
type: "image";
|
|
473
500
|
data: string;
|
|
@@ -479,6 +506,74 @@ export interface ImageContent {
|
|
|
479
506
|
*/
|
|
480
507
|
detail?: "auto" | "low" | "high" | "original";
|
|
481
508
|
}
|
|
509
|
+
export type ComputerAction = {
|
|
510
|
+
type: "click";
|
|
511
|
+
button: "left" | "right" | "wheel" | "back" | "forward";
|
|
512
|
+
x: number;
|
|
513
|
+
y: number;
|
|
514
|
+
keys?: string[] | null;
|
|
515
|
+
} | {
|
|
516
|
+
type: "double_click";
|
|
517
|
+
x: number;
|
|
518
|
+
y: number;
|
|
519
|
+
keys: string[] | null;
|
|
520
|
+
} | {
|
|
521
|
+
type: "drag";
|
|
522
|
+
path: Array<{
|
|
523
|
+
x: number;
|
|
524
|
+
y: number;
|
|
525
|
+
}>;
|
|
526
|
+
keys?: string[] | null;
|
|
527
|
+
} | {
|
|
528
|
+
type: "keypress";
|
|
529
|
+
keys: string[];
|
|
530
|
+
} | {
|
|
531
|
+
type: "move";
|
|
532
|
+
x: number;
|
|
533
|
+
y: number;
|
|
534
|
+
keys?: string[] | null;
|
|
535
|
+
} | {
|
|
536
|
+
type: "screenshot";
|
|
537
|
+
} | {
|
|
538
|
+
type: "scroll";
|
|
539
|
+
x: number;
|
|
540
|
+
y: number;
|
|
541
|
+
scroll_x: number;
|
|
542
|
+
scroll_y: number;
|
|
543
|
+
keys?: string[] | null;
|
|
544
|
+
} | {
|
|
545
|
+
type: "type";
|
|
546
|
+
text: string;
|
|
547
|
+
} | {
|
|
548
|
+
type: "wait";
|
|
549
|
+
};
|
|
550
|
+
export interface ComputerSafetyCheck {
|
|
551
|
+
id: string;
|
|
552
|
+
code?: string | null;
|
|
553
|
+
message?: string | null;
|
|
554
|
+
}
|
|
555
|
+
export interface ComputerToolCallMetadata {
|
|
556
|
+
type: "computer";
|
|
557
|
+
providerItemId: string;
|
|
558
|
+
actions: ComputerAction[];
|
|
559
|
+
pendingSafetyChecks: ComputerSafetyCheck[];
|
|
560
|
+
}
|
|
561
|
+
export type ToolCallProviderMetadata = ComputerToolCallMetadata;
|
|
562
|
+
export type ComputerScreenshotRef = {
|
|
563
|
+
type: "computer_screenshot";
|
|
564
|
+
image_url: string;
|
|
565
|
+
file_id?: never;
|
|
566
|
+
} | {
|
|
567
|
+
type: "computer_screenshot";
|
|
568
|
+
file_id: string;
|
|
569
|
+
image_url?: never;
|
|
570
|
+
};
|
|
571
|
+
export interface ComputerToolResultMetadata {
|
|
572
|
+
type: "computer";
|
|
573
|
+
screenshot: ComputerScreenshotRef;
|
|
574
|
+
acknowledgedSafetyChecks: ComputerSafetyCheck[];
|
|
575
|
+
}
|
|
576
|
+
export type ToolResultProviderMetadata = ComputerToolResultMetadata;
|
|
482
577
|
export interface ToolCall {
|
|
483
578
|
type: "toolCall";
|
|
484
579
|
id: string;
|
|
@@ -500,6 +595,8 @@ export interface ToolCall {
|
|
|
500
595
|
* JSON function tools.
|
|
501
596
|
*/
|
|
502
597
|
customWireName?: string;
|
|
598
|
+
/** Provider-native metadata required to execute and faithfully replay this call. */
|
|
599
|
+
providerMetadata?: ToolCallProviderMetadata;
|
|
503
600
|
}
|
|
504
601
|
export type StopReason = "stop" | "length" | "toolUse" | "error" | "aborted";
|
|
505
602
|
export interface OpenAIResponsesHistoryPayload {
|
|
@@ -553,7 +650,7 @@ export interface ContextSnapshot {
|
|
|
553
650
|
}
|
|
554
651
|
export interface AssistantMessage {
|
|
555
652
|
role: "assistant";
|
|
556
|
-
content: (TextContent | ThinkingContent | RedactedThinkingContent | AnthropicFallbackContent | ImageContent | ToolCall)[];
|
|
653
|
+
content: (TextContent | ThinkingContent | RedactedThinkingContent | AnthropicFallbackContent | AnthropicServerToolContent | ImageContent | ToolCall)[];
|
|
557
654
|
api: Api;
|
|
558
655
|
provider: Provider;
|
|
559
656
|
model: string;
|
|
@@ -603,6 +700,8 @@ export interface ToolResultMessage<TDetails = unknown> {
|
|
|
603
700
|
attribution?: MessageAttribution;
|
|
604
701
|
/** Timestamp when output was pruned (ms since epoch). Undefined if unpruned. */
|
|
605
702
|
prunedAt?: number;
|
|
703
|
+
/** Provider-native metadata required to faithfully replay this result. */
|
|
704
|
+
providerMetadata?: ToolResultProviderMetadata;
|
|
606
705
|
/**
|
|
607
706
|
* Tool-declared: this result carried no information worth retaining once
|
|
608
707
|
* consumed (zero matches, elapsed wait). Compaction passes may elide it.
|
|
@@ -697,6 +796,8 @@ export interface Tool<TParameters extends TSchema = TSchema> {
|
|
|
697
796
|
* calls route correctly. Absent for regular JSON function tools.
|
|
698
797
|
*/
|
|
699
798
|
customWireName?: string;
|
|
799
|
+
/** Selects a provider-native hosted tool instead of a JSON-schema function tool. */
|
|
800
|
+
native?: NativeToolMarker;
|
|
700
801
|
/**
|
|
701
802
|
* Illustrative calls/notes; the AI layer renders them into an `<examples>`
|
|
702
803
|
* block in the model's native tool-call syntax and appends to the wire
|