@kenkaiiii/gg-ai 5.70.0 → 5.72.0
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/index.cjs +30 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +28 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,8 @@ __export(index_exports, {
|
|
|
65
65
|
toAnthropicMessages: () => toAnthropicMessages,
|
|
66
66
|
toOpenAIMessages: () => toOpenAIMessages,
|
|
67
67
|
toWellFormedText: () => toWellFormedText,
|
|
68
|
-
toolCallNameRuleFor: () => toolCallNameRuleFor
|
|
68
|
+
toolCallNameRuleFor: () => toolCallNameRuleFor,
|
|
69
|
+
usesResponsesLite: () => usesResponsesLite
|
|
69
70
|
});
|
|
70
71
|
module.exports = __toCommonJS(index_exports);
|
|
71
72
|
|
|
@@ -2423,7 +2424,7 @@ async function* runStream2(options) {
|
|
|
2423
2424
|
...options.thinking && !usesThinkingParam && !isKimiK3 && !isKimiK27 && !isLocal ? { reasoning_effort: toOpenAIReasoningEffort(options.thinking, options.model) } : {},
|
|
2424
2425
|
...options.tools?.length ? {
|
|
2425
2426
|
tools: toOpenAITools(options.tools, {
|
|
2426
|
-
strict: supportsStrictToolSampling(options.provider)
|
|
2427
|
+
strict: supportsStrictToolSampling(options.provider) && (options.strictTools ?? true)
|
|
2427
2428
|
})
|
|
2428
2429
|
} : {},
|
|
2429
2430
|
...options.toolChoice && options.tools?.length ? { tool_choice: toOpenAIToolChoice(options.toolChoice) } : {},
|
|
@@ -2938,6 +2939,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
2938
2939
|
const downgraded = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
|
|
2939
2940
|
const { system, input } = toCodexInput(downgraded, { supportsImages: options.supportsImages });
|
|
2940
2941
|
const responsesLite = usesResponsesLite(options.model);
|
|
2942
|
+
const liteShape = options.responsesLite ?? responsesLite;
|
|
2941
2943
|
const body = {
|
|
2942
2944
|
model: options.model,
|
|
2943
2945
|
store: false,
|
|
@@ -2945,11 +2947,11 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
2945
2947
|
instructions: system,
|
|
2946
2948
|
input,
|
|
2947
2949
|
tool_choice: toCodexToolChoice(options.toolChoice, options.tools),
|
|
2948
|
-
parallel_tool_calls: !
|
|
2950
|
+
parallel_tool_calls: !liteShape,
|
|
2949
2951
|
include: ["reasoning.encrypted_content"]
|
|
2950
2952
|
};
|
|
2951
2953
|
if (options.tools?.length) {
|
|
2952
|
-
body.tools = toCodexTools(options.tools);
|
|
2954
|
+
body.tools = toCodexTools(options.tools, options.strictTools ?? true);
|
|
2953
2955
|
}
|
|
2954
2956
|
body.prompt_cache_key = normalizePromptCacheKey(options.promptCacheKey ?? "ggcoder");
|
|
2955
2957
|
if (options.temperature != null && !options.thinking) {
|
|
@@ -2961,7 +2963,7 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
2961
2963
|
// `ultra` is a client orchestration preset, not a Codex API effort.
|
|
2962
2964
|
effort: options.thinking === "ultra" ? "max" : options.thinking ?? (responsesLite ? "low" : "none"),
|
|
2963
2965
|
summary: "auto",
|
|
2964
|
-
...
|
|
2966
|
+
...liteShape ? { context: "all_turns" } : {}
|
|
2965
2967
|
};
|
|
2966
2968
|
if (responsesLite) {
|
|
2967
2969
|
body.text = { verbosity: "low" };
|
|
@@ -2973,10 +2975,8 @@ async function* runStream3(options, retriedWithoutReasoning = false) {
|
|
|
2973
2975
|
"OpenAI-Beta": "responses=experimental",
|
|
2974
2976
|
originator: responsesLite ? "codex_cli_rs" : "ggcoder",
|
|
2975
2977
|
"User-Agent": responsesLite ? `codex_cli_rs/${CODEX_CLIENT_VERSION}` : `ggcoder (${import_node_os.default.platform()} ${import_node_os.default.release()}; ${import_node_os.default.arch()})`,
|
|
2976
|
-
...responsesLite ? {
|
|
2977
|
-
|
|
2978
|
-
"X-OpenAI-Internal-Codex-Responses-Lite": "true"
|
|
2979
|
-
} : {}
|
|
2978
|
+
...responsesLite ? { version: CODEX_CLIENT_VERSION } : {},
|
|
2979
|
+
...liteShape ? { "X-OpenAI-Internal-Codex-Responses-Lite": "true" } : {}
|
|
2980
2980
|
};
|
|
2981
2981
|
if (options.accountId) {
|
|
2982
2982
|
headers["chatgpt-account-id"] = options.accountId;
|
|
@@ -3440,15 +3440,17 @@ function toCodexInput(messages, options) {
|
|
|
3440
3440
|
}
|
|
3441
3441
|
return { system, input };
|
|
3442
3442
|
}
|
|
3443
|
-
function toCodexTools(tools) {
|
|
3443
|
+
function toCodexTools(tools, strictTools) {
|
|
3444
3444
|
return tools.map((tool) => {
|
|
3445
3445
|
let parameters = resolveToolSchema(tool);
|
|
3446
3446
|
let strict = null;
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3447
|
+
if (strictTools) {
|
|
3448
|
+
try {
|
|
3449
|
+
parameters = makeStrictToolSchema(parameters);
|
|
3450
|
+
strict = true;
|
|
3451
|
+
} catch (error) {
|
|
3452
|
+
if (!(error instanceof UnsupportedStrictSchemaError)) throw error;
|
|
3453
|
+
}
|
|
3452
3454
|
}
|
|
3453
3455
|
return {
|
|
3454
3456
|
type: "function",
|
|
@@ -3685,6 +3687,17 @@ function stripUnsupportedSchemaFields(value) {
|
|
|
3685
3687
|
}
|
|
3686
3688
|
delete value.$schema;
|
|
3687
3689
|
delete value.additionalProperties;
|
|
3690
|
+
for (const [key, target, step] of [
|
|
3691
|
+
["exclusiveMinimum", "minimum", 1],
|
|
3692
|
+
["exclusiveMaximum", "maximum", -1]
|
|
3693
|
+
]) {
|
|
3694
|
+
const bound = value[key];
|
|
3695
|
+
if (bound === void 0) continue;
|
|
3696
|
+
delete value[key];
|
|
3697
|
+
if (typeof bound === "number" && value[target] === void 0) {
|
|
3698
|
+
value[target] = value.type === "integer" ? bound + step : bound;
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3688
3701
|
for (const item of Object.values(value)) {
|
|
3689
3702
|
if (isJsonObject(item) || Array.isArray(item)) {
|
|
3690
3703
|
stripUnsupportedSchemaFields(item);
|
|
@@ -4823,6 +4836,7 @@ function registerPalsuProvider(config) {
|
|
|
4823
4836
|
toAnthropicMessages,
|
|
4824
4837
|
toOpenAIMessages,
|
|
4825
4838
|
toWellFormedText,
|
|
4826
|
-
toolCallNameRuleFor
|
|
4839
|
+
toolCallNameRuleFor,
|
|
4840
|
+
usesResponsesLite
|
|
4827
4841
|
});
|
|
4828
4842
|
//# sourceMappingURL=index.cjs.map
|