@kenkaiiii/gg-ai 4.3.222 → 4.3.224

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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
4
- type ThinkingLevel = "low" | "medium" | "high" | "xhigh";
4
+ type ThinkingLevel = "low" | "medium" | "high" | "xhigh" | "max";
5
5
  type CacheRetention = "none" | "short" | "long";
6
6
  interface TextContent {
7
7
  type: "text";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
4
- type ThinkingLevel = "low" | "medium" | "high" | "xhigh";
4
+ type ThinkingLevel = "low" | "medium" | "high" | "xhigh" | "max";
5
5
  type CacheRetention = "none" | "short" | "long";
6
6
  interface TextContent {
7
7
  type: "text";
package/dist/index.js CHANGED
@@ -539,12 +539,12 @@ function toAnthropicToolChoice(choice) {
539
539
  return { type: "tool", name: choice.name };
540
540
  }
541
541
  function supportsAdaptiveThinking(model) {
542
- return /opus-4-7|opus-4-6|sonnet-4-6/.test(model);
542
+ return /opus-4-8|opus-4-7|opus-4-6|sonnet-4-6/.test(model);
543
543
  }
544
544
  function toAnthropicThinking(level, maxTokens, model) {
545
545
  if (supportsAdaptiveThinking(model)) {
546
- let effort = level === "xhigh" ? "max" : level;
547
- if (effort === "max" && !model.includes("opus")) {
546
+ let effort = level;
547
+ if (effort === "xhigh" && !/opus-4-8|opus-4-7/.test(model)) {
548
548
  effort = "high";
549
549
  }
550
550
  return {
@@ -553,7 +553,7 @@ function toAnthropicThinking(level, maxTokens, model) {
553
553
  outputConfig: { effort }
554
554
  };
555
555
  }
556
- const effectiveLevel = level === "xhigh" ? "high" : level;
556
+ const effectiveLevel = level === "xhigh" || level === "max" ? "high" : level;
557
557
  const budgetMap = {
558
558
  low: Math.max(1024, Math.floor(maxTokens * 0.25)),
559
559
  medium: Math.max(2048, Math.floor(maxTokens * 0.5)),
@@ -687,7 +687,7 @@ function toOpenAIToolChoice(choice) {
687
687
  return { type: "function", function: { name: choice.name } };
688
688
  }
689
689
  function toOpenAIReasoningEffort(level, _model) {
690
- return level;
690
+ return level === "max" ? "xhigh" : level;
691
691
  }
692
692
  function normalizeAnthropicStopReason(reason) {
693
693
  switch (reason) {
@@ -814,7 +814,7 @@ async function* runStream(options) {
814
814
  })(),
815
815
  stream: useStreaming
816
816
  };
817
- const hasAdaptiveThinking = options.model.includes("opus-4-7") || options.model.includes("opus-4.7") || options.model.includes("opus-4-6") || options.model.includes("opus-4.6") || options.model.includes("sonnet-4-6") || options.model.includes("sonnet-4.6");
817
+ const hasAdaptiveThinking = options.model.includes("opus-4-8") || options.model.includes("opus-4.8") || options.model.includes("opus-4-7") || options.model.includes("opus-4.7") || options.model.includes("opus-4-6") || options.model.includes("opus-4.6") || options.model.includes("sonnet-4-6") || options.model.includes("sonnet-4.6");
818
818
  const betaHeaders = [
819
819
  ...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
820
820
  ...options.compaction ? ["compact-2026-01-12"] : [],
@@ -2122,6 +2122,7 @@ function toGemini3ThinkingLevel(level) {
2122
2122
  return "MEDIUM";
2123
2123
  case "high":
2124
2124
  case "xhigh":
2125
+ case "max":
2125
2126
  return "HIGH";
2126
2127
  }
2127
2128
  }
@@ -2133,6 +2134,7 @@ function toThinkingBudget(level) {
2133
2134
  return 8192;
2134
2135
  case "high":
2135
2136
  case "xhigh":
2137
+ case "max":
2136
2138
  return 8192;
2137
2139
  }
2138
2140
  }