@ai-sdk/openai 3.0.0-beta.110 → 3.0.0-beta.111
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.js +109 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -21
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +108 -20
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +108 -20
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -3230,6 +3230,19 @@ var openaiResponsesChunkSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3230
3230
|
item_id: import_v419.z.string(),
|
|
3231
3231
|
summary_index: import_v419.z.number()
|
|
3232
3232
|
}),
|
|
3233
|
+
import_v419.z.object({
|
|
3234
|
+
type: import_v419.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3235
|
+
item_id: import_v419.z.string(),
|
|
3236
|
+
output_index: import_v419.z.number(),
|
|
3237
|
+
delta: import_v419.z.string(),
|
|
3238
|
+
obfuscation: import_v419.z.string().nullish()
|
|
3239
|
+
}),
|
|
3240
|
+
import_v419.z.object({
|
|
3241
|
+
type: import_v419.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3242
|
+
item_id: import_v419.z.string(),
|
|
3243
|
+
output_index: import_v419.z.number(),
|
|
3244
|
+
diff: import_v419.z.string()
|
|
3245
|
+
}),
|
|
3233
3246
|
import_v419.z.object({
|
|
3234
3247
|
type: import_v419.z.literal("error"),
|
|
3235
3248
|
sequence_number: import_v419.z.number(),
|
|
@@ -4669,24 +4682,40 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4669
4682
|
providerExecuted: true
|
|
4670
4683
|
});
|
|
4671
4684
|
} else if (value.item.type === "apply_patch_call") {
|
|
4685
|
+
const { call_id: callId, operation } = value.item;
|
|
4672
4686
|
ongoingToolCalls[value.output_index] = {
|
|
4673
4687
|
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4674
|
-
toolCallId:
|
|
4688
|
+
toolCallId: callId,
|
|
4689
|
+
applyPatch: {
|
|
4690
|
+
// delete_file doesn't have diff
|
|
4691
|
+
hasDiff: operation.type === "delete_file",
|
|
4692
|
+
endEmitted: operation.type === "delete_file"
|
|
4693
|
+
}
|
|
4675
4694
|
};
|
|
4676
|
-
|
|
4695
|
+
controller.enqueue({
|
|
4696
|
+
type: "tool-input-start",
|
|
4697
|
+
id: callId,
|
|
4698
|
+
toolName: toolNameMapping.toCustomToolName("apply_patch")
|
|
4699
|
+
});
|
|
4700
|
+
if (operation.type === "delete_file") {
|
|
4701
|
+
const inputString = JSON.stringify({
|
|
4702
|
+
callId,
|
|
4703
|
+
operation
|
|
4704
|
+
});
|
|
4677
4705
|
controller.enqueue({
|
|
4678
|
-
type: "tool-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4706
|
+
type: "tool-input-delta",
|
|
4707
|
+
id: callId,
|
|
4708
|
+
delta: inputString
|
|
4709
|
+
});
|
|
4710
|
+
controller.enqueue({
|
|
4711
|
+
type: "tool-input-end",
|
|
4712
|
+
id: callId
|
|
4713
|
+
});
|
|
4714
|
+
} else {
|
|
4715
|
+
controller.enqueue({
|
|
4716
|
+
type: "tool-input-delta",
|
|
4717
|
+
id: callId,
|
|
4718
|
+
delta: `{"callId":"${escapeJSONDelta(callId)}","operation":{"type":"${escapeJSONDelta(operation.type)}","path":"${escapeJSONDelta(operation.path)}","diff":"`
|
|
4690
4719
|
});
|
|
4691
4720
|
}
|
|
4692
4721
|
} else if (value.item.type === "shell_call") {
|
|
@@ -4839,11 +4868,30 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4839
4868
|
} else if (value.item.type === "mcp_list_tools") {
|
|
4840
4869
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4841
4870
|
} else if (value.item.type === "apply_patch_call") {
|
|
4842
|
-
ongoingToolCalls[value.output_index]
|
|
4843
|
-
if (value.item.
|
|
4871
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
4872
|
+
if ((toolCall == null ? void 0 : toolCall.applyPatch) && !toolCall.applyPatch.endEmitted && value.item.operation.type !== "delete_file") {
|
|
4873
|
+
if (!toolCall.applyPatch.hasDiff) {
|
|
4874
|
+
controller.enqueue({
|
|
4875
|
+
type: "tool-input-delta",
|
|
4876
|
+
id: toolCall.toolCallId,
|
|
4877
|
+
delta: escapeJSONDelta(value.item.operation.diff)
|
|
4878
|
+
});
|
|
4879
|
+
}
|
|
4880
|
+
controller.enqueue({
|
|
4881
|
+
type: "tool-input-delta",
|
|
4882
|
+
id: toolCall.toolCallId,
|
|
4883
|
+
delta: '"}}'
|
|
4884
|
+
});
|
|
4885
|
+
controller.enqueue({
|
|
4886
|
+
type: "tool-input-end",
|
|
4887
|
+
id: toolCall.toolCallId
|
|
4888
|
+
});
|
|
4889
|
+
toolCall.applyPatch.endEmitted = true;
|
|
4890
|
+
}
|
|
4891
|
+
if (toolCall && value.item.status === "completed") {
|
|
4844
4892
|
controller.enqueue({
|
|
4845
4893
|
type: "tool-call",
|
|
4846
|
-
toolCallId:
|
|
4894
|
+
toolCallId: toolCall.toolCallId,
|
|
4847
4895
|
toolName: toolNameMapping.toCustomToolName("apply_patch"),
|
|
4848
4896
|
input: JSON.stringify({
|
|
4849
4897
|
callId: value.item.call_id,
|
|
@@ -4856,6 +4904,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4856
4904
|
}
|
|
4857
4905
|
});
|
|
4858
4906
|
}
|
|
4907
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
4859
4908
|
} else if (value.item.type === "mcp_approval_request") {
|
|
4860
4909
|
ongoingToolCalls[value.output_index] = void 0;
|
|
4861
4910
|
} else if (value.item.type === "local_shell_call") {
|
|
@@ -4923,6 +4972,38 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4923
4972
|
delta: value.delta
|
|
4924
4973
|
});
|
|
4925
4974
|
}
|
|
4975
|
+
} else if (isResponseApplyPatchCallOperationDiffDeltaChunk(value)) {
|
|
4976
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
4977
|
+
if (toolCall == null ? void 0 : toolCall.applyPatch) {
|
|
4978
|
+
controller.enqueue({
|
|
4979
|
+
type: "tool-input-delta",
|
|
4980
|
+
id: toolCall.toolCallId,
|
|
4981
|
+
delta: escapeJSONDelta(value.delta)
|
|
4982
|
+
});
|
|
4983
|
+
toolCall.applyPatch.hasDiff = true;
|
|
4984
|
+
}
|
|
4985
|
+
} else if (isResponseApplyPatchCallOperationDiffDoneChunk(value)) {
|
|
4986
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
4987
|
+
if ((toolCall == null ? void 0 : toolCall.applyPatch) && !toolCall.applyPatch.endEmitted) {
|
|
4988
|
+
if (!toolCall.applyPatch.hasDiff) {
|
|
4989
|
+
controller.enqueue({
|
|
4990
|
+
type: "tool-input-delta",
|
|
4991
|
+
id: toolCall.toolCallId,
|
|
4992
|
+
delta: escapeJSONDelta(value.diff)
|
|
4993
|
+
});
|
|
4994
|
+
toolCall.applyPatch.hasDiff = true;
|
|
4995
|
+
}
|
|
4996
|
+
controller.enqueue({
|
|
4997
|
+
type: "tool-input-delta",
|
|
4998
|
+
id: toolCall.toolCallId,
|
|
4999
|
+
delta: '"}}'
|
|
5000
|
+
});
|
|
5001
|
+
controller.enqueue({
|
|
5002
|
+
type: "tool-input-end",
|
|
5003
|
+
id: toolCall.toolCallId
|
|
5004
|
+
});
|
|
5005
|
+
toolCall.applyPatch.endEmitted = true;
|
|
5006
|
+
}
|
|
4926
5007
|
} else if (isResponseImageGenerationCallPartialImageChunk(value)) {
|
|
4927
5008
|
controller.enqueue({
|
|
4928
5009
|
type: "tool-result",
|
|
@@ -4939,9 +5020,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4939
5020
|
controller.enqueue({
|
|
4940
5021
|
type: "tool-input-delta",
|
|
4941
5022
|
id: toolCall.toolCallId,
|
|
4942
|
-
|
|
4943
|
-
// To escape it, we use JSON.stringify and slice to remove the outer quotes.
|
|
4944
|
-
delta: JSON.stringify(value.delta).slice(1, -1)
|
|
5023
|
+
delta: escapeJSONDelta(value.delta)
|
|
4945
5024
|
});
|
|
4946
5025
|
}
|
|
4947
5026
|
} else if (isResponseCodeInterpreterCallCodeDoneChunk(value)) {
|
|
@@ -5161,6 +5240,12 @@ function isResponseCodeInterpreterCallCodeDeltaChunk(chunk) {
|
|
|
5161
5240
|
function isResponseCodeInterpreterCallCodeDoneChunk(chunk) {
|
|
5162
5241
|
return chunk.type === "response.code_interpreter_call_code.done";
|
|
5163
5242
|
}
|
|
5243
|
+
function isResponseApplyPatchCallOperationDiffDeltaChunk(chunk) {
|
|
5244
|
+
return chunk.type === "response.apply_patch_call_operation_diff.delta";
|
|
5245
|
+
}
|
|
5246
|
+
function isResponseApplyPatchCallOperationDiffDoneChunk(chunk) {
|
|
5247
|
+
return chunk.type === "response.apply_patch_call_operation_diff.done";
|
|
5248
|
+
}
|
|
5164
5249
|
function isResponseOutputItemAddedChunk(chunk) {
|
|
5165
5250
|
return chunk.type === "response.output_item.added";
|
|
5166
5251
|
}
|
|
@@ -5191,6 +5276,9 @@ function mapWebSearchOutput(action) {
|
|
|
5191
5276
|
};
|
|
5192
5277
|
}
|
|
5193
5278
|
}
|
|
5279
|
+
function escapeJSONDelta(delta) {
|
|
5280
|
+
return JSON.stringify(delta).slice(1, -1);
|
|
5281
|
+
}
|
|
5194
5282
|
|
|
5195
5283
|
// src/speech/openai-speech-model.ts
|
|
5196
5284
|
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
@@ -5545,7 +5633,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5545
5633
|
};
|
|
5546
5634
|
|
|
5547
5635
|
// src/version.ts
|
|
5548
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5636
|
+
var VERSION = true ? "3.0.0-beta.111" : "0.0.0-test";
|
|
5549
5637
|
|
|
5550
5638
|
// src/openai-provider.ts
|
|
5551
5639
|
function createOpenAI(options = {}) {
|