@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.js CHANGED
@@ -985,7 +985,7 @@ function toOpenAIMessages(messages, options) {
985
985
  (part) => {
986
986
  if (part.type === "text") return { type: "text", text: part.text };
987
987
  if (part.type === "video") {
988
- const videoUrl = part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
988
+ const videoUrl = options?.provider === "moonshot" && part.fileId ? { url: `ms://${part.fileId}`, id: part.fileId } : { url: `data:${part.mediaType};base64,${part.data}` };
989
989
  return {
990
990
  type: "video_url",
991
991
  video_url: videoUrl
@@ -1923,7 +1923,7 @@ async function* runStream2(options) {
1923
1923
  const k3Effort = options.thinking ? toKimiK3Effort(options.thinking) : void 0;
1924
1924
  const isKimiK27 = options.provider === "moonshot" && options.model.startsWith("kimi-k2.7-code");
1925
1925
  const hasFixedKimiSampling = isKimiK3 || isKimiK27;
1926
- const usesThinkingParam = options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
1926
+ const usesThinkingParam = options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" && !isKimiK3 && !isKimiK27 || options.provider === "xiaomi";
1927
1927
  const downgradedImages = downgradeUnsupportedImages(options.messages, options.supportsImages);
1928
1928
  const downgradedMessages = downgradeUnsupportedVideos(downgradedImages, options.supportsVideo);
1929
1929
  if (options.provider === "moonshot") {
@@ -1949,7 +1949,7 @@ async function* runStream2(options) {
1949
1949
  model: options.model,
1950
1950
  messages,
1951
1951
  stream: useStreaming,
1952
- ...options.maxTokens ? { max_completion_tokens: options.maxTokens } : {},
1952
+ ...options.maxTokens ? options.provider === "deepseek" || options.provider === "glm" || options.provider === "moonshot" ? { max_tokens: options.maxTokens } : { max_completion_tokens: options.maxTokens } : {},
1953
1953
  ...effectiveTemp != null && !options.thinking && !hasFixedKimiSampling ? { temperature: effectiveTemp } : {},
1954
1954
  ...options.topP != null && !hasFixedKimiSampling ? { top_p: options.topP } : {},
1955
1955
  ...options.stop ? { stop: options.stop } : {},
@@ -1972,6 +1972,9 @@ async function* runStream2(options) {
1972
1972
  options.thinking
1973
1973
  );
1974
1974
  }
1975
+ if (options.provider === "sakana" && options.model === "fugu-ultra" && (options.thinking === "max" || options.thinking === "ultra")) {
1976
+ params.reasoning_effort = "max";
1977
+ }
1975
1978
  if (options.provider === "openai" && options.serviceTier) {
1976
1979
  params.service_tier = options.serviceTier;
1977
1980
  }
@@ -1988,7 +1991,9 @@ async function* runStream2(options) {
1988
1991
  if (usesThinkingParam) {
1989
1992
  if (options.thinking) {
1990
1993
  params.thinking = { type: "enabled" };
1991
- if (options.provider === "glm") {
1994
+ if (options.provider === "deepseek") {
1995
+ params.reasoning_effort = options.thinking === "low" ? "low" : options.thinking === "medium" || options.thinking === "high" ? "high" : "max";
1996
+ } else if (options.provider === "glm") {
1992
1997
  params.reasoning_effort = toGlmReasoningEffort(
1993
1998
  options.thinking
1994
1999
  );
@@ -2480,8 +2485,10 @@ async function* runStream3(options) {
2480
2485
  body.temperature = options.temperature;
2481
2486
  }
2482
2487
  body.reasoning = {
2488
+ // GPT-5.6/6 require at least low; older models still support thinking off.
2489
+ // Apply the floor here for every caller, including one-off prompt rewrites.
2483
2490
  // `ultra` is a client orchestration preset, not a Codex API effort.
2484
- effort: options.thinking === "ultra" ? "max" : options.thinking ?? "none",
2491
+ effort: options.thinking === "ultra" ? "max" : options.thinking ?? (responsesLite ? "low" : "none"),
2485
2492
  summary: "auto",
2486
2493
  ...responsesLite ? { context: "all_turns" } : {}
2487
2494
  };
@@ -2526,7 +2533,7 @@ async function* runStream3(options) {
2526
2533
  const usageLimit = codexUsageLimitError(parsed.errorObj, response.status, requestId);
2527
2534
  if (usageLimit) throw usageLimit;
2528
2535
  let hint;
2529
- if (response.status === 400 && text.includes("not supported")) {
2536
+ if (response.status === 400 && message === `The '${options.model}' model is not supported when using Codex with a ChatGPT account.`) {
2530
2537
  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.";
2531
2538
  } else if (response.status === 404 && text.includes("does not exist")) {
2532
2539
  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.";
@@ -2969,6 +2976,8 @@ var CODE_ASSIST_SUPPORTED_MODELS = /* @__PURE__ */ new Set([
2969
2976
  "gemini-3-flash",
2970
2977
  "gemini-3.1-flash-lite",
2971
2978
  "gemini-3.7-flash",
2979
+ "gemini-3.8-flash",
2980
+ "gemini-3.5-flash-lite",
2972
2981
  "gemini-2.5-pro",
2973
2982
  "gemini-2.5-flash",
2974
2983
  "gemma-4-31b-it",
@@ -2992,12 +3001,20 @@ var ACCOUNT_GATED_MODELS = /* @__PURE__ */ new Set([
2992
3001
  "gemini-3.5-flash",
2993
3002
  "gemini-3.1-pro-preview",
2994
3003
  "gemini-3.1-pro-preview-customtools",
2995
- "gemini-3.7-flash"
3004
+ "gemini-3.7-flash",
3005
+ "gemini-3.8-flash",
3006
+ "gemini-3.5-flash-lite"
2996
3007
  ]);
2997
3008
  function accountGatedMessage(model) {
3009
+ if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
3010
+ return `${model} is not available through Code Assist for this account. Public Gemini API availability does not guarantee Code Assist OAuth access.`;
3011
+ }
2998
3012
  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.`;
2999
3013
  }
3000
- function accountGatedHint() {
3014
+ function accountGatedHint(model) {
3015
+ if (model === "gemini-3.8-flash" || model === "gemini-3.5-flash-lite") {
3016
+ return "Use /model to select Gemini 3.1 Flash Lite, or retry once Google enables this model through Code Assist for your account.";
3017
+ }
3001
3018
  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.`;
3002
3019
  }
3003
3020
  function formatErrorMessage(status, body, model) {
@@ -3323,7 +3340,7 @@ async function fetchCodeAssist(plan, options) {
3323
3340
  throw new ProviderError("gemini", message, {
3324
3341
  statusCode: response.status,
3325
3342
  ...resetsAt !== void 0 ? { resetsAt } : {},
3326
- ...accountGated ? { hint: accountGatedHint() } : {}
3343
+ ...accountGated ? { hint: accountGatedHint(options.model) } : {}
3327
3344
  });
3328
3345
  }
3329
3346
  return response;