@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.cjs CHANGED
@@ -112,6 +112,7 @@ var PROVIDER_DISPLAY = {
112
112
  moonshot: "Moonshot",
113
113
  deepseek: "DeepSeek",
114
114
  openrouter: "OpenRouter",
115
+ sakana: "Sakana",
115
116
  xiaomi: "Xiaomi (MiMo)",
116
117
  minimax: "MiniMax"
117
118
  };
@@ -1020,8 +1021,12 @@ function toOpenAIToolChoice(choice) {
1020
1021
  if (choice === "required") return "required";
1021
1022
  return { type: "function", function: { name: choice.name } };
1022
1023
  }
1023
- function toOpenAIReasoningEffort(level, _model) {
1024
- return level === "max" ? "xhigh" : level;
1024
+ function toOpenAIReasoningEffort(level, model) {
1025
+ const effort = level === "max" ? "xhigh" : level;
1026
+ if (model.startsWith("fugu") && (effort === "low" || effort === "medium")) {
1027
+ return "high";
1028
+ }
1029
+ return effort;
1025
1030
  }
1026
1031
  function normalizeAnthropicStopReason(reason) {
1027
1032
  switch (reason) {
@@ -1140,7 +1145,13 @@ async function prewarmAnthropicCache(options) {
1140
1145
  },
1141
1146
  {
1142
1147
  signal: options.signal ?? void 0,
1143
- ...isOAuth ? { headers: { "anthropic-beta": "claude-code-20250219,oauth-2025-04-20" } } : {}
1148
+ ...(() => {
1149
+ const betas = [
1150
+ ...isOAuth ? ["claude-code-20250219", "oauth-2025-04-20"] : [],
1151
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1152
+ ];
1153
+ return betas.length ? { headers: { "anthropic-beta": betas.join(",") } } : {};
1154
+ })()
1144
1155
  }
1145
1156
  );
1146
1157
  } catch {
@@ -1224,7 +1235,12 @@ async function* runStream(options) {
1224
1235
  ...options.compaction ? ["compact-2026-01-12"] : [],
1225
1236
  ...options.clearToolUses ? ["context-management-2025-06-27"] : [],
1226
1237
  "fine-grained-tool-streaming-2025-05-14",
1227
- ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : []
1238
+ ...!hasAdaptiveThinking ? ["interleaved-thinking-2025-05-14"] : [],
1239
+ // The 1-h cache TTL (cacheRetention "long") is gated behind this beta. Without
1240
+ // it Anthropic silently ignores ttl:"1h" and falls back to the 5-min default,
1241
+ // so a pre-warmed cache expires before the user's first turn. cacheControl.ttl
1242
+ // is only "1h" on the first-party endpoint (see toAnthropicCacheControl).
1243
+ ...cacheControl?.ttl === "1h" ? ["extended-cache-ttl-2025-04-11"] : []
1228
1244
  ];
1229
1245
  const requestOptions = {
1230
1246
  signal: options.signal ?? void 0,
@@ -3179,6 +3195,16 @@ providerRegistry.register("openrouter", {
3179
3195
  baseUrl: options.baseUrl ?? "https://openrouter.ai/api/v1"
3180
3196
  })
3181
3197
  });
3198
+ providerRegistry.register("sakana", {
3199
+ // Sakana Fugu is a multi-agent system exposed as a standard LLM through the
3200
+ // OpenAI-compatible Sakana API. We ride the Chat Completions transport (the
3201
+ // Responses API is also offered). Fugu models only accept "high"/"xhigh"
3202
+ // reasoning effort — clamped centrally in toOpenAIReasoningEffort.
3203
+ stream: (options) => streamOpenAI({
3204
+ ...options,
3205
+ baseUrl: options.baseUrl ?? "https://api.sakana.ai/v1"
3206
+ })
3207
+ });
3182
3208
  providerRegistry.register("minimax", {
3183
3209
  stream: (options) => streamAnthropic({
3184
3210
  ...options,