@opencode-ai/ai 0.0.0-dev-18229 → 0.0.0-dev-18231
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/protocols/open-responses.d.ts +232 -24
- package/dist/protocols/open-responses.js +57 -34
- package/dist/protocols/openai-compatible-responses.d.ts +37 -3
- package/dist/protocols/openai-responses.d.ts +403 -50
- package/dist/protocols/openai-responses.js +33 -7
- package/dist/protocols/xai-responses.d.ts +52 -3
- package/dist/protocols/xai-responses.js +31 -1
- package/dist/providers/amazon-bedrock-mantle.d.ts +65 -3
- package/dist/providers/azure.d.ts +65 -3
- package/dist/providers/google-vertex-responses.d.ts +37 -3
- package/dist/providers/openai-compatible-responses.d.ts +37 -3
- package/dist/providers/openai.d.ts +65 -3
- package/package.json +3 -3
|
@@ -19,6 +19,35 @@ declare const MediaInput: Schema.Union<readonly [Schema.Struct<{
|
|
|
19
19
|
export type MediaInput = Schema.Schema.Type<typeof MediaInput>;
|
|
20
20
|
export declare const MessagePhase: Schema.NullOr<Schema.Literals<readonly ["commentary", "final_answer"]>>;
|
|
21
21
|
type MessagePhase = Schema.Schema.Type<typeof MessagePhase>;
|
|
22
|
+
export declare const HostedToolItem: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
23
|
+
readonly type: Schema.tag<"web_search_call">;
|
|
24
|
+
readonly id: Schema.String;
|
|
25
|
+
readonly status: Schema.optional<Schema.String>;
|
|
26
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
27
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
28
|
+
readonly type: Schema.tag<"file_search_call">;
|
|
29
|
+
readonly id: Schema.String;
|
|
30
|
+
readonly status: Schema.optional<Schema.String>;
|
|
31
|
+
readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
|
|
32
|
+
readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
33
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
34
|
+
readonly type: Schema.tag<"code_interpreter_call">;
|
|
35
|
+
readonly id: Schema.String;
|
|
36
|
+
readonly status: Schema.optional<Schema.String>;
|
|
37
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
38
|
+
readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
39
|
+
readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
40
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
41
|
+
readonly type: Schema.tag<"mcp_call">;
|
|
42
|
+
readonly id: Schema.String;
|
|
43
|
+
readonly status: Schema.optional<Schema.String>;
|
|
44
|
+
readonly server_label: Schema.optional<Schema.String>;
|
|
45
|
+
readonly name: Schema.optional<Schema.String>;
|
|
46
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
47
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
48
|
+
readonly error: Schema.optional<Schema.Unknown>;
|
|
49
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>;
|
|
50
|
+
export type HostedToolItem = Schema.Schema.Type<typeof HostedToolItem>;
|
|
22
51
|
export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
|
|
23
52
|
readonly role: Schema.tag<"system">;
|
|
24
53
|
readonly content: Schema.String;
|
|
@@ -56,9 +85,6 @@ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
56
85
|
readonly text: Schema.String;
|
|
57
86
|
}>>;
|
|
58
87
|
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
59
|
-
}>, Schema.Struct<{
|
|
60
|
-
readonly type: Schema.tag<"item_reference">;
|
|
61
|
-
readonly id: Schema.String;
|
|
62
88
|
}>, Schema.Struct<{
|
|
63
89
|
readonly type: Schema.tag<"function_call">;
|
|
64
90
|
readonly id: Schema.optionalKey<Schema.String>;
|
|
@@ -83,9 +109,41 @@ export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
|
|
|
83
109
|
readonly type: Schema.tag<"input_video">;
|
|
84
110
|
readonly video_url: Schema.String;
|
|
85
111
|
}>]>>]>;
|
|
86
|
-
}
|
|
112
|
+
}>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
113
|
+
readonly type: Schema.tag<"web_search_call">;
|
|
114
|
+
readonly id: Schema.String;
|
|
115
|
+
readonly status: Schema.optional<Schema.String>;
|
|
116
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
117
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
118
|
+
readonly type: Schema.tag<"file_search_call">;
|
|
119
|
+
readonly id: Schema.String;
|
|
120
|
+
readonly status: Schema.optional<Schema.String>;
|
|
121
|
+
readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
|
|
122
|
+
readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
123
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
124
|
+
readonly type: Schema.tag<"code_interpreter_call">;
|
|
125
|
+
readonly id: Schema.String;
|
|
126
|
+
readonly status: Schema.optional<Schema.String>;
|
|
127
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
128
|
+
readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
129
|
+
readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
130
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
131
|
+
readonly type: Schema.tag<"mcp_call">;
|
|
132
|
+
readonly id: Schema.String;
|
|
133
|
+
readonly status: Schema.optional<Schema.String>;
|
|
134
|
+
readonly server_label: Schema.optional<Schema.String>;
|
|
135
|
+
readonly name: Schema.optional<Schema.String>;
|
|
136
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
137
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
138
|
+
readonly error: Schema.optional<Schema.Unknown>;
|
|
139
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>;
|
|
87
140
|
type OpenResponsesInputItem = Schema.Schema.Type<typeof InputItem>;
|
|
88
|
-
type
|
|
141
|
+
export type ExtendedHostedToolItem = {
|
|
142
|
+
readonly type: string;
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly [key: string]: unknown;
|
|
145
|
+
};
|
|
146
|
+
type LoweredInputItem = OpenResponsesInputItem | ExtendedHostedToolItem | {
|
|
89
147
|
readonly type: "message";
|
|
90
148
|
readonly id?: string;
|
|
91
149
|
readonly role: "assistant";
|
|
@@ -152,9 +210,6 @@ export declare const coreFields: {
|
|
|
152
210
|
readonly text: Schema.String;
|
|
153
211
|
}>>;
|
|
154
212
|
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
155
|
-
}>, Schema.Struct<{
|
|
156
|
-
readonly type: Schema.tag<"item_reference">;
|
|
157
|
-
readonly id: Schema.String;
|
|
158
213
|
}>, Schema.Struct<{
|
|
159
214
|
readonly type: Schema.tag<"function_call">;
|
|
160
215
|
readonly id: Schema.optionalKey<Schema.String>;
|
|
@@ -179,7 +234,34 @@ export declare const coreFields: {
|
|
|
179
234
|
readonly type: Schema.tag<"input_video">;
|
|
180
235
|
readonly video_url: Schema.String;
|
|
181
236
|
}>]>>]>;
|
|
182
|
-
}
|
|
237
|
+
}>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
238
|
+
readonly type: Schema.tag<"web_search_call">;
|
|
239
|
+
readonly id: Schema.String;
|
|
240
|
+
readonly status: Schema.optional<Schema.String>;
|
|
241
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
242
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
243
|
+
readonly type: Schema.tag<"file_search_call">;
|
|
244
|
+
readonly id: Schema.String;
|
|
245
|
+
readonly status: Schema.optional<Schema.String>;
|
|
246
|
+
readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
|
|
247
|
+
readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
248
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
249
|
+
readonly type: Schema.tag<"code_interpreter_call">;
|
|
250
|
+
readonly id: Schema.String;
|
|
251
|
+
readonly status: Schema.optional<Schema.String>;
|
|
252
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
253
|
+
readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
254
|
+
readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
255
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
256
|
+
readonly type: Schema.tag<"mcp_call">;
|
|
257
|
+
readonly id: Schema.String;
|
|
258
|
+
readonly status: Schema.optional<Schema.String>;
|
|
259
|
+
readonly server_label: Schema.optional<Schema.String>;
|
|
260
|
+
readonly name: Schema.optional<Schema.String>;
|
|
261
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
262
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
263
|
+
readonly error: Schema.optional<Schema.Unknown>;
|
|
264
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
|
|
183
265
|
instructions: Schema.optional<Schema.String>;
|
|
184
266
|
tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
185
267
|
readonly type: Schema.tag<"function">;
|
|
@@ -265,9 +347,6 @@ declare const OpenResponsesBody: Schema.Struct<{
|
|
|
265
347
|
readonly text: Schema.String;
|
|
266
348
|
}>>;
|
|
267
349
|
readonly encrypted_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
268
|
-
}>, Schema.Struct<{
|
|
269
|
-
readonly type: Schema.tag<"item_reference">;
|
|
270
|
-
readonly id: Schema.String;
|
|
271
350
|
}>, Schema.Struct<{
|
|
272
351
|
readonly type: Schema.tag<"function_call">;
|
|
273
352
|
readonly id: Schema.optionalKey<Schema.String>;
|
|
@@ -292,7 +371,34 @@ declare const OpenResponsesBody: Schema.Struct<{
|
|
|
292
371
|
readonly type: Schema.tag<"input_video">;
|
|
293
372
|
readonly video_url: Schema.String;
|
|
294
373
|
}>]>>]>;
|
|
295
|
-
}
|
|
374
|
+
}>, Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
|
|
375
|
+
readonly type: Schema.tag<"web_search_call">;
|
|
376
|
+
readonly id: Schema.String;
|
|
377
|
+
readonly status: Schema.optional<Schema.String>;
|
|
378
|
+
readonly action: Schema.optional<Schema.NullOr<Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
379
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
380
|
+
readonly type: Schema.tag<"file_search_call">;
|
|
381
|
+
readonly id: Schema.String;
|
|
382
|
+
readonly status: Schema.optional<Schema.String>;
|
|
383
|
+
readonly queries: Schema.optional<Schema.$Array<Schema.String>>;
|
|
384
|
+
readonly results: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
385
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
386
|
+
readonly type: Schema.tag<"code_interpreter_call">;
|
|
387
|
+
readonly id: Schema.String;
|
|
388
|
+
readonly status: Schema.optional<Schema.String>;
|
|
389
|
+
readonly code: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
390
|
+
readonly container_id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
391
|
+
readonly outputs: Schema.optional<Schema.NullOr<Schema.$Array<Schema.$Record<Schema.String, Schema.Unknown>>>>;
|
|
392
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.StructWithRest<Schema.Struct<{
|
|
393
|
+
readonly type: Schema.tag<"mcp_call">;
|
|
394
|
+
readonly id: Schema.String;
|
|
395
|
+
readonly status: Schema.optional<Schema.String>;
|
|
396
|
+
readonly server_label: Schema.optional<Schema.String>;
|
|
397
|
+
readonly name: Schema.optional<Schema.String>;
|
|
398
|
+
readonly arguments: Schema.optional<Schema.String>;
|
|
399
|
+
readonly output: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
400
|
+
readonly error: Schema.optional<Schema.Unknown>;
|
|
401
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
|
|
296
402
|
readonly instructions: Schema.optional<Schema.String>;
|
|
297
403
|
readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
298
404
|
readonly type: Schema.tag<"function">;
|
|
@@ -444,7 +550,7 @@ export declare const Event: Schema.StructWithRest<Schema.Struct<{
|
|
|
444
550
|
readonly headers: Schema.optional<Schema.Unknown>;
|
|
445
551
|
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
|
|
446
552
|
export type Event = Schema.Schema.Type<typeof Event>;
|
|
447
|
-
export type ItemKind = "message" | "reasoning" | "function-call" | "
|
|
553
|
+
export type ItemKind = "message" | "reasoning" | "function-call" | "hosted-tool";
|
|
448
554
|
export interface Extension {
|
|
449
555
|
readonly id: string;
|
|
450
556
|
readonly name: string;
|
|
@@ -453,6 +559,7 @@ export interface Extension {
|
|
|
453
559
|
readonly media: ProviderShared.NormalizedMedia;
|
|
454
560
|
readonly request: LLMRequest;
|
|
455
561
|
}) => MediaInput | undefined;
|
|
562
|
+
readonly lowerHostedToolItem?: (item: unknown) => ExtendedHostedToolItem | undefined;
|
|
456
563
|
readonly acceptsItemID?: (kind: ItemKind, id: string) => boolean;
|
|
457
564
|
}
|
|
458
565
|
export interface ParserState {
|
|
@@ -466,7 +573,6 @@ export interface ParserState {
|
|
|
466
573
|
readonly messageItems: ReadonlySet<string>;
|
|
467
574
|
readonly messagePhases: Readonly<Record<string, MessagePhase | null>>;
|
|
468
575
|
readonly reasoningItems: Readonly<Record<string, ReasoningStreamItem>>;
|
|
469
|
-
readonly store: boolean | undefined;
|
|
470
576
|
}
|
|
471
577
|
type ReasoningSummaryStatus = "active" | "can-conclude" | "concluded";
|
|
472
578
|
interface ReasoningStreamItem {
|
|
@@ -545,6 +651,43 @@ export declare const fromRequestWithExtension: (request: LLMRequest, extension:
|
|
|
545
651
|
}, AIError, never>;
|
|
546
652
|
export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
547
653
|
readonly input: readonly ({
|
|
654
|
+
readonly [x: string]: unknown;
|
|
655
|
+
readonly id: string;
|
|
656
|
+
readonly type: "web_search_call";
|
|
657
|
+
readonly status?: string | undefined;
|
|
658
|
+
readonly action?: {
|
|
659
|
+
readonly [x: string]: unknown;
|
|
660
|
+
} | null | undefined;
|
|
661
|
+
} | {
|
|
662
|
+
readonly [x: string]: unknown;
|
|
663
|
+
readonly id: string;
|
|
664
|
+
readonly type: "file_search_call";
|
|
665
|
+
readonly status?: string | undefined;
|
|
666
|
+
readonly queries?: readonly string[] | undefined;
|
|
667
|
+
readonly results?: readonly {
|
|
668
|
+
readonly [x: string]: unknown;
|
|
669
|
+
}[] | null | undefined;
|
|
670
|
+
} | {
|
|
671
|
+
readonly [x: string]: unknown;
|
|
672
|
+
readonly id: string;
|
|
673
|
+
readonly type: "code_interpreter_call";
|
|
674
|
+
readonly status?: string | undefined;
|
|
675
|
+
readonly code?: string | null | undefined;
|
|
676
|
+
readonly container_id?: string | null | undefined;
|
|
677
|
+
readonly outputs?: readonly {
|
|
678
|
+
readonly [x: string]: unknown;
|
|
679
|
+
}[] | null | undefined;
|
|
680
|
+
} | {
|
|
681
|
+
readonly [x: string]: unknown;
|
|
682
|
+
readonly id: string;
|
|
683
|
+
readonly type: "mcp_call";
|
|
684
|
+
readonly status?: string | undefined;
|
|
685
|
+
readonly name?: string | undefined;
|
|
686
|
+
readonly output?: string | null | undefined;
|
|
687
|
+
readonly error?: unknown;
|
|
688
|
+
readonly arguments?: string | undefined;
|
|
689
|
+
readonly server_label?: string | undefined;
|
|
690
|
+
} | {
|
|
548
691
|
readonly type: "reasoning";
|
|
549
692
|
readonly summary: readonly {
|
|
550
693
|
readonly type: "summary_text";
|
|
@@ -552,9 +695,6 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
552
695
|
}[];
|
|
553
696
|
readonly id?: string | undefined;
|
|
554
697
|
readonly encrypted_content?: string | null | undefined;
|
|
555
|
-
} | {
|
|
556
|
-
readonly type: "item_reference";
|
|
557
|
-
readonly id: string;
|
|
558
698
|
} | {
|
|
559
699
|
readonly role: "system";
|
|
560
700
|
readonly content: string;
|
|
@@ -857,6 +997,43 @@ export declare const step: (state: ParserState, input: Event) => AIError | Effec
|
|
|
857
997
|
export declare const initial: (request: LLMRequest, extension?: Extension) => ParserState;
|
|
858
998
|
export declare const protocol: Protocol<{
|
|
859
999
|
readonly input: readonly ({
|
|
1000
|
+
readonly [x: string]: unknown;
|
|
1001
|
+
readonly id: string;
|
|
1002
|
+
readonly type: "web_search_call";
|
|
1003
|
+
readonly status?: string | undefined;
|
|
1004
|
+
readonly action?: {
|
|
1005
|
+
readonly [x: string]: unknown;
|
|
1006
|
+
} | null | undefined;
|
|
1007
|
+
} | {
|
|
1008
|
+
readonly [x: string]: unknown;
|
|
1009
|
+
readonly id: string;
|
|
1010
|
+
readonly type: "file_search_call";
|
|
1011
|
+
readonly status?: string | undefined;
|
|
1012
|
+
readonly queries?: readonly string[] | undefined;
|
|
1013
|
+
readonly results?: readonly {
|
|
1014
|
+
readonly [x: string]: unknown;
|
|
1015
|
+
}[] | null | undefined;
|
|
1016
|
+
} | {
|
|
1017
|
+
readonly [x: string]: unknown;
|
|
1018
|
+
readonly id: string;
|
|
1019
|
+
readonly type: "code_interpreter_call";
|
|
1020
|
+
readonly status?: string | undefined;
|
|
1021
|
+
readonly code?: string | null | undefined;
|
|
1022
|
+
readonly container_id?: string | null | undefined;
|
|
1023
|
+
readonly outputs?: readonly {
|
|
1024
|
+
readonly [x: string]: unknown;
|
|
1025
|
+
}[] | null | undefined;
|
|
1026
|
+
} | {
|
|
1027
|
+
readonly [x: string]: unknown;
|
|
1028
|
+
readonly id: string;
|
|
1029
|
+
readonly type: "mcp_call";
|
|
1030
|
+
readonly status?: string | undefined;
|
|
1031
|
+
readonly name?: string | undefined;
|
|
1032
|
+
readonly output?: string | null | undefined;
|
|
1033
|
+
readonly error?: unknown;
|
|
1034
|
+
readonly arguments?: string | undefined;
|
|
1035
|
+
readonly server_label?: string | undefined;
|
|
1036
|
+
} | {
|
|
860
1037
|
readonly type: "reasoning";
|
|
861
1038
|
readonly summary: readonly {
|
|
862
1039
|
readonly type: "summary_text";
|
|
@@ -864,9 +1041,6 @@ export declare const protocol: Protocol<{
|
|
|
864
1041
|
}[];
|
|
865
1042
|
readonly id?: string | undefined;
|
|
866
1043
|
readonly encrypted_content?: string | null | undefined;
|
|
867
|
-
} | {
|
|
868
|
-
readonly type: "item_reference";
|
|
869
|
-
readonly id: string;
|
|
870
1044
|
} | {
|
|
871
1045
|
readonly role: "system";
|
|
872
1046
|
readonly content: string;
|
|
@@ -1039,6 +1213,43 @@ export declare const protocol: Protocol<{
|
|
|
1039
1213
|
}, ParserState>;
|
|
1040
1214
|
export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
1041
1215
|
readonly input: readonly ({
|
|
1216
|
+
readonly [x: string]: unknown;
|
|
1217
|
+
readonly id: string;
|
|
1218
|
+
readonly type: "web_search_call";
|
|
1219
|
+
readonly status?: string | undefined;
|
|
1220
|
+
readonly action?: {
|
|
1221
|
+
readonly [x: string]: unknown;
|
|
1222
|
+
} | null | undefined;
|
|
1223
|
+
} | {
|
|
1224
|
+
readonly [x: string]: unknown;
|
|
1225
|
+
readonly id: string;
|
|
1226
|
+
readonly type: "file_search_call";
|
|
1227
|
+
readonly status?: string | undefined;
|
|
1228
|
+
readonly queries?: readonly string[] | undefined;
|
|
1229
|
+
readonly results?: readonly {
|
|
1230
|
+
readonly [x: string]: unknown;
|
|
1231
|
+
}[] | null | undefined;
|
|
1232
|
+
} | {
|
|
1233
|
+
readonly [x: string]: unknown;
|
|
1234
|
+
readonly id: string;
|
|
1235
|
+
readonly type: "code_interpreter_call";
|
|
1236
|
+
readonly status?: string | undefined;
|
|
1237
|
+
readonly code?: string | null | undefined;
|
|
1238
|
+
readonly container_id?: string | null | undefined;
|
|
1239
|
+
readonly outputs?: readonly {
|
|
1240
|
+
readonly [x: string]: unknown;
|
|
1241
|
+
}[] | null | undefined;
|
|
1242
|
+
} | {
|
|
1243
|
+
readonly [x: string]: unknown;
|
|
1244
|
+
readonly id: string;
|
|
1245
|
+
readonly type: "mcp_call";
|
|
1246
|
+
readonly status?: string | undefined;
|
|
1247
|
+
readonly name?: string | undefined;
|
|
1248
|
+
readonly output?: string | null | undefined;
|
|
1249
|
+
readonly error?: unknown;
|
|
1250
|
+
readonly arguments?: string | undefined;
|
|
1251
|
+
readonly server_label?: string | undefined;
|
|
1252
|
+
} | {
|
|
1042
1253
|
readonly type: "reasoning";
|
|
1043
1254
|
readonly summary: readonly {
|
|
1044
1255
|
readonly type: "summary_text";
|
|
@@ -1046,9 +1257,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
1046
1257
|
}[];
|
|
1047
1258
|
readonly id?: string | undefined;
|
|
1048
1259
|
readonly encrypted_content?: string | null | undefined;
|
|
1049
|
-
} | {
|
|
1050
|
-
readonly type: "item_reference";
|
|
1051
|
-
readonly id: string;
|
|
1052
1260
|
} | {
|
|
1053
1261
|
readonly role: "system";
|
|
1054
1262
|
readonly content: string;
|
|
@@ -54,10 +54,43 @@ const OpenResponsesReasoningItem = Schema.Struct({
|
|
|
54
54
|
summary: Schema.Array(OpenResponsesReasoningSummaryText),
|
|
55
55
|
encrypted_content: optionalNull(Schema.String),
|
|
56
56
|
});
|
|
57
|
-
const
|
|
58
|
-
type: Schema.tag("
|
|
57
|
+
const OpenResponsesWebSearchCall = Schema.StructWithRest(Schema.Struct({
|
|
58
|
+
type: Schema.tag("web_search_call"),
|
|
59
59
|
id: Schema.String,
|
|
60
|
-
|
|
60
|
+
status: Schema.optional(Schema.String),
|
|
61
|
+
action: optionalNull(JsonObject),
|
|
62
|
+
}), [JsonObject]);
|
|
63
|
+
const OpenResponsesFileSearchCall = Schema.StructWithRest(Schema.Struct({
|
|
64
|
+
type: Schema.tag("file_search_call"),
|
|
65
|
+
id: Schema.String,
|
|
66
|
+
status: Schema.optional(Schema.String),
|
|
67
|
+
queries: Schema.optional(Schema.Array(Schema.String)),
|
|
68
|
+
results: optionalNull(Schema.Array(JsonObject)),
|
|
69
|
+
}), [JsonObject]);
|
|
70
|
+
const OpenResponsesCodeInterpreterCall = Schema.StructWithRest(Schema.Struct({
|
|
71
|
+
type: Schema.tag("code_interpreter_call"),
|
|
72
|
+
id: Schema.String,
|
|
73
|
+
status: Schema.optional(Schema.String),
|
|
74
|
+
code: optionalNull(Schema.String),
|
|
75
|
+
container_id: optionalNull(Schema.String),
|
|
76
|
+
outputs: optionalNull(Schema.Array(JsonObject)),
|
|
77
|
+
}), [JsonObject]);
|
|
78
|
+
const OpenResponsesMCPCall = Schema.StructWithRest(Schema.Struct({
|
|
79
|
+
type: Schema.tag("mcp_call"),
|
|
80
|
+
id: Schema.String,
|
|
81
|
+
status: Schema.optional(Schema.String),
|
|
82
|
+
server_label: Schema.optional(Schema.String),
|
|
83
|
+
name: Schema.optional(Schema.String),
|
|
84
|
+
arguments: Schema.optional(Schema.String),
|
|
85
|
+
output: optionalNull(Schema.String),
|
|
86
|
+
error: Schema.optional(Schema.Unknown),
|
|
87
|
+
}), [JsonObject]);
|
|
88
|
+
export const HostedToolItem = Schema.Union([
|
|
89
|
+
OpenResponsesWebSearchCall,
|
|
90
|
+
OpenResponsesFileSearchCall,
|
|
91
|
+
OpenResponsesCodeInterpreterCall,
|
|
92
|
+
OpenResponsesMCPCall,
|
|
93
|
+
]);
|
|
61
94
|
// `function_call_output.output` accepts either a plain string or an ordered
|
|
62
95
|
// array of content items so tools can return images and files in addition to text.
|
|
63
96
|
// https://www.openresponses.org/reference
|
|
@@ -83,7 +116,6 @@ export const InputItem = Schema.Union([
|
|
|
83
116
|
phase: Schema.optionalKey(MessagePhase),
|
|
84
117
|
}),
|
|
85
118
|
OpenResponsesReasoningItem,
|
|
86
|
-
OpenResponsesItemReference,
|
|
87
119
|
Schema.Struct({
|
|
88
120
|
type: Schema.tag("function_call"),
|
|
89
121
|
id: Schema.optionalKey(Schema.String),
|
|
@@ -96,6 +128,7 @@ export const InputItem = Schema.Union([
|
|
|
96
128
|
call_id: Schema.String,
|
|
97
129
|
output: OpenResponsesFunctionCallOutput,
|
|
98
130
|
}),
|
|
131
|
+
HostedToolItem,
|
|
99
132
|
]);
|
|
100
133
|
export const Tool = Schema.Struct({
|
|
101
134
|
type: Schema.tag("function"),
|
|
@@ -343,7 +376,6 @@ const lowerToolResultOutput = Effect.fnUntraced(function* (part, request, extens
|
|
|
343
376
|
const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (request, extension) {
|
|
344
377
|
const system = request.system.length === 0 ? [] : [{ role: "system", content: ProviderShared.joinText(request.system) }];
|
|
345
378
|
const input = [...system];
|
|
346
|
-
const store = OpenResponsesOptions.resolve(request).store;
|
|
347
379
|
const providerMetadataKey = request.model.route.providerMetadataKey ?? "openresponses";
|
|
348
380
|
for (const message of request.messages) {
|
|
349
381
|
if (message.role === "system") {
|
|
@@ -363,8 +395,7 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques
|
|
|
363
395
|
if (message.role === "assistant") {
|
|
364
396
|
const content = [];
|
|
365
397
|
const reasoningItems = {};
|
|
366
|
-
const
|
|
367
|
-
const hostedToolReferences = new Set();
|
|
398
|
+
const hostedToolItems = new Set();
|
|
368
399
|
const flushText = () => {
|
|
369
400
|
if (content.length === 0)
|
|
370
401
|
return;
|
|
@@ -399,12 +430,6 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques
|
|
|
399
430
|
const reasoning = lowerReasoning(part, providerMetadataKey, extension);
|
|
400
431
|
if (!reasoning)
|
|
401
432
|
continue;
|
|
402
|
-
if (store !== false) {
|
|
403
|
-
if (!reasoningReferences.has(reasoning.id))
|
|
404
|
-
input.push({ type: "item_reference", id: reasoning.id });
|
|
405
|
-
reasoningReferences.add(reasoning.id);
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
433
|
const existing = reasoningItems[reasoning.id];
|
|
409
434
|
if (existing) {
|
|
410
435
|
existing.summary.push(...reasoning.summary);
|
|
@@ -426,22 +451,25 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques
|
|
|
426
451
|
if (part.type === "tool-result" && part.providerExecuted === true) {
|
|
427
452
|
flushText();
|
|
428
453
|
const id = itemID(part.providerMetadata, providerMetadataKey);
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (store === false) {
|
|
433
|
-
// The server is not storing this exchange, so the tool outcome has to
|
|
434
|
-
// travel in the input. Non-content results degrade to their text form.
|
|
435
|
-
const content = part.result.type === "content"
|
|
454
|
+
const hosted = part.result.type !== "json"
|
|
455
|
+
? undefined
|
|
456
|
+
: Schema.is(HostedToolItem)(part.result.value)
|
|
436
457
|
? part.result.value
|
|
437
|
-
:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
458
|
+
: extension.lowerHostedToolItem?.(part.result.value);
|
|
459
|
+
if (acceptsItemID(extension, "hosted-tool", id) && hosted?.id === id) {
|
|
460
|
+
if (!hostedToolItems.has(id)) {
|
|
461
|
+
input.push(hosted);
|
|
462
|
+
hostedToolItems.add(id);
|
|
463
|
+
}
|
|
464
|
+
continue;
|
|
442
465
|
}
|
|
443
|
-
|
|
444
|
-
|
|
466
|
+
const content = part.result.type === "content"
|
|
467
|
+
? part.result.value
|
|
468
|
+
: [{ type: "text", text: ProviderShared.toolResultText(part) }];
|
|
469
|
+
input.push({
|
|
470
|
+
role: "user",
|
|
471
|
+
content: yield* Effect.forEach(content, (item) => lowerHostedToolResultContentItem(item, request, extension)),
|
|
472
|
+
});
|
|
445
473
|
continue;
|
|
446
474
|
}
|
|
447
475
|
return yield* ProviderShared.unsupportedContent(extension.name, "assistant", [
|
|
@@ -733,25 +761,21 @@ const onReasoningSummaryPartDone = (state, event) => {
|
|
|
733
761
|
const item = state.reasoningItems[event.item_id];
|
|
734
762
|
if (!item)
|
|
735
763
|
return [state, NO_EVENTS];
|
|
736
|
-
const events = [];
|
|
737
764
|
return [
|
|
738
765
|
{
|
|
739
766
|
...state,
|
|
740
|
-
lifecycle: state.store !== false
|
|
741
|
-
? Lifecycle.reasoningEnd(state.lifecycle, events, `${event.item_id}:${event.summary_index}`, providerMetadata(state, { itemId: event.item_id }))
|
|
742
|
-
: state.lifecycle,
|
|
743
767
|
reasoningItems: {
|
|
744
768
|
...state.reasoningItems,
|
|
745
769
|
[event.item_id]: {
|
|
746
770
|
...item,
|
|
747
771
|
summaryParts: {
|
|
748
772
|
...item.summaryParts,
|
|
749
|
-
[event.summary_index]:
|
|
773
|
+
[event.summary_index]: "can-conclude",
|
|
750
774
|
},
|
|
751
775
|
},
|
|
752
776
|
},
|
|
753
777
|
},
|
|
754
|
-
|
|
778
|
+
NO_EVENTS,
|
|
755
779
|
];
|
|
756
780
|
};
|
|
757
781
|
const onFunctionCallArgumentsDelta = Effect.fn("OpenResponses.onFunctionCallArgumentsDelta")(function* (state, event) {
|
|
@@ -1006,7 +1030,6 @@ export const initial = (request, extension = BASE) => ({
|
|
|
1006
1030
|
messageItems: new Set(),
|
|
1007
1031
|
messagePhases: {},
|
|
1008
1032
|
reasoningItems: {},
|
|
1009
|
-
store: OpenResponsesOptions.resolve(request).store,
|
|
1010
1033
|
});
|
|
1011
1034
|
export const protocol = Protocol.make({
|
|
1012
1035
|
id: ADAPTER,
|
|
@@ -7,6 +7,43 @@ export type OpenAICompatibleResponsesLanguageModelInput = RouteRoutedLanguageMod
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const route: Route<{
|
|
9
9
|
readonly input: readonly ({
|
|
10
|
+
readonly [x: string]: unknown;
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly type: "web_search_call";
|
|
13
|
+
readonly status?: string | undefined;
|
|
14
|
+
readonly action?: {
|
|
15
|
+
readonly [x: string]: unknown;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
} | {
|
|
18
|
+
readonly [x: string]: unknown;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly type: "file_search_call";
|
|
21
|
+
readonly status?: string | undefined;
|
|
22
|
+
readonly queries?: readonly string[] | undefined;
|
|
23
|
+
readonly results?: readonly {
|
|
24
|
+
readonly [x: string]: unknown;
|
|
25
|
+
}[] | null | undefined;
|
|
26
|
+
} | {
|
|
27
|
+
readonly [x: string]: unknown;
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly type: "code_interpreter_call";
|
|
30
|
+
readonly status?: string | undefined;
|
|
31
|
+
readonly code?: string | null | undefined;
|
|
32
|
+
readonly container_id?: string | null | undefined;
|
|
33
|
+
readonly outputs?: readonly {
|
|
34
|
+
readonly [x: string]: unknown;
|
|
35
|
+
}[] | null | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
readonly [x: string]: unknown;
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly type: "mcp_call";
|
|
40
|
+
readonly status?: string | undefined;
|
|
41
|
+
readonly name?: string | undefined;
|
|
42
|
+
readonly output?: string | null | undefined;
|
|
43
|
+
readonly error?: unknown;
|
|
44
|
+
readonly arguments?: string | undefined;
|
|
45
|
+
readonly server_label?: string | undefined;
|
|
46
|
+
} | {
|
|
10
47
|
readonly type: "reasoning";
|
|
11
48
|
readonly summary: readonly {
|
|
12
49
|
readonly type: "summary_text";
|
|
@@ -14,9 +51,6 @@ export declare const route: Route<{
|
|
|
14
51
|
}[];
|
|
15
52
|
readonly id?: string | undefined;
|
|
16
53
|
readonly encrypted_content?: string | null | undefined;
|
|
17
|
-
} | {
|
|
18
|
-
readonly type: "item_reference";
|
|
19
|
-
readonly id: string;
|
|
20
54
|
} | {
|
|
21
55
|
readonly role: "system";
|
|
22
56
|
readonly content: string;
|