@kenkaiiii/gg-core 5.55.1 → 5.56.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
@@ -2186,8 +2186,8 @@ var MODELS = [
2186
2186
  // ── Sakana (Fugu) ──────────────────────────────────────
2187
2187
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
2188
2188
  // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). Both models take
2189
- // text + image input and only accept "high"/"xhigh" reasoning effort, so the
2190
- // top tier is `xhigh`. `fugu` routes across all providers; `fugu-ultra` is
2189
+ // text + image input. Plain Fugu stops at xhigh; Ultra v1.1 also supports max.
2190
+ // `fugu` routes across all providers; `fugu-ultra` is
2191
2191
  // the heavier tier (may need larger client timeouts on complex tasks).
2192
2192
  {
2193
2193
  id: "fugu",
@@ -2211,7 +2211,8 @@ var MODELS = [
2211
2211
  supportsImages: true,
2212
2212
  supportsVideo: false,
2213
2213
  costTier: "high",
2214
- maxThinkingLevel: "xhigh"
2214
+ // The rolling alias now serves v1.1, which adds a distinct max effort.
2215
+ maxThinkingLevel: "max"
2215
2216
  },
2216
2217
  // ── xAI (Grok) ─────────────────────────────────────────
2217
2218
  // Grok 4.6 (released 2026-08-12) is xAI's flagship for coding, agentic tasks,
@@ -2265,6 +2266,34 @@ var MODELS = [
2265
2266
  costTier: "low",
2266
2267
  maxThinkingLevel: "high"
2267
2268
  },
2269
+ // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
2270
+ // New GA models are opt-in; Code Assist access varies by account.
2271
+ {
2272
+ id: "gemini-3.8-flash",
2273
+ name: "Gemini 3.8 Flash",
2274
+ provider: "gemini",
2275
+ contextWindow: 1048576,
2276
+ maxOutputTokens: 65536,
2277
+ supportsThinking: true,
2278
+ supportsImages: true,
2279
+ supportsVideo: true,
2280
+ maxVideoBytes: 20 * 1024 * 1024,
2281
+ costTier: "low",
2282
+ maxThinkingLevel: "high"
2283
+ },
2284
+ {
2285
+ id: "gemini-3.5-flash-lite",
2286
+ name: "Gemini 3.5 Flash Lite",
2287
+ provider: "gemini",
2288
+ contextWindow: 1048576,
2289
+ maxOutputTokens: 65536,
2290
+ supportsThinking: true,
2291
+ supportsImages: true,
2292
+ supportsVideo: true,
2293
+ maxVideoBytes: 20 * 1024 * 1024,
2294
+ costTier: "low",
2295
+ maxThinkingLevel: "high"
2296
+ },
2268
2297
  {
2269
2298
  // Gemini 3.7 Flash (released 2026-08-13) — Google's most capable Flash for
2270
2299
  // coding, agents, and multi-step execution; GA-stable on the Gemini API as
@@ -2272,7 +2301,7 @@ var MODELS = [
2272
2301
  // Sent over our Code Assist (OAuth) transport ahead of gemini-cli — upstream
2273
2302
  // hasn't listed 3.7 yet (google-gemini/gemini-cli#28802, still open) — so
2274
2303
  // free/personal accounts 404 (entitlement-gated) while Code Assist
2275
- // Standard/Enterprise accounts get it. Listed SECOND, after flash-lite:
2304
+ // Standard/Enterprise accounts get it. Kept after the working flash-lite:
2276
2305
  // getFastModel picks the first low-tier entry, and flash-lite is the one
2277
2306
  // that works on every account.
2278
2307
  id: "gemini-3.7-flash",
@@ -2464,21 +2493,19 @@ var MODELS = [
2464
2493
  {
2465
2494
  // `deepseek-v4-pro` now serves DeepSeek-V4-Pro-0813 (released 2026-08-13,
2466
2495
  // first STABLE V4 Pro — supersedes the April preview; calling name
2467
- // unchanged, same 1.6T/49B MoE). 1M context, 384K (393,216) max output,
2468
- // text-only, reasoning ladder low/high plus Think Max mapped from our
2469
- // `xhigh`. ~$0.43/$0.87 per MTok on DeepSeek's own API, so a mid-tier
2470
- // price band rather than the preview's top band.
2496
+ // unchanged, same 1.6T/49B MoE). 1M context, text-only, low/high/max effort.
2497
+ // Docs abbreviate output as 384K; use the same conservative 384,000-token
2498
+ // application cap across V4 models rather than mixing decimal/binary units.
2471
2499
  id: "deepseek-v4-pro",
2472
2500
  name: "DeepSeek V4 Pro",
2473
2501
  provider: "deepseek",
2474
2502
  contextWindow: 1048576,
2475
- maxOutputTokens: 393216,
2503
+ maxOutputTokens: 384e3,
2476
2504
  supportsThinking: true,
2477
2505
  supportsImages: false,
2478
2506
  supportsVideo: false,
2479
2507
  costTier: "medium",
2480
- // DeepSeek V4 maps `xhigh` → its internal `max` tier.
2481
- maxThinkingLevel: "xhigh"
2508
+ maxThinkingLevel: "max"
2482
2509
  },
2483
2510
  {
2484
2511
  id: "deepseek-v4-flash",
@@ -2490,7 +2517,20 @@ var MODELS = [
2490
2517
  supportsImages: false,
2491
2518
  supportsVideo: false,
2492
2519
  costTier: "low",
2493
- maxThinkingLevel: "xhigh"
2520
+ maxThinkingLevel: "max"
2521
+ },
2522
+ // Opt-in experimental vision sibling; never replaces the stable summary model.
2523
+ {
2524
+ id: "deepseek-v4-flash-vision-exp",
2525
+ name: "DeepSeek V4 Flash Vision (Experimental)",
2526
+ provider: "deepseek",
2527
+ contextWindow: 1048576,
2528
+ maxOutputTokens: 384e3,
2529
+ supportsThinking: true,
2530
+ supportsImages: true,
2531
+ supportsVideo: false,
2532
+ costTier: "low",
2533
+ maxThinkingLevel: "max"
2494
2534
  },
2495
2535
  // ── OpenRouter ─────────────────────────────────────────
2496
2536
  {
@@ -2500,8 +2540,10 @@ var MODELS = [
2500
2540
  contextWindow: 1e6,
2501
2541
  maxOutputTokens: 65536,
2502
2542
  supportsThinking: true,
2503
- supportsImages: false,
2504
- supportsVideo: false,
2543
+ supportsImages: true,
2544
+ supportsVideo: true,
2545
+ // Practical inline-payload cap, not an asserted provider maximum.
2546
+ maxVideoBytes: 20 * 1024 * 1024,
2505
2547
  costTier: "medium",
2506
2548
  maxThinkingLevel: "high"
2507
2549
  },
@@ -2657,7 +2699,8 @@ var OPENAI_GPT_56_THINKING_LEVELS = [
2657
2699
  "max",
2658
2700
  "ultra"
2659
2701
  ];
2660
- var SAKANA_THINKING_LEVELS = ["high", "xhigh"];
2702
+ var SAKANA_THINKING_LEVELS = ["high", "xhigh", "max"];
2703
+ var DEEPSEEK_THINKING_LEVELS = ["low", "high", "max"];
2661
2704
  var XAI_THINKING_LEVELS = ["low", "medium", "high", "xhigh"];
2662
2705
  var ANTHROPIC_XHIGH_THINKING_LEVELS = [
2663
2706
  "low",
@@ -2721,6 +2764,7 @@ function getSupportedThinkingLevels(provider, model) {
2721
2764
  return XAI_THINKING_LEVELS.slice(0, maxIndex2 + 1);
2722
2765
  }
2723
2766
  if (isMoonshotK3Model(provider, model)) return MOONSHOT_K3_THINKING_LEVELS;
2767
+ if (provider === "deepseek") return DEEPSEEK_THINKING_LEVELS;
2724
2768
  if (isGlmModel(provider)) {
2725
2769
  const maxIndex2 = GLM_THINKING_LEVELS.indexOf(maxLevel);
2726
2770
  if (maxIndex2 === -1) return GLM_THINKING_LEVELS;
@@ -2737,7 +2781,7 @@ function isThinkingLevelSupported(provider, model, level) {
2737
2781
  }
2738
2782
  function getNextThinkingLevel(provider, model, current) {
2739
2783
  const supportedLevels = getSupportedThinkingLevels(provider, model);
2740
- const shouldCycleLevels = isOpenAIGptModel(provider, model) || isAnthropicAdaptiveModel(provider, model) || isSakanaModel(provider) || isXaiModel(provider) || isMoonshotK3Model(provider, model) || isGlmModel(provider) || // Local servers take a real effort level, not just on/off: Ollama accepts
2784
+ const shouldCycleLevels = isOpenAIGptModel(provider, model) || isAnthropicAdaptiveModel(provider, model) || isSakanaModel(provider) || isXaiModel(provider) || isMoonshotK3Model(provider, model) || isGlmModel(provider) || provider === "deepseek" || // Local servers take a real effort level, not just on/off: Ollama accepts
2741
2785
  // low/medium/high on `reasoning_effort` (verified against 0.32) and the
2742
2786
  // other OpenAI-compatible servers use the same three. A model that can't
2743
2787
  // reason at all already has no supported levels, so it never gets here.
@@ -2755,7 +2799,7 @@ function getNextThinkingLevel(provider, model, current) {
2755
2799
  var DEFAULT_LOCAL_ENDPOINTS = [
2756
2800
  { id: "ollama", label: "Ollama", baseUrl: "http://127.0.0.1:11434/v1", kind: "ollama" }
2757
2801
  ];
2758
- var FALLBACK_CONTEXT_WINDOW = 8192;
2802
+ var FALLBACK_CONTEXT_WINDOW = 4096;
2759
2803
  var LOCAL_API_KEY_PLACEHOLDER = "local";
2760
2804
  var DEFAULT_PROBE_TIMEOUT_MS = 1200;
2761
2805
  var ENRICH_CONCURRENCY = 6;
@@ -2848,7 +2892,7 @@ async function enrich(endpoint, entries, options) {
2848
2892
  return entries.map((entry) => genericModel(endpoint, entry));
2849
2893
  }
2850
2894
  function genericModel(endpoint, entry) {
2851
- const declared = typeof entry.max_model_len === "number" ? entry.max_model_len : void 0;
2895
+ const declared = contextLength(entry.max_model_len);
2852
2896
  return {
2853
2897
  rawId: entry.id,
2854
2898
  endpointId: endpoint.id,
@@ -2861,16 +2905,23 @@ function genericModel(endpoint, entry) {
2861
2905
  }
2862
2906
  async function enrichOllama(endpoint, entries, options) {
2863
2907
  const showUrl = `${endpointRoot(endpoint.baseUrl)}/api/show`;
2908
+ const running = await fetchJson(
2909
+ `${endpointRoot(endpoint.baseUrl)}/api/ps`,
2910
+ endpoint,
2911
+ options
2912
+ );
2913
+ const runningModels = Array.isArray(running?.models) ? running.models : [];
2864
2914
  const enriched = await mapLimited(entries, ENRICH_CONCURRENCY, async (entry) => {
2865
2915
  const show = await fetchJson(showUrl, endpoint, {
2866
2916
  ...options,
2867
2917
  method: "POST",
2868
2918
  body: { model: entry.id }
2869
2919
  });
2870
- if (!show) return genericModel(endpoint, entry);
2871
- const caps = show.capabilities ?? [];
2920
+ const caps = Array.isArray(show?.capabilities) ? show.capabilities : [];
2872
2921
  if (caps.includes("embedding") && !caps.includes("completion")) return void 0;
2873
- const ctx = ollamaContextLength(show.model_info);
2922
+ const ctx = contextLength(
2923
+ runningModels.find((model) => model?.name === entry.id || model?.model === entry.id)?.context_length
2924
+ );
2874
2925
  return {
2875
2926
  rawId: entry.id,
2876
2927
  endpointId: endpoint.id,
@@ -2878,38 +2929,61 @@ async function enrichOllama(endpoint, entries, options) {
2878
2929
  contextWindowKnown: ctx !== void 0,
2879
2930
  // Ollama reports capabilities honestly, so trust it here rather than
2880
2931
  // using the optimistic generic default.
2881
- supportsTools: caps.includes("tools"),
2932
+ supportsTools: show ? caps.includes("tools") : true,
2882
2933
  supportsImages: caps.includes("vision"),
2883
2934
  supportsThinking: caps.includes("thinking")
2884
2935
  };
2885
2936
  });
2886
2937
  return enriched.filter((model) => model !== void 0);
2887
2938
  }
2888
- function ollamaContextLength(info) {
2889
- if (!info) return void 0;
2890
- for (const [key, value] of Object.entries(info)) {
2891
- if (key.endsWith(".context_length") && typeof value === "number" && value > 0) return value;
2892
- }
2893
- return void 0;
2939
+ function contextLength(value) {
2940
+ return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
2894
2941
  }
2895
2942
  async function enrichLmStudio(endpoint, entries, options) {
2896
- const detail = await fetchJson(
2897
- `${endpointRoot(endpoint.baseUrl)}/api/v0/models`,
2898
- endpoint,
2899
- options
2900
- );
2901
- if (!detail?.data) return entries.map((entry) => genericModel(endpoint, entry));
2902
- const byId = new Map(detail.data.filter((m) => m.id).map((m) => [m.id, m]));
2943
+ const root = endpointRoot(endpoint.baseUrl);
2944
+ const detail = await fetchJson(`${root}/api/v1/models`, endpoint, options);
2945
+ const byId = /* @__PURE__ */ new Map();
2946
+ if (Array.isArray(detail?.models)) {
2947
+ for (const model of detail.models) {
2948
+ if (typeof model?.key !== "string") continue;
2949
+ const instances = Array.isArray(model.loaded_instances) ? model.loaded_instances : [];
2950
+ const contexts = instances.map((instance) => contextLength(instance?.config?.context_length));
2951
+ const ctx = contexts.length && contexts.every((value) => value !== void 0) ? contexts.reduce((min, value) => Math.min(min, value)) : void 0;
2952
+ const info = {
2953
+ id: model.key,
2954
+ type: model.type === "llm" && model.capabilities?.vision === true ? "vlm" : model.type,
2955
+ state: instances.length ? "loaded" : "not-loaded",
2956
+ loaded_context_length: ctx
2957
+ };
2958
+ byId.set(model.key, info);
2959
+ for (const instance of instances) {
2960
+ if (typeof instance?.id === "string" && instance.id !== model.key) {
2961
+ byId.set(instance.id, {
2962
+ ...info,
2963
+ id: instance.id,
2964
+ loaded_context_length: contextLength(instance.config?.context_length)
2965
+ });
2966
+ }
2967
+ }
2968
+ }
2969
+ } else {
2970
+ const legacy = await fetchJson(`${root}/api/v0/models`, endpoint, options);
2971
+ if (Array.isArray(legacy?.data)) {
2972
+ for (const model of legacy.data) {
2973
+ if (typeof model?.id === "string") byId.set(model.id, model);
2974
+ }
2975
+ }
2976
+ }
2903
2977
  const models = [];
2904
2978
  for (const entry of entries) {
2905
2979
  const info = byId.get(entry.id);
2906
2980
  if (info && info.type !== "llm" && info.type !== "vlm") continue;
2907
- const ctx = info?.max_context_length;
2981
+ const ctx = info?.state === "loaded" ? contextLength(info.loaded_context_length) : void 0;
2908
2982
  models.push({
2909
2983
  rawId: entry.id,
2910
2984
  endpointId: endpoint.id,
2911
- contextWindow: typeof ctx === "number" && ctx > 0 ? ctx : FALLBACK_CONTEXT_WINDOW,
2912
- contextWindowKnown: typeof ctx === "number" && ctx > 0,
2985
+ contextWindow: ctx ?? FALLBACK_CONTEXT_WINDOW,
2986
+ contextWindowKnown: ctx !== void 0,
2913
2987
  // LM Studio doesn't report tool support; it gates per-model at request time.
2914
2988
  supportsTools: true,
2915
2989
  supportsImages: info?.type === "vlm",
@@ -2925,8 +2999,8 @@ async function enrichLlamaCpp(endpoint, entries, options) {
2925
2999
  endpoint,
2926
3000
  options
2927
3001
  );
2928
- const nCtx = props?.default_generation_settings?.n_ctx;
2929
- const known = typeof nCtx === "number" && nCtx > 0;
3002
+ const nCtx = contextLength(props?.default_generation_settings?.n_ctx);
3003
+ const known = nCtx !== void 0;
2930
3004
  return entries.map((entry) => ({
2931
3005
  ...genericModel(endpoint, entry),
2932
3006
  contextWindow: known ? nCtx : FALLBACK_CONTEXT_WINDOW,