@kenkaiiii/gg-ai 5.55.0 → 5.56.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
@@ -1052,7 +1052,7 @@ function toOpenAIMessages(messages, options) {
1052
1052
  (part) => {
1053
1053
  if (part.type === "text") return { type: "text", text: part.text };
1054
1054
  if (part.type === "video") {
1055
- const videoUrl = part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
1055
+ const videoUrl = options?.provider === "moonshot" && part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
1056
1056
  return {
1057
1057
  type: "video_url",
1058
1058
  video_url: videoUrl
@@ -1990,7 +1990,7 @@ async function* runStream2(options) {
1990
1990
  const k3Effort = options.thinking ? toKimiK3Effort(options.thinking) : void 0;
1991
1991
  const isKimiK27 = options.provider === "moonshot" && options.model.startsWith("kimi-k2.7-code");
1992
1992
  const hasFixedKimiSampling = isKimiK3 || isKimiK27;
1993
- const usesThinkingParam = options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
1993
+ const usesThinkingParam = options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
1994
1994
  const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
1995
1995
  const downgradedMessages = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
1996
1996
  if (options.provider === "moonshot") {
@@ -2016,7 +2016,7 @@ async function* runStream2(options) {
2016
2016
  model: options.model,
2017
2017
  messages,
2018
2018
  stream: useStreaming,
2019
- ...options.maxTokens ? { max_completion_tokens: options.maxTokens } : {},
2019
+ ...options.maxTokens ? options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" ? { max_tokens: options.maxTokens } : { max_completion_tokens: options.maxTokens } : {},
2020
2020
  ...effectiveTemp != null && !options.thinking && !hasFixedKimiSampling ? { temperature: effectiveTemp } : {},
2021
2021
  ...options.topP != null && !hasFixedKimiSampling ? { top_p: options.topP } : {},
2022
2022
  ...options.stop ? { stop: options.stop } : {},
@@ -2039,6 +2039,9 @@ async function* runStream2(options) {
2039
2039
  options.thinking
2040
2040
  );
2041
2041
  }
2042
+ if (options.provider === "sakana" && options.model === "fugu-ultra" && (options.thinking === "max" || options.thinking === "ultra")) {
2043
+ params.reasoning_effort = "max";
2044
+ }
2042
2045
  if (options.provider === "openai" && options.serviceTier) {
2043
2046
  params.service_tier = options.serviceTier;
2044
2047
  }
@@ -2055,7 +2058,9 @@ async function* runStream2(options) {
2055
2058
  if (usesThinkingParam) {
2056
2059
  if (options.thinking) {
2057
2060
  params.thinking = { type: "enabled" };
2058
- if (options.provider === "glm") {
2061
+ if (options.provider === "deepseek") {
2062
+ params.reasoning_effort = options.thinking === "low" ? "low" : options.thinking === "medium" || options.thinking === "high" ? "high" : "max";
2063
+ } else if (options.provider === "glm") {
2059
2064
  params.reasoning_effort = toGlmReasoningEffort(
2060
2065
  options.thinking
2061
2066
  );
@@ -2547,8 +2552,10 @@ async function* runStream3(options) {
2547
2552
  body.temperature = options.temperature;
2548
2553
  }
2549
2554
  body.reasoning = {
2555
+ // GPT-5.6/6 require at least low; older models still support thinking off.
2556
+ // Apply the floor here for every caller, including one-off prompt rewrites.
2550
2557
  // `ultra` is a client orchestration preset, not a Codex API effort.
2551
- effort: options.thinking === "ultra" ? "max" : options.thinking ?? "none",
2558
+ effort: options.thinking === "ultra" ? "max" : options.thinking ?? (responsesLite ? "low" : "none"),
2552
2559
  summary: "auto",
2553
2560
  ...responsesLite ? { context: "all_turns" } : {}
2554
2561
  };
@@ -2593,7 +2600,7 @@ async function* runStream3(options) {
2593
2600
  const usageLimit = codexUsageLimitError(parsed.errorObj, response.status, requestId);
2594
2601
  if (usageLimit) throw usageLimit;
2595
2602
  let hint;
2596
- if (response.status === 400 && text.includes("not supported")) {
2603
+ if (response.status === 400 && message === `The '${options.model}' model is not supported when using Codex with a ChatGPT account.`) {
2597
2604
  hint = "This model is not available through your ChatGPT account. Switch to a model listed for OpenAI via the model selector, or check your ChatGPT usage limits.";
2598
2605
  } else if (response.status === 404 && text.includes("does not exist")) {
2599
2606
  hint = "This model is not in OpenAI's current catalog for your ChatGPT account. Switch to GPT-6 Astra, GPT-5.6 Sol, GPT-5.6 Terra, or GPT-5.6 Luna via the model selector.";
@@ -3036,6 +3043,8 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
3036
3043
  "gemini-3-flash",
3037
3044
  "gemini-3.1-flash-lite",
3038
3045
  "gemini-3.7-flash",
3046
+ "gemini-3.8-flash",
3047
+ "gemini-3.5-flash-lite",
3039
3048
  "gemini-2.5-pro",
3040
3049
  "gemini-2.5-flash",
3041
3050
  "gemma-4-31b-it",
@@ -3059,12 +3068,20 @@ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
3059
3068
  "gemini-3.5-flash",
3060
3069
  "gemini-3.1-pro-preview",
3061
3070
  "gemini-3.1-pro-preview-customtools",
3062
- "gemini-3.7-flash"
3071
+ "gemini-3.7-flash",
3072
+ "gemini-3.8-flash",
3073
+ "gemini-3.5-flash-lite"
3063
3074
  ]);
3064
3075
  function accountGatedMessage(model) {
3076
+ if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
3077
+ return `${model} is not available through Code Assist for this account. Public Gemini API availability does not guarantee Code Assist OAuth access.`;
3078
+ }
3065
3079
  return `Your Google account isn't entitled to "${model}" over Gemini Code Assist OAuth, so the API reports it as not found. This is an account-access limit, not a ggcoder bug.`;
3066
3080
  }
3067
- function accountGatedHint() {
3081
+ function accountGatedHint(model) {
3082
+ if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
3083
+ return "Use /model to select Gemini 3.1 Flash Lite, or retry once Google enables this model through Code Assist for your account.";
3084
+ }
3068
3085
  return `Newer Gemini models (3.7 Flash, 3.5 Flash, 3.1 Pro Preview) are available only to Code Assist Standard/Enterprise accounts with preview/GA access enabled by a cloud admin \u2014 free/personal accounts usually can't call them. Switch to Gemini 3.1 Flash Lite (it works on this account) with /model, or sign in with a Code Assist Standard/Enterprise account that has preview access.`;
3069
3086
  }
3070
3087
  function formatErrorMessage(status, body, model) {
@@ -3390,7 +3407,7 @@ async function fetchCodeAssist(plan, options) {
3390
3407
  throw new ProviderError("gemini", message, {
3391
3408
  statusCode: response.status,
3392
3409
  ...resetsAt !== void 0 ? { resetsAt } : {},
3393
- ...accountGated ? { hint: accountGatedHint() } : {}
3410
+ ...accountGated ? { hint: accountGatedHint(options.model) } : {}
3394
3411
  });
3395
3412
  }
3396
3413
  return response;