@kenkaiiii/gg-ai 5.10.0 → 5.11.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 CHANGED
@@ -873,7 +873,7 @@ function toAnthropicThinking(level, maxTokens, model) {
873
873
  };
874
874
  }
875
875
  const VISIBLE_FLOOR = 1024;
876
- const effectiveLevel = level === "xhigh" || level === "max" ? "high" : level;
876
+ const effectiveLevel = level === "xhigh" || level === "max" || level === "ultra" ? "high" : level;
877
877
  const budgetMap = {
878
878
  low: Math.max(1024, Math.floor(maxTokens * 0.2)),
879
879
  medium: Math.max(2048, Math.floor(maxTokens * 0.45)),
@@ -1041,7 +1041,7 @@ function toOpenAIToolChoice(choice) {
1041
1041
  return { type: "function", function: { name: choice.name } };
1042
1042
  }
1043
1043
  function toOpenAIReasoningEffort(level, model) {
1044
- const effort = level === "max" ? "xhigh" : level;
1044
+ const effort = level === "max" || level === "ultra" ? "xhigh" : level;
1045
1045
  if (model.startsWith("fugu") && (effort === "low" || effort === "medium")) {
1046
1046
  return "high";
1047
1047
  }
@@ -2189,6 +2189,10 @@ function extractRequestIdFromMessage(message) {
2189
2189
 
2190
2190
  // src/providers/openai-codex.ts
2191
2191
  var DEFAULT_BASE_URL = "https://chatgpt.com/backend-api";
2192
+ var CODEX_CLIENT_VERSION = "0.144.1";
2193
+ function usesResponsesLite(model) {
2194
+ return model.startsWith("gpt-5.6-");
2195
+ }
2192
2196
  function outputTextKey(itemId, contentIndex) {
2193
2197
  return `${itemId ?? ""}:${contentIndex ?? 0}`;
2194
2198
  }
@@ -2204,6 +2208,7 @@ async function* runStream3(options) {
2204
2208
  const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
2205
2209
  const downgraded = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
2206
2210
  const { system, input } = toCodexInput(downgraded, { supportsImages: options.supportsImages });
2211
+ const responsesLite = usesResponsesLite(options.model);
2207
2212
  const body = {
2208
2213
  model: options.model,
2209
2214
  store: false,
@@ -2211,7 +2216,7 @@ async function* runStream3(options) {
2211
2216
  instructions: system,
2212
2217
  input,
2213
2218
  tool_choice: "auto",
2214
- parallel_tool_calls: true,
2219
+ parallel_tool_calls: !responsesLite,
2215
2220
  include: ["reasoning.encrypted_content"]
2216
2221
  };
2217
2222
  if (options.tools?.length) {
@@ -2222,16 +2227,22 @@ async function* runStream3(options) {
2222
2227
  body.temperature = options.temperature;
2223
2228
  }
2224
2229
  body.reasoning = {
2225
- effort: options.thinking ?? "none",
2226
- summary: "auto"
2230
+ // `ultra` is a client orchestration preset, not a Codex API effort.
2231
+ effort: options.thinking === "ultra" ? "max" : options.thinking ?? "none",
2232
+ summary: "auto",
2233
+ ...responsesLite ? { context: "all_turns" } : {}
2227
2234
  };
2228
2235
  const headers = {
2229
2236
  "Content-Type": "application/json",
2230
2237
  Accept: "text/event-stream",
2231
2238
  Authorization: `Bearer ${options.apiKey}`,
2232
2239
  "OpenAI-Beta": "responses=experimental",
2233
- originator: "ggcoder",
2234
- "User-Agent": `ggcoder (${import_node_os.default.platform()} ${import_node_os.default.release()}; ${import_node_os.default.arch()})`
2240
+ originator: responsesLite ? "codex_cli_rs" : "ggcoder",
2241
+ "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()})`,
2242
+ ...responsesLite ? {
2243
+ version: CODEX_CLIENT_VERSION,
2244
+ "X-OpenAI-Internal-Codex-Responses-Lite": "true"
2245
+ } : {}
2235
2246
  };
2236
2247
  if (options.accountId) {
2237
2248
  headers["chatgpt-account-id"] = options.accountId;
@@ -2870,6 +2881,7 @@ function toGemini3ThinkingLevel(level) {
2870
2881
  case "high":
2871
2882
  case "xhigh":
2872
2883
  case "max":
2884
+ case "ultra":
2873
2885
  return "HIGH";
2874
2886
  }
2875
2887
  }
@@ -2882,6 +2894,7 @@ function toThinkingBudget(level) {
2882
2894
  case "high":
2883
2895
  case "xhigh":
2884
2896
  case "max":
2897
+ case "ultra":
2885
2898
  return 8192;
2886
2899
  }
2887
2900
  }