@ai-sdk/openai 3.0.29 → 3.0.30
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 +6 -0
- package/dist/index.d.mts +72 -1
- package/dist/index.d.ts +72 -1
- package/dist/index.js +250 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +250 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +30 -0
- package/dist/internal/index.d.ts +30 -0
- package/dist/internal/index.js +249 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +249 -6
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +129 -8
- package/package.json +3 -3
- package/src/responses/convert-to-openai-responses-input.ts +40 -7
- package/src/responses/openai-responses-api.ts +106 -1
- package/src/responses/openai-responses-language-model.ts +69 -1
- package/src/responses/openai-responses-prepare-tools.ts +114 -0
- package/src/tool/shell.ts +119 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -293,6 +293,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
293
293
|
action: {
|
|
294
294
|
commands: string[];
|
|
295
295
|
};
|
|
296
|
+
} | {
|
|
297
|
+
type: "shell_call_output";
|
|
298
|
+
id: string;
|
|
299
|
+
call_id: string;
|
|
300
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
301
|
+
output: {
|
|
302
|
+
stdout: string;
|
|
303
|
+
stderr: string;
|
|
304
|
+
outcome: {
|
|
305
|
+
type: "timeout";
|
|
306
|
+
} | {
|
|
307
|
+
type: "exit";
|
|
308
|
+
exit_code: number;
|
|
309
|
+
};
|
|
310
|
+
}[];
|
|
296
311
|
};
|
|
297
312
|
} | {
|
|
298
313
|
type: "response.output_item.done";
|
|
@@ -439,6 +454,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
439
454
|
action: {
|
|
440
455
|
commands: string[];
|
|
441
456
|
};
|
|
457
|
+
} | {
|
|
458
|
+
type: "shell_call_output";
|
|
459
|
+
id: string;
|
|
460
|
+
call_id: string;
|
|
461
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
462
|
+
output: {
|
|
463
|
+
stdout: string;
|
|
464
|
+
stderr: string;
|
|
465
|
+
outcome: {
|
|
466
|
+
type: "timeout";
|
|
467
|
+
} | {
|
|
468
|
+
type: "exit";
|
|
469
|
+
exit_code: number;
|
|
470
|
+
};
|
|
471
|
+
}[];
|
|
442
472
|
};
|
|
443
473
|
} | {
|
|
444
474
|
type: "response.function_call_arguments.delta";
|
|
@@ -700,7 +730,48 @@ declare const openaiTools: {
|
|
|
700
730
|
exitCode: number;
|
|
701
731
|
};
|
|
702
732
|
}>;
|
|
703
|
-
}, {
|
|
733
|
+
}, {
|
|
734
|
+
environment?: {
|
|
735
|
+
type: "containerAuto";
|
|
736
|
+
fileIds?: string[];
|
|
737
|
+
memoryLimit?: "1g" | "4g" | "16g" | "64g";
|
|
738
|
+
networkPolicy?: {
|
|
739
|
+
type: "disabled";
|
|
740
|
+
} | {
|
|
741
|
+
type: "allowlist";
|
|
742
|
+
allowedDomains: string[];
|
|
743
|
+
domainSecrets?: Array<{
|
|
744
|
+
domain: string;
|
|
745
|
+
name: string;
|
|
746
|
+
value: string;
|
|
747
|
+
}>;
|
|
748
|
+
};
|
|
749
|
+
skills?: Array<{
|
|
750
|
+
type: "skillReference";
|
|
751
|
+
skillId: string;
|
|
752
|
+
version?: string;
|
|
753
|
+
} | {
|
|
754
|
+
type: "inline";
|
|
755
|
+
name: string;
|
|
756
|
+
description: string;
|
|
757
|
+
source: {
|
|
758
|
+
type: "base64";
|
|
759
|
+
mediaType: "application/zip";
|
|
760
|
+
data: string;
|
|
761
|
+
};
|
|
762
|
+
}>;
|
|
763
|
+
} | {
|
|
764
|
+
type: "containerReference";
|
|
765
|
+
containerId: string;
|
|
766
|
+
} | {
|
|
767
|
+
type?: "local";
|
|
768
|
+
skills?: Array<{
|
|
769
|
+
name: string;
|
|
770
|
+
description: string;
|
|
771
|
+
path: string;
|
|
772
|
+
}>;
|
|
773
|
+
};
|
|
774
|
+
}>;
|
|
704
775
|
/**
|
|
705
776
|
* Web search allows models to access up-to-date information from the internet
|
|
706
777
|
* and provide answers with sourced citations.
|
package/dist/index.d.ts
CHANGED
|
@@ -293,6 +293,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
293
293
|
action: {
|
|
294
294
|
commands: string[];
|
|
295
295
|
};
|
|
296
|
+
} | {
|
|
297
|
+
type: "shell_call_output";
|
|
298
|
+
id: string;
|
|
299
|
+
call_id: string;
|
|
300
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
301
|
+
output: {
|
|
302
|
+
stdout: string;
|
|
303
|
+
stderr: string;
|
|
304
|
+
outcome: {
|
|
305
|
+
type: "timeout";
|
|
306
|
+
} | {
|
|
307
|
+
type: "exit";
|
|
308
|
+
exit_code: number;
|
|
309
|
+
};
|
|
310
|
+
}[];
|
|
296
311
|
};
|
|
297
312
|
} | {
|
|
298
313
|
type: "response.output_item.done";
|
|
@@ -439,6 +454,21 @@ declare const openaiResponsesChunkSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
439
454
|
action: {
|
|
440
455
|
commands: string[];
|
|
441
456
|
};
|
|
457
|
+
} | {
|
|
458
|
+
type: "shell_call_output";
|
|
459
|
+
id: string;
|
|
460
|
+
call_id: string;
|
|
461
|
+
status: "completed" | "in_progress" | "incomplete";
|
|
462
|
+
output: {
|
|
463
|
+
stdout: string;
|
|
464
|
+
stderr: string;
|
|
465
|
+
outcome: {
|
|
466
|
+
type: "timeout";
|
|
467
|
+
} | {
|
|
468
|
+
type: "exit";
|
|
469
|
+
exit_code: number;
|
|
470
|
+
};
|
|
471
|
+
}[];
|
|
442
472
|
};
|
|
443
473
|
} | {
|
|
444
474
|
type: "response.function_call_arguments.delta";
|
|
@@ -700,7 +730,48 @@ declare const openaiTools: {
|
|
|
700
730
|
exitCode: number;
|
|
701
731
|
};
|
|
702
732
|
}>;
|
|
703
|
-
}, {
|
|
733
|
+
}, {
|
|
734
|
+
environment?: {
|
|
735
|
+
type: "containerAuto";
|
|
736
|
+
fileIds?: string[];
|
|
737
|
+
memoryLimit?: "1g" | "4g" | "16g" | "64g";
|
|
738
|
+
networkPolicy?: {
|
|
739
|
+
type: "disabled";
|
|
740
|
+
} | {
|
|
741
|
+
type: "allowlist";
|
|
742
|
+
allowedDomains: string[];
|
|
743
|
+
domainSecrets?: Array<{
|
|
744
|
+
domain: string;
|
|
745
|
+
name: string;
|
|
746
|
+
value: string;
|
|
747
|
+
}>;
|
|
748
|
+
};
|
|
749
|
+
skills?: Array<{
|
|
750
|
+
type: "skillReference";
|
|
751
|
+
skillId: string;
|
|
752
|
+
version?: string;
|
|
753
|
+
} | {
|
|
754
|
+
type: "inline";
|
|
755
|
+
name: string;
|
|
756
|
+
description: string;
|
|
757
|
+
source: {
|
|
758
|
+
type: "base64";
|
|
759
|
+
mediaType: "application/zip";
|
|
760
|
+
data: string;
|
|
761
|
+
};
|
|
762
|
+
}>;
|
|
763
|
+
} | {
|
|
764
|
+
type: "containerReference";
|
|
765
|
+
containerId: string;
|
|
766
|
+
} | {
|
|
767
|
+
type?: "local";
|
|
768
|
+
skills?: Array<{
|
|
769
|
+
name: string;
|
|
770
|
+
description: string;
|
|
771
|
+
path: string;
|
|
772
|
+
}>;
|
|
773
|
+
};
|
|
774
|
+
}>;
|
|
704
775
|
/**
|
|
705
776
|
* Web search allows models to access up-to-date information from the internet
|
|
706
777
|
* and provide answers with sourced citations.
|
package/dist/index.js
CHANGED
|
@@ -2181,6 +2181,67 @@ var shellOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2181
2181
|
})
|
|
2182
2182
|
)
|
|
2183
2183
|
);
|
|
2184
|
+
var shellSkillsSchema = import_v414.z.array(
|
|
2185
|
+
import_v414.z.discriminatedUnion("type", [
|
|
2186
|
+
import_v414.z.object({
|
|
2187
|
+
type: import_v414.z.literal("skillReference"),
|
|
2188
|
+
skillId: import_v414.z.string(),
|
|
2189
|
+
version: import_v414.z.string().optional()
|
|
2190
|
+
}),
|
|
2191
|
+
import_v414.z.object({
|
|
2192
|
+
type: import_v414.z.literal("inline"),
|
|
2193
|
+
name: import_v414.z.string(),
|
|
2194
|
+
description: import_v414.z.string(),
|
|
2195
|
+
source: import_v414.z.object({
|
|
2196
|
+
type: import_v414.z.literal("base64"),
|
|
2197
|
+
mediaType: import_v414.z.literal("application/zip"),
|
|
2198
|
+
data: import_v414.z.string()
|
|
2199
|
+
})
|
|
2200
|
+
})
|
|
2201
|
+
])
|
|
2202
|
+
).optional();
|
|
2203
|
+
var shellArgsSchema = (0, import_provider_utils19.lazySchema)(
|
|
2204
|
+
() => (0, import_provider_utils19.zodSchema)(
|
|
2205
|
+
import_v414.z.object({
|
|
2206
|
+
environment: import_v414.z.union([
|
|
2207
|
+
import_v414.z.object({
|
|
2208
|
+
type: import_v414.z.literal("containerAuto"),
|
|
2209
|
+
fileIds: import_v414.z.array(import_v414.z.string()).optional(),
|
|
2210
|
+
memoryLimit: import_v414.z.enum(["1g", "4g", "16g", "64g"]).optional(),
|
|
2211
|
+
networkPolicy: import_v414.z.discriminatedUnion("type", [
|
|
2212
|
+
import_v414.z.object({ type: import_v414.z.literal("disabled") }),
|
|
2213
|
+
import_v414.z.object({
|
|
2214
|
+
type: import_v414.z.literal("allowlist"),
|
|
2215
|
+
allowedDomains: import_v414.z.array(import_v414.z.string()),
|
|
2216
|
+
domainSecrets: import_v414.z.array(
|
|
2217
|
+
import_v414.z.object({
|
|
2218
|
+
domain: import_v414.z.string(),
|
|
2219
|
+
name: import_v414.z.string(),
|
|
2220
|
+
value: import_v414.z.string()
|
|
2221
|
+
})
|
|
2222
|
+
).optional()
|
|
2223
|
+
})
|
|
2224
|
+
]).optional(),
|
|
2225
|
+
skills: shellSkillsSchema
|
|
2226
|
+
}),
|
|
2227
|
+
import_v414.z.object({
|
|
2228
|
+
type: import_v414.z.literal("containerReference"),
|
|
2229
|
+
containerId: import_v414.z.string()
|
|
2230
|
+
}),
|
|
2231
|
+
import_v414.z.object({
|
|
2232
|
+
type: import_v414.z.literal("local").optional(),
|
|
2233
|
+
skills: import_v414.z.array(
|
|
2234
|
+
import_v414.z.object({
|
|
2235
|
+
name: import_v414.z.string(),
|
|
2236
|
+
description: import_v414.z.string(),
|
|
2237
|
+
path: import_v414.z.string()
|
|
2238
|
+
})
|
|
2239
|
+
).optional()
|
|
2240
|
+
})
|
|
2241
|
+
]).optional()
|
|
2242
|
+
})
|
|
2243
|
+
)
|
|
2244
|
+
);
|
|
2184
2245
|
var shell = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2185
2246
|
id: "openai.shell",
|
|
2186
2247
|
inputSchema: shellInputSchema,
|
|
@@ -2695,8 +2756,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2695
2756
|
if (hasConversation) {
|
|
2696
2757
|
break;
|
|
2697
2758
|
}
|
|
2759
|
+
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2760
|
+
part.toolName
|
|
2761
|
+
);
|
|
2762
|
+
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2763
|
+
if (part.output.type === "json") {
|
|
2764
|
+
const parsedOutput = await (0, import_provider_utils23.validateTypes)({
|
|
2765
|
+
value: part.output.value,
|
|
2766
|
+
schema: shellOutputSchema
|
|
2767
|
+
});
|
|
2768
|
+
input.push({
|
|
2769
|
+
type: "shell_call_output",
|
|
2770
|
+
call_id: part.toolCallId,
|
|
2771
|
+
output: parsedOutput.output.map((item) => ({
|
|
2772
|
+
stdout: item.stdout,
|
|
2773
|
+
stderr: item.stderr,
|
|
2774
|
+
outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
|
|
2775
|
+
type: "exit",
|
|
2776
|
+
exit_code: item.outcome.exitCode
|
|
2777
|
+
}
|
|
2778
|
+
}))
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
break;
|
|
2782
|
+
}
|
|
2698
2783
|
if (store) {
|
|
2699
|
-
const itemId = (_j = (_i = (_h = part.
|
|
2784
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2700
2785
|
input.push({ type: "item_reference", id: itemId });
|
|
2701
2786
|
} else {
|
|
2702
2787
|
warnings.push({
|
|
@@ -3071,6 +3156,25 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3071
3156
|
action: import_v419.z.object({
|
|
3072
3157
|
commands: import_v419.z.array(import_v419.z.string())
|
|
3073
3158
|
})
|
|
3159
|
+
}),
|
|
3160
|
+
import_v419.z.object({
|
|
3161
|
+
type: import_v419.z.literal("shell_call_output"),
|
|
3162
|
+
id: import_v419.z.string(),
|
|
3163
|
+
call_id: import_v419.z.string(),
|
|
3164
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3165
|
+
output: import_v419.z.array(
|
|
3166
|
+
import_v419.z.object({
|
|
3167
|
+
stdout: import_v419.z.string(),
|
|
3168
|
+
stderr: import_v419.z.string(),
|
|
3169
|
+
outcome: import_v419.z.discriminatedUnion("type", [
|
|
3170
|
+
import_v419.z.object({ type: import_v419.z.literal("timeout") }),
|
|
3171
|
+
import_v419.z.object({
|
|
3172
|
+
type: import_v419.z.literal("exit"),
|
|
3173
|
+
exit_code: import_v419.z.number()
|
|
3174
|
+
})
|
|
3175
|
+
])
|
|
3176
|
+
})
|
|
3177
|
+
)
|
|
3074
3178
|
})
|
|
3075
3179
|
])
|
|
3076
3180
|
}),
|
|
@@ -3250,6 +3354,25 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3250
3354
|
action: import_v419.z.object({
|
|
3251
3355
|
commands: import_v419.z.array(import_v419.z.string())
|
|
3252
3356
|
})
|
|
3357
|
+
}),
|
|
3358
|
+
import_v419.z.object({
|
|
3359
|
+
type: import_v419.z.literal("shell_call_output"),
|
|
3360
|
+
id: import_v419.z.string(),
|
|
3361
|
+
call_id: import_v419.z.string(),
|
|
3362
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3363
|
+
output: import_v419.z.array(
|
|
3364
|
+
import_v419.z.object({
|
|
3365
|
+
stdout: import_v419.z.string(),
|
|
3366
|
+
stderr: import_v419.z.string(),
|
|
3367
|
+
outcome: import_v419.z.discriminatedUnion("type", [
|
|
3368
|
+
import_v419.z.object({ type: import_v419.z.literal("timeout") }),
|
|
3369
|
+
import_v419.z.object({
|
|
3370
|
+
type: import_v419.z.literal("exit"),
|
|
3371
|
+
exit_code: import_v419.z.number()
|
|
3372
|
+
})
|
|
3373
|
+
])
|
|
3374
|
+
})
|
|
3375
|
+
)
|
|
3253
3376
|
})
|
|
3254
3377
|
])
|
|
3255
3378
|
}),
|
|
@@ -3595,6 +3718,25 @@ var openaiResponsesResponseSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3595
3718
|
action: import_v419.z.object({
|
|
3596
3719
|
commands: import_v419.z.array(import_v419.z.string())
|
|
3597
3720
|
})
|
|
3721
|
+
}),
|
|
3722
|
+
import_v419.z.object({
|
|
3723
|
+
type: import_v419.z.literal("shell_call_output"),
|
|
3724
|
+
id: import_v419.z.string(),
|
|
3725
|
+
call_id: import_v419.z.string(),
|
|
3726
|
+
status: import_v419.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3727
|
+
output: import_v419.z.array(
|
|
3728
|
+
import_v419.z.object({
|
|
3729
|
+
stdout: import_v419.z.string(),
|
|
3730
|
+
stderr: import_v419.z.string(),
|
|
3731
|
+
outcome: import_v419.z.discriminatedUnion("type", [
|
|
3732
|
+
import_v419.z.object({ type: import_v419.z.literal("timeout") }),
|
|
3733
|
+
import_v419.z.object({
|
|
3734
|
+
type: import_v419.z.literal("exit"),
|
|
3735
|
+
exit_code: import_v419.z.number()
|
|
3736
|
+
})
|
|
3737
|
+
])
|
|
3738
|
+
})
|
|
3739
|
+
)
|
|
3598
3740
|
})
|
|
3599
3741
|
])
|
|
3600
3742
|
).optional(),
|
|
@@ -3888,8 +4030,15 @@ async function prepareResponsesTools({
|
|
|
3888
4030
|
break;
|
|
3889
4031
|
}
|
|
3890
4032
|
case "openai.shell": {
|
|
4033
|
+
const args = await (0, import_provider_utils26.validateTypes)({
|
|
4034
|
+
value: tool.args,
|
|
4035
|
+
schema: shellArgsSchema
|
|
4036
|
+
});
|
|
3891
4037
|
openaiTools2.push({
|
|
3892
|
-
type: "shell"
|
|
4038
|
+
type: "shell",
|
|
4039
|
+
...args.environment && {
|
|
4040
|
+
environment: mapShellEnvironment(args.environment)
|
|
4041
|
+
}
|
|
3893
4042
|
});
|
|
3894
4043
|
break;
|
|
3895
4044
|
}
|
|
@@ -4019,6 +4168,52 @@ async function prepareResponsesTools({
|
|
|
4019
4168
|
}
|
|
4020
4169
|
}
|
|
4021
4170
|
}
|
|
4171
|
+
function mapShellEnvironment(environment) {
|
|
4172
|
+
if (environment.type === "containerReference") {
|
|
4173
|
+
const env2 = environment;
|
|
4174
|
+
return {
|
|
4175
|
+
type: "container_reference",
|
|
4176
|
+
container_id: env2.containerId
|
|
4177
|
+
};
|
|
4178
|
+
}
|
|
4179
|
+
if (environment.type === "containerAuto") {
|
|
4180
|
+
const env2 = environment;
|
|
4181
|
+
return {
|
|
4182
|
+
type: "container_auto",
|
|
4183
|
+
file_ids: env2.fileIds,
|
|
4184
|
+
memory_limit: env2.memoryLimit,
|
|
4185
|
+
network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
|
|
4186
|
+
type: "allowlist",
|
|
4187
|
+
allowed_domains: env2.networkPolicy.allowedDomains,
|
|
4188
|
+
domain_secrets: env2.networkPolicy.domainSecrets
|
|
4189
|
+
},
|
|
4190
|
+
skills: mapShellSkills(env2.skills)
|
|
4191
|
+
};
|
|
4192
|
+
}
|
|
4193
|
+
const env = environment;
|
|
4194
|
+
return {
|
|
4195
|
+
type: "local",
|
|
4196
|
+
skills: env.skills
|
|
4197
|
+
};
|
|
4198
|
+
}
|
|
4199
|
+
function mapShellSkills(skills) {
|
|
4200
|
+
return skills == null ? void 0 : skills.map(
|
|
4201
|
+
(skill) => skill.type === "skillReference" ? {
|
|
4202
|
+
type: "skill_reference",
|
|
4203
|
+
skill_id: skill.skillId,
|
|
4204
|
+
version: skill.version
|
|
4205
|
+
} : {
|
|
4206
|
+
type: "inline",
|
|
4207
|
+
name: skill.name,
|
|
4208
|
+
description: skill.description,
|
|
4209
|
+
source: {
|
|
4210
|
+
type: "base64",
|
|
4211
|
+
media_type: skill.source.mediaType,
|
|
4212
|
+
data: skill.source.data
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
);
|
|
4216
|
+
}
|
|
4022
4217
|
|
|
4023
4218
|
// src/responses/openai-responses-language-model.ts
|
|
4024
4219
|
function extractApprovalRequestIdToToolCallIdMapping(prompt) {
|
|
@@ -4064,7 +4259,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4064
4259
|
toolChoice,
|
|
4065
4260
|
responseFormat
|
|
4066
4261
|
}) {
|
|
4067
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4262
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4068
4263
|
const warnings = [];
|
|
4069
4264
|
const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
|
|
4070
4265
|
if (topK != null) {
|
|
@@ -4268,6 +4463,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4268
4463
|
tools,
|
|
4269
4464
|
toolChoice
|
|
4270
4465
|
});
|
|
4466
|
+
const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
|
|
4467
|
+
(tool) => tool.type === "provider" && tool.id === "openai.shell"
|
|
4468
|
+
)) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
|
|
4469
|
+
const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
|
|
4271
4470
|
return {
|
|
4272
4471
|
webSearchToolName,
|
|
4273
4472
|
args: {
|
|
@@ -4278,7 +4477,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4278
4477
|
warnings: [...warnings, ...toolWarnings],
|
|
4279
4478
|
store,
|
|
4280
4479
|
toolNameMapping,
|
|
4281
|
-
providerOptionsName
|
|
4480
|
+
providerOptionsName,
|
|
4481
|
+
isShellProviderExecuted
|
|
4282
4482
|
};
|
|
4283
4483
|
}
|
|
4284
4484
|
async doGenerate(options) {
|
|
@@ -4288,7 +4488,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4288
4488
|
warnings,
|
|
4289
4489
|
webSearchToolName,
|
|
4290
4490
|
toolNameMapping,
|
|
4291
|
-
providerOptionsName
|
|
4491
|
+
providerOptionsName,
|
|
4492
|
+
isShellProviderExecuted
|
|
4292
4493
|
} = await this.getArgs(options);
|
|
4293
4494
|
const url = this.config.url({
|
|
4294
4495
|
path: "/responses",
|
|
@@ -4388,6 +4589,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4388
4589
|
commands: part.action.commands
|
|
4389
4590
|
}
|
|
4390
4591
|
}),
|
|
4592
|
+
...isShellProviderExecuted && { providerExecuted: true },
|
|
4391
4593
|
providerMetadata: {
|
|
4392
4594
|
[providerOptionsName]: {
|
|
4393
4595
|
itemId: part.id
|
|
@@ -4396,6 +4598,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4396
4598
|
});
|
|
4397
4599
|
break;
|
|
4398
4600
|
}
|
|
4601
|
+
case "shell_call_output": {
|
|
4602
|
+
content.push({
|
|
4603
|
+
type: "tool-result",
|
|
4604
|
+
toolCallId: part.call_id,
|
|
4605
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
4606
|
+
result: {
|
|
4607
|
+
output: part.output.map((item) => ({
|
|
4608
|
+
stdout: item.stdout,
|
|
4609
|
+
stderr: item.stderr,
|
|
4610
|
+
outcome: item.outcome.type === "exit" ? {
|
|
4611
|
+
type: "exit",
|
|
4612
|
+
exitCode: item.outcome.exit_code
|
|
4613
|
+
} : { type: "timeout" }
|
|
4614
|
+
}))
|
|
4615
|
+
}
|
|
4616
|
+
});
|
|
4617
|
+
break;
|
|
4618
|
+
}
|
|
4399
4619
|
case "message": {
|
|
4400
4620
|
for (const contentPart of part.content) {
|
|
4401
4621
|
if (((_c = (_b = options.providerOptions) == null ? void 0 : _b[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
|
|
@@ -4685,7 +4905,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4685
4905
|
webSearchToolName,
|
|
4686
4906
|
toolNameMapping,
|
|
4687
4907
|
store,
|
|
4688
|
-
providerOptionsName
|
|
4908
|
+
providerOptionsName,
|
|
4909
|
+
isShellProviderExecuted
|
|
4689
4910
|
} = await this.getArgs(options);
|
|
4690
4911
|
const { responseHeaders, value: response } = await (0, import_provider_utils27.postJsonToApi)({
|
|
4691
4912
|
url: this.config.url({
|
|
@@ -4864,6 +5085,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4864
5085
|
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
4865
5086
|
toolCallId: value.item.call_id
|
|
4866
5087
|
};
|
|
5088
|
+
} else if (value.item.type === "shell_call_output") {
|
|
4867
5089
|
} else if (value.item.type === "message") {
|
|
4868
5090
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
4869
5091
|
controller.enqueue({
|
|
@@ -5117,10 +5339,31 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5117
5339
|
commands: value.item.action.commands
|
|
5118
5340
|
}
|
|
5119
5341
|
}),
|
|
5342
|
+
...isShellProviderExecuted && {
|
|
5343
|
+
providerExecuted: true
|
|
5344
|
+
},
|
|
5120
5345
|
providerMetadata: {
|
|
5121
5346
|
[providerOptionsName]: { itemId: value.item.id }
|
|
5122
5347
|
}
|
|
5123
5348
|
});
|
|
5349
|
+
} else if (value.item.type === "shell_call_output") {
|
|
5350
|
+
controller.enqueue({
|
|
5351
|
+
type: "tool-result",
|
|
5352
|
+
toolCallId: value.item.call_id,
|
|
5353
|
+
toolName: toolNameMapping.toCustomToolName("shell"),
|
|
5354
|
+
result: {
|
|
5355
|
+
output: value.item.output.map(
|
|
5356
|
+
(item) => ({
|
|
5357
|
+
stdout: item.stdout,
|
|
5358
|
+
stderr: item.stderr,
|
|
5359
|
+
outcome: item.outcome.type === "exit" ? {
|
|
5360
|
+
type: "exit",
|
|
5361
|
+
exitCode: item.outcome.exit_code
|
|
5362
|
+
} : { type: "timeout" }
|
|
5363
|
+
})
|
|
5364
|
+
)
|
|
5365
|
+
}
|
|
5366
|
+
});
|
|
5124
5367
|
} else if (value.item.type === "reasoning") {
|
|
5125
5368
|
const activeReasoningPart = activeReasoning[value.item.id];
|
|
5126
5369
|
const summaryPartIndices = Object.entries(
|
|
@@ -5813,7 +6056,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5813
6056
|
};
|
|
5814
6057
|
|
|
5815
6058
|
// src/version.ts
|
|
5816
|
-
var VERSION = true ? "3.0.
|
|
6059
|
+
var VERSION = true ? "3.0.30" : "0.0.0-test";
|
|
5817
6060
|
|
|
5818
6061
|
// src/openai-provider.ts
|
|
5819
6062
|
function createOpenAI(options = {}) {
|