@codex-native/sdk 0.0.34 → 0.0.36
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/cli.cjs +9 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +9 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +19 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +19 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.mjs
CHANGED
|
@@ -95,6 +95,23 @@ var CodexProvider = class {
|
|
|
95
95
|
this.getCodex().setApprovalCallback(callback);
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
+
var normalizeToolChoice = (toolChoice) => {
|
|
99
|
+
if (toolChoice === void 0) {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
if (toolChoice === "auto" || toolChoice === "none" || toolChoice === "required") {
|
|
103
|
+
return toolChoice;
|
|
104
|
+
}
|
|
105
|
+
if (typeof toolChoice === "string") {
|
|
106
|
+
return {
|
|
107
|
+
type: "function",
|
|
108
|
+
function: {
|
|
109
|
+
name: toolChoice
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return toolChoice;
|
|
114
|
+
};
|
|
98
115
|
var CodexModel = class {
|
|
99
116
|
codex;
|
|
100
117
|
modelName;
|
|
@@ -186,7 +203,7 @@ var CodexModel = class {
|
|
|
186
203
|
this.registerRequestTools(request.tools);
|
|
187
204
|
}
|
|
188
205
|
const input = await this.convertRequestToInput(request);
|
|
189
|
-
const toolChoice = request.modelSettings?.toolChoice
|
|
206
|
+
const toolChoice = normalizeToolChoice(request.modelSettings?.toolChoice);
|
|
190
207
|
const turn = await thread.run(input, {
|
|
191
208
|
outputSchema: normalizeAgentsOutputType(request.outputType),
|
|
192
209
|
oss: this.options.oss,
|
|
@@ -214,7 +231,7 @@ var CodexModel = class {
|
|
|
214
231
|
this.registerRequestTools(request.tools);
|
|
215
232
|
}
|
|
216
233
|
const input = await this.convertRequestToInput(request);
|
|
217
|
-
const toolChoice = request.modelSettings?.toolChoice
|
|
234
|
+
const toolChoice = normalizeToolChoice(request.modelSettings?.toolChoice);
|
|
218
235
|
const { events } = await thread.runStreamed(input, {
|
|
219
236
|
outputSchema: normalizeAgentsOutputType(request.outputType),
|
|
220
237
|
oss: this.options.oss,
|
|
@@ -762,10 +779,6 @@ ${request.systemInstructions}
|
|
|
762
779
|
type: "output_text_delta",
|
|
763
780
|
delta
|
|
764
781
|
});
|
|
765
|
-
events.push({
|
|
766
|
-
type: "response.output_text.delta",
|
|
767
|
-
delta
|
|
768
|
-
});
|
|
769
782
|
}
|
|
770
783
|
} else if (event.item.type === "reasoning") {
|
|
771
784
|
const itemKey = "reasoning";
|