|
| 1 | +diff --git a/dist/index.mjs b/dist/index.mjs |
| 2 | +--- a/dist/index.mjs |
| 3 | ++++ b/dist/index.mjs |
| 4 | +@@ -959,7 +959,7 @@ |
| 5 | + model: z4.string().nullish(), |
| 6 | + object: z4.literal("response"), |
| 7 | + output: z4.array(outputItemSchema), |
| 8 | +- usage: xaiResponsesUsageSchema, |
| 9 | ++ usage: xaiResponsesUsageSchema.nullish(), |
| 10 | + status: z4.string() |
| 11 | + }); |
| 12 | + var xaiResponsesChunkSchema = z4.union([ |
| 13 | +\ No newline at end of file |
| 14 | +@@ -1143,6 +1143,18 @@ |
| 15 | + z4.object({ |
| 16 | + type: z4.literal("response.completed"), |
| 17 | + response: xaiResponsesResponseSchema |
| 18 | ++ }), |
| 19 | ++ z4.object({ |
| 20 | ++ type: z4.literal("response.function_call_arguments.delta"), |
| 21 | ++ item_id: z4.string(), |
| 22 | ++ output_index: z4.number(), |
| 23 | ++ delta: z4.string() |
| 24 | ++ }), |
| 25 | ++ z4.object({ |
| 26 | ++ type: z4.literal("response.function_call_arguments.done"), |
| 27 | ++ item_id: z4.string(), |
| 28 | ++ output_index: z4.number(), |
| 29 | ++ arguments: z4.string() |
| 30 | + }) |
| 31 | + ]); |
| 32 | + |
| 33 | +\ No newline at end of file |
| 34 | +@@ -1940,6 +1952,9 @@ |
| 35 | + if (response2.status) { |
| 36 | + finishReason = mapXaiResponsesFinishReason(response2.status); |
| 37 | + } |
| 38 | ++ if (seenToolCalls.size > 0 && finishReason !== "tool-calls") { |
| 39 | ++ finishReason = "tool-calls"; |
| 40 | ++ } |
| 41 | + return; |
| 42 | + } |
| 43 | + if (event.type === "response.output_item.added" || event.type === "response.output_item.done") { |
| 44 | +\ No newline at end of file |
| 45 | +@@ -2024,7 +2039,7 @@ |
| 46 | + } |
| 47 | + } |
| 48 | + } else if (part.type === "function_call") { |
| 49 | +- if (!seenToolCalls.has(part.call_id)) { |
| 50 | ++ if (event.type === "response.output_item.done" && !seenToolCalls.has(part.call_id)) { |
| 51 | + seenToolCalls.add(part.call_id); |
| 52 | + controller.enqueue({ |
| 53 | + type: "tool-input-start", |
| 54 | +\ No newline at end of file |
| 55 | +diff --git a/dist/index.js b/dist/index.js |
| 56 | +--- a/dist/index.js |
| 57 | ++++ b/dist/index.js |
| 58 | +@@ -964,7 +964,7 @@ |
| 59 | + model: import_v44.z.string().nullish(), |
| 60 | + object: import_v44.z.literal("response"), |
| 61 | + output: import_v44.z.array(outputItemSchema), |
| 62 | +- usage: xaiResponsesUsageSchema, |
| 63 | ++ usage: xaiResponsesUsageSchema.nullish(), |
| 64 | + status: import_v44.z.string() |
| 65 | + }); |
| 66 | + var xaiResponsesChunkSchema = import_v44.z.union([ |
| 67 | +\ No newline at end of file |
| 68 | +@@ -1148,6 +1148,18 @@ |
| 69 | + import_v44.z.object({ |
| 70 | + type: import_v44.z.literal("response.completed"), |
| 71 | + response: xaiResponsesResponseSchema |
| 72 | ++ }), |
| 73 | ++ import_v44.z.object({ |
| 74 | ++ type: import_v44.z.literal("response.function_call_arguments.delta"), |
| 75 | ++ item_id: import_v44.z.string(), |
| 76 | ++ output_index: import_v44.z.number(), |
| 77 | ++ delta: import_v44.z.string() |
| 78 | ++ }), |
| 79 | ++ import_v44.z.object({ |
| 80 | ++ type: import_v44.z.literal("response.function_call_arguments.done"), |
| 81 | ++ item_id: import_v44.z.string(), |
| 82 | ++ output_index: import_v44.z.number(), |
| 83 | ++ arguments: import_v44.z.string() |
| 84 | + }) |
| 85 | + ]); |
| 86 | + |
| 87 | +\ No newline at end of file |
| 88 | +@@ -1935,6 +1947,9 @@ |
| 89 | + if (response2.status) { |
| 90 | + finishReason = mapXaiResponsesFinishReason(response2.status); |
| 91 | + } |
| 92 | ++ if (seenToolCalls.size > 0 && finishReason !== "tool-calls") { |
| 93 | ++ finishReason = "tool-calls"; |
| 94 | ++ } |
| 95 | + return; |
| 96 | + } |
| 97 | + if (event.type === "response.output_item.added" || event.type === "response.output_item.done") { |
| 98 | +\ No newline at end of file |
| 99 | +@@ -2019,7 +2034,7 @@ |
| 100 | + } |
| 101 | + } |
| 102 | + } else if (part.type === "function_call") { |
| 103 | +- if (!seenToolCalls.has(part.call_id)) { |
| 104 | ++ if (event.type === "response.output_item.done" && !seenToolCalls.has(part.call_id)) { |
| 105 | + seenToolCalls.add(part.call_id); |
| 106 | + controller.enqueue({ |
| 107 | + type: "tool-input-start", |
| 108 | +\ No newline at end of file |
0 commit comments