@prestyj/core 5.27.0 → 5.28.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.cjs CHANGED
@@ -1988,7 +1988,14 @@ var AuthStorage = class {
1988
1988
  if (opts?.storageKeys && !(opts.storageKeys.length === 1 && opts.storageKeys[0] === provider)) {
1989
1989
  for (const key of opts.storageKeys) {
1990
1990
  const creds2 = this.data[key];
1991
- if (creds2) return creds2;
1991
+ if (!creds2) continue;
1992
+ if (key !== provider && dualAuthProviderByOAuthKey(key)) {
1993
+ return await this.resolveCredentials(key, {
1994
+ ...opts.forceRefresh ? { forceRefresh: true } : {},
1995
+ ...opts.rejectedToken !== void 0 ? { rejectedToken: opts.rejectedToken } : {}
1996
+ });
1997
+ }
1998
+ return creds2;
1992
1999
  }
1993
2000
  throw new NotLoggedInError(provider);
1994
2001
  }
@@ -2209,8 +2216,10 @@ var MODELS = [
2209
2216
  maxThinkingLevel: "max"
2210
2217
  },
2211
2218
  {
2212
- id: "claude-sonnet-5",
2213
- name: "Claude Sonnet 5",
2219
+ // Released 2026-09-28 — replaces Sonnet 5 at $2/$10 MTok, with the same
2220
+ // 1M context / 128K output and adaptive thinking, now including xhigh.
2221
+ id: "claude-sonnet-5-5",
2222
+ name: "Claude Sonnet 5.5",
2214
2223
  provider: "anthropic",
2215
2224
  contextWindow: 1e6,
2216
2225
  maxOutputTokens: 128e3,
@@ -2300,10 +2309,12 @@ var MODELS = [
2300
2309
  },
2301
2310
  // ── Sakana (Fugu) ──────────────────────────────────────
2302
2311
  // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
2303
- // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). Both models take
2304
- // text + image input. Plain Fugu stops at xhigh; Ultra v1.1 also supports max.
2305
- // `fugu` routes across all providers; `fugu-ultra` is
2306
- // the heavier tier (may need larger client timeouts on complex tasks).
2312
+ // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
2313
+ // text + image input (verified against the live /models list, 2026-09-28).
2314
+ // `fugu` balances latency and quality; `fugu-max` (v1.0, 2026-09-11) is the
2315
+ // cost tier over the largest open-weight pool ($2/$6 per 1M); `fugu-ultra`
2316
+ // is the heavier quality tier (may need larger client timeouts). Plain Fugu
2317
+ // and Fugu Max stop at xhigh — Sakana documents max as the same effort there.
2307
2318
  {
2308
2319
  id: "fugu",
2309
2320
  name: "Fugu",
@@ -2316,6 +2327,18 @@ var MODELS = [
2316
2327
  costTier: "medium",
2317
2328
  maxThinkingLevel: "xhigh"
2318
2329
  },
2330
+ {
2331
+ id: "fugu-max",
2332
+ name: "Fugu Max",
2333
+ provider: "sakana",
2334
+ contextWindow: 1e6,
2335
+ maxOutputTokens: 128e3,
2336
+ supportsThinking: true,
2337
+ supportsImages: true,
2338
+ supportsVideo: false,
2339
+ costTier: "medium",
2340
+ maxThinkingLevel: "xhigh"
2341
+ },
2319
2342
  {
2320
2343
  id: "fugu-ultra",
2321
2344
  name: "Fugu Ultra",
@@ -2326,7 +2349,7 @@ var MODELS = [
2326
2349
  supportsImages: true,
2327
2350
  supportsVideo: false,
2328
2351
  costTier: "high",
2329
- // The rolling alias now serves v1.1, which adds a distinct max effort.
2352
+ // The rolling alias now serves v2.0 (2026-09-11), which keeps max effort.
2330
2353
  maxThinkingLevel: "max"
2331
2354
  },
2332
2355
  // ── xAI (Grok) ─────────────────────────────────────────
@@ -2470,7 +2493,27 @@ var MODELS = [
2470
2493
  costTier: "high",
2471
2494
  maxThinkingLevel: "max"
2472
2495
  },
2473
- // Retain the cheaper dedicated coding model as an explicit alternative.
2496
+ // K2.8 Preview (2026-09-11) is served only on the Kimi For Coding OAuth
2497
+ // endpoint, under its rolling `kimi-for-coding` id (live /models, 2026-09-28:
2498
+ // display_name "K2.8 Preview", 1M context, image + video input, efforts
2499
+ // low/high/max default max). The public API-key endpoint does not serve it,
2500
+ // so it resolves from the Kimi sign-in credential only.
2501
+ {
2502
+ id: "kimi-for-coding",
2503
+ name: "Kimi K2.8 Preview",
2504
+ provider: "moonshot",
2505
+ contextWindow: 1048576,
2506
+ maxOutputTokens: 131072,
2507
+ supportsThinking: true,
2508
+ supportsImages: true,
2509
+ supportsVideo: true,
2510
+ maxVideoBytes: 100 * 1024 * 1024,
2511
+ costTier: "medium",
2512
+ maxThinkingLevel: "max",
2513
+ authStorageKeys: [MOONSHOT_OAUTH_KEY]
2514
+ },
2515
+ // K2.7 Code is requested by its pinned id (not the `kimi-for-coding` alias
2516
+ // that moved to K2.8), so it stays the real K2.7 on both endpoints.
2474
2517
  {
2475
2518
  id: "kimi-k2.7-code",
2476
2519
  name: "Kimi K2.7 Code",
@@ -2617,10 +2660,14 @@ var MODELS = [
2617
2660
  authStorageKeys: [XIAOMI_CREDITS_KEY]
2618
2661
  },
2619
2662
  // ── DeepSeek ───────────────────────────────────────────
2663
+ // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
2664
+ // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
2665
+ // ids only temporarily route to V4.1 Flash, so they are retired here too.
2620
2666
  {
2621
2667
  // `deepseek-v4-pro` now serves DeepSeek-V4-Pro-0813 (released 2026-08-13,
2622
2668
  // first STABLE V4 Pro — supersedes the April preview; calling name
2623
2669
  // unchanged, same 1.6T/49B MoE). 1M context, text-only, low/high/max effort.
2670
+ // DeepSeek reversed its planned 2026-09-14 retirement, so it stays served.
2624
2671
  // Docs abbreviate output as 384K; use the same conservative 384,000-token
2625
2672
  // application cap across V4 models rather than mixing decimal/binary units.
2626
2673
  id: "deepseek-v4-pro",
@@ -2635,21 +2682,10 @@ var MODELS = [
2635
2682
  maxThinkingLevel: "max"
2636
2683
  },
2637
2684
  {
2638
- id: "deepseek-v4-flash",
2639
- name: "DeepSeek V4 Flash",
2640
- provider: "deepseek",
2641
- contextWindow: 1048576,
2642
- maxOutputTokens: 384e3,
2643
- supportsThinking: true,
2644
- supportsImages: false,
2645
- supportsVideo: false,
2646
- costTier: "low",
2647
- maxThinkingLevel: "max"
2648
- },
2649
- // Opt-in experimental vision sibling; never replaces the stable summary model.
2650
- {
2651
- id: "deepseek-v4-flash-vision-exp",
2652
- name: "DeepSeek V4 Flash Vision (Experimental)",
2685
+ // `deepseek-flash` is the rolling alias for the latest Flash — currently
2686
+ // V4.1 Flash (2026-09-10): native image input, 1M context, 384K output.
2687
+ id: "deepseek-flash",
2688
+ name: "DeepSeek V4.1 Flash",
2653
2689
  provider: "deepseek",
2654
2690
  contextWindow: 1048576,
2655
2691
  maxOutputTokens: 384e3,
@@ -2661,11 +2697,13 @@ var MODELS = [
2661
2697
  },
2662
2698
  // ── OpenRouter ─────────────────────────────────────────
2663
2699
  {
2664
- id: "qwen/qwen3.6-plus",
2665
- name: "Qwen3.6-Plus",
2700
+ // Qwen3.8 Max — Alibaba's flagship (live /endpoints, 2026-09-28): 1M
2701
+ // context, 131,072 output, text + image + video input, reasoning on.
2702
+ id: "qwen/qwen3.8-max",
2703
+ name: "Qwen3.8 Max",
2666
2704
  provider: "openrouter",
2667
2705
  contextWindow: 1e6,
2668
- maxOutputTokens: 65536,
2706
+ maxOutputTokens: 131072,
2669
2707
  supportsThinking: true,
2670
2708
  supportsImages: true,
2671
2709
  supportsVideo: true,
@@ -2759,13 +2797,13 @@ function getDefaultModel(provider) {
2759
2797
  if (provider === "deepseek") return MODELS.find((m) => m.id === "deepseek-v4-pro");
2760
2798
  if (provider === "huggingface")
2761
2799
  return MODELS.find((m) => m.id === "Qwen/Qwen3-Coder-480B-A35B-Instruct");
2762
- if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.6-plus");
2800
+ if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.8-max");
2763
2801
  if (provider === "sakana") return MODELS.find((m) => m.id === "fugu");
2764
2802
  if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.7");
2765
2803
  if (provider === "local") {
2766
2804
  return getModelsForProvider("local")[0] ?? PLACEHOLDER_LOCAL_MODEL;
2767
2805
  }
2768
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2806
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2769
2807
  }
2770
2808
  var PLACEHOLDER_LOCAL_MODEL = {
2771
2809
  id: "local/none/none",
@@ -2803,7 +2841,7 @@ function getDefaultThinkingLevel(modelId, options) {
2803
2841
  }
2804
2842
  function getSummaryModel(provider, currentModelId) {
2805
2843
  if (provider === "anthropic") {
2806
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2844
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2807
2845
  }
2808
2846
  if (provider === "openai" || provider === "glm" || provider === "deepseek" || provider === "huggingface") {
2809
2847
  const low = getModelsForProvider(provider).find((m) => m.costTier === "low");
@@ -2855,16 +2893,16 @@ function isXaiModel(provider) {
2855
2893
  return provider === "xai";
2856
2894
  }
2857
2895
  function isMoonshotK3Model(provider, model) {
2858
- return provider === "moonshot" && model === "kimi-k3";
2896
+ return provider === "moonshot" && (model === "kimi-k3" || model === "kimi-for-coding");
2859
2897
  }
2860
2898
  function isGlmModel(provider) {
2861
2899
  return provider === "glm";
2862
2900
  }
2863
2901
  function isAnthropicXhighModel(provider, model) {
2864
- return provider === "anthropic" && /opus-5|opus-4-8|opus-4-7/.test(model);
2902
+ return provider === "anthropic" && /opus-5|opus-4[-.]8|opus-4[-.]7|sonnet-5[-.]5/.test(model);
2865
2903
  }
2866
2904
  function isAnthropicAdaptiveModel(provider, model) {
2867
- return provider === "anthropic" && /opus-5|opus-4-8|opus-4-7|opus-4-6|sonnet-5|fable-5|mythos-5/.test(model);
2905
+ return provider === "anthropic" && /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|fable-5|mythos-5/.test(model);
2868
2906
  }
2869
2907
  function getSupportedThinkingLevels(provider, model) {
2870
2908
  if (provider === "local") {