@kenkaiiii/gg-ai 4.13.3 → 4.14.1

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
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
3
  import OpenAI from 'openai';
4
4
 
5
- type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
5
+ type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "sakana" | "palsu";
6
6
  type ThinkingLevel = "low" | "medium" | "high" | "xhigh" | "max";
7
7
  type CacheRetention = "none" | "short" | "long";
8
8
  interface TextContent {
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import Anthropic from '@anthropic-ai/sdk';
3
3
  import OpenAI from 'openai';
4
4
 
5
- type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "palsu";
5
+ type Provider = "anthropic" | "xiaomi" | "openai" | "gemini" | "glm" | "moonshot" | "minimax" | "deepseek" | "openrouter" | "sakana" | "palsu";
6
6
  type ThinkingLevel = "low" | "medium" | "high" | "xhigh" | "max";
7
7
  type CacheRetention = "none" | "short" | "long";
8
8
  interface TextContent {
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ var PROVIDER_DISPLAY = {
57
57
  moonshot: "Moonshot",
58
58
  deepseek: "DeepSeek",
59
59
  openrouter: "OpenRouter",
60
+ sakana: "Sakana",
60
61
  xiaomi: "Xiaomi (MiMo)",
61
62
  minimax: "MiniMax"
62
63
  };
@@ -965,8 +966,12 @@ function toOpenAIToolChoice(choice) {
965
966
  if (choice === "required") return "required";
966
967
  return { type: "function", function: { name: choice.name } };
967
968
  }
968
- function toOpenAIReasoningEffort(level, _model) {
969
- return level === "max" ? "xhigh" : level;
969
+ function toOpenAIReasoningEffort(level, model) {
970
+ const effort = level === "max" ? "xhigh" : level;
971
+ if (model.startsWith("fugu") && (effort === "low" || effort === "medium")) {
972
+ return "high";
973
+ }
974
+ return effort;
970
975
  }
971
976
  function normalizeAnthropicStopReason(reason) {
972
977
  switch (reason) {
@@ -1085,7 +1090,13 @@ async function prewarmAnthropicCache(options) {
1085
1090
  },
1086
1091
  {
1087
1092
  signal: options.signal ?? void 0,
1088
- ...isOAuth ? { headers: { "anthropic-beta": "claude-code-20250219,oauth-2025-04-20" } } : {}
1093
+ ...(() => {
1094
+ const betas = [
1095
+ ...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
1096
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1097
+ ];
1098
+ return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
1099
+ })()
1089
1100
  }
1090
1101
  );
1091
1102
  } catch {
@@ -1169,7 +1180,12 @@ async function* runStream(options) {
1169
1180
  ...options.compaction ? ["compact-2026-01-12"] : [],
1170
1181
  ...options.clearToolUses ? ["context-management-2025-06-27"] : [],
1171
1182
  "fine-grained-tool-streaming-2025-05-14",
1172
- ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : []
1183
+ ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : [],
1184
+ // The 1-h cache TTL (cacheRetention "long") is gated behind this beta. Without
1185
+ // it Anthropic silently ignores ttl:"1h" and falls back to the 5-min default,
1186
+ // so a pre-warmed cache expires before the user's first turn. cacheControl.ttl
1187
+ // is only "1h" on the first-party endpoint (see toAnthropicCacheControl).
1188
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1173
1189
  ];
1174
1190
  const requestOptions = {
1175
1191
  signal: options.signal ?? void 0,
@@ -3124,6 +3140,16 @@ providerRegistry.register("openrouter", {
3124
3140
  baseUrl: options.baseUrl ?? "https://openrouter.ai/api/v1"
3125
3141
  })
3126
3142
  });
3143
+ providerRegistry.register("sakana", {
3144
+ // Sakana Fugu is a multi-agent system exposed as a standard LLM through the
3145
+ // OpenAI-compatible Sakana API. We ride the Chat Completions transport (the
3146
+ // Responses API is also offered). Fugu models only accept "high"/"xhigh"
3147
+ // reasoning effort — clamped centrally in toOpenAIReasoningEffort.
3148
+ stream: (options) => streamOpenAI({
3149
+ ...options,
3150
+ baseUrl: options.baseUrl ?? "https://api.sakana.ai/v1"
3151
+ })
3152
+ });
3127
3153
  providerRegistry.register("minimax", {
3128
3154
  stream: (options) => streamAnthropic({
3129
3155
  ...options,