@prestyj/core 5.27.0 → 5.28.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
@@ -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,
@@ -2235,7 +2244,7 @@ var MODELS = [
2235
2244
  // ── OpenAI (Codex) ─────────────────────────────────────
2236
2245
  {
2237
2246
  // GPT-6 Astra — "Our most capable model for complex, demanding work."
2238
- // (Codex catalog priority 1, listed for every ChatGPT plan, requires a
2247
+ // (Codex catalog priority 2, listed for every ChatGPT plan, requires a
2239
2248
  // Codex client >= 0.153.0 — see CODEX_CLIENT_VERSION). Same split as 5.6:
2240
2249
  // 1.05M on the public Responses API, 272K on the ChatGPT OAuth route
2241
2250
  // (openai/codex models.json, `gpt-6-astra`). Reasoning ladder low → medium
@@ -2259,32 +2268,36 @@ var MODELS = [
2259
2268
  },
2260
2269
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
2261
2270
  // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
2262
- // catalog upgrades 5.6 Terra to 6 Sol). Both need a Codex client >= 0.155.0
2263
- // on the ChatGPT OAuth route. Same window split as Astra: 1.05M on the public
2264
- // Responses API, 272K on the Codex route; 128K output, text+image input,
2265
- // freeform apply_patch, responses-lite transport. The 5.6 ids are retired —
2266
- // a saved session on one falls back to the provider default on next start.
2271
+ // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
2272
+ // GPT-6 Sol. Same window split as Astra: 1.05M on the public Responses API,
2273
+ // 272K on the Codex route; 128K output, text+image input, freeform
2274
+ // apply_patch, responses-lite transport. The GPT-5.6 ids and `gpt-6-sol` are
2275
+ // retired — a saved session on one falls back to the provider default on
2276
+ // next start.
2267
2277
  {
2268
- // Sol — "Workhorse model for coding and everyday work." (Codex priority 2,
2269
- // default medium). $2/$10 MTok. Ladder low → medium → high → xhigh → max →
2270
- // ultra; ultra is the Codex orchestration preset (max effort on the wire +
2271
- // proactive local subagent delegation).
2272
- id: "gpt-6-sol",
2273
- name: "GPT-6 Sol",
2278
+ // GPT-6.1 Sol — "Latest workhorse model for coding and everyday work."
2279
+ // (Codex priority 1, default low). The catalog says Codex client >= 0.153.0,
2280
+ // but the ChatGPT backend only serves it from 0.159.0 (see
2281
+ // CODEX_CLIENT_VERSION). $2/$10 MTok, cached input $0.10. Ladder low →
2282
+ // medium → high → xhigh → max → ultra; ultra is the Codex orchestration
2283
+ // preset (max effort on the wire + proactive local subagent delegation).
2284
+ id: "gpt-6.1-sol",
2285
+ name: "GPT-6.1 Sol",
2274
2286
  provider: "openai",
2275
2287
  contextWindow: 105e4,
2276
2288
  codexContextWindow: 272e3,
2277
2289
  maxOutputTokens: 128e3,
2278
2290
  supportsThinking: true,
2279
- defaultThinkingLevel: "medium",
2291
+ defaultThinkingLevel: "low",
2280
2292
  supportsImages: true,
2281
2293
  supportsVideo: false,
2282
2294
  costTier: "medium",
2283
2295
  maxThinkingLevel: "ultra"
2284
2296
  },
2285
2297
  {
2286
- // Luna — "Fast and affordable model for easier tasks." (Codex priority 3,
2287
- // default medium). $0.10/$0.50 MTok. Reasoning tops out at `max`.
2298
+ // Luna — "Fast and affordable model for easier tasks." (Codex priority 4,
2299
+ // default medium, needs a Codex client >= 0.155.0). $0.10/$0.50 MTok.
2300
+ // Reasoning tops out at `max`.
2288
2301
  id: "gpt-6-luna",
2289
2302
  name: "GPT-6 Luna",
2290
2303
  provider: "openai",
@@ -2300,10 +2313,12 @@ var MODELS = [
2300
2313
  },
2301
2314
  // ── Sakana (Fugu) ──────────────────────────────────────
2302
2315
  // 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).
2316
+ // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). All three take
2317
+ // text + image input (verified against the live /models list, 2026-09-28).
2318
+ // `fugu` balances latency and quality; `fugu-max` (v1.0, 2026-09-11) is the
2319
+ // cost tier over the largest open-weight pool ($2/$6 per 1M); `fugu-ultra`
2320
+ // is the heavier quality tier (may need larger client timeouts). Plain Fugu
2321
+ // and Fugu Max stop at xhigh — Sakana documents max as the same effort there.
2307
2322
  {
2308
2323
  id: "fugu",
2309
2324
  name: "Fugu",
@@ -2316,6 +2331,18 @@ var MODELS = [
2316
2331
  costTier: "medium",
2317
2332
  maxThinkingLevel: "xhigh"
2318
2333
  },
2334
+ {
2335
+ id: "fugu-max",
2336
+ name: "Fugu Max",
2337
+ provider: "sakana",
2338
+ contextWindow: 1e6,
2339
+ maxOutputTokens: 128e3,
2340
+ supportsThinking: true,
2341
+ supportsImages: true,
2342
+ supportsVideo: false,
2343
+ costTier: "medium",
2344
+ maxThinkingLevel: "xhigh"
2345
+ },
2319
2346
  {
2320
2347
  id: "fugu-ultra",
2321
2348
  name: "Fugu Ultra",
@@ -2326,7 +2353,7 @@ var MODELS = [
2326
2353
  supportsImages: true,
2327
2354
  supportsVideo: false,
2328
2355
  costTier: "high",
2329
- // The rolling alias now serves v1.1, which adds a distinct max effort.
2356
+ // The rolling alias now serves v2.0 (2026-09-11), which keeps max effort.
2330
2357
  maxThinkingLevel: "max"
2331
2358
  },
2332
2359
  // ── xAI (Grok) ─────────────────────────────────────────
@@ -2470,7 +2497,27 @@ var MODELS = [
2470
2497
  costTier: "high",
2471
2498
  maxThinkingLevel: "max"
2472
2499
  },
2473
- // Retain the cheaper dedicated coding model as an explicit alternative.
2500
+ // K2.8 Preview (2026-09-11) is served only on the Kimi For Coding OAuth
2501
+ // endpoint, under its rolling `kimi-for-coding` id (live /models, 2026-09-28:
2502
+ // display_name "K2.8 Preview", 1M context, image + video input, efforts
2503
+ // low/high/max default max). The public API-key endpoint does not serve it,
2504
+ // so it resolves from the Kimi sign-in credential only.
2505
+ {
2506
+ id: "kimi-for-coding",
2507
+ name: "Kimi K2.8 Preview",
2508
+ provider: "moonshot",
2509
+ contextWindow: 1048576,
2510
+ maxOutputTokens: 131072,
2511
+ supportsThinking: true,
2512
+ supportsImages: true,
2513
+ supportsVideo: true,
2514
+ maxVideoBytes: 100 * 1024 * 1024,
2515
+ costTier: "medium",
2516
+ maxThinkingLevel: "max",
2517
+ authStorageKeys: [MOONSHOT_OAUTH_KEY]
2518
+ },
2519
+ // K2.7 Code is requested by its pinned id (not the `kimi-for-coding` alias
2520
+ // that moved to K2.8), so it stays the real K2.7 on both endpoints.
2474
2521
  {
2475
2522
  id: "kimi-k2.7-code",
2476
2523
  name: "Kimi K2.7 Code",
@@ -2617,10 +2664,14 @@ var MODELS = [
2617
2664
  authStorageKeys: [XIAOMI_CREDITS_KEY]
2618
2665
  },
2619
2666
  // ── DeepSeek ───────────────────────────────────────────
2667
+ // The live /models list (2026-09-28) serves exactly `deepseek-flash` and
2668
+ // `deepseek-v4-pro`. V4 Flash and V4 Flash Vision Exp are retired; their old
2669
+ // ids only temporarily route to V4.1 Flash, so they are retired here too.
2620
2670
  {
2621
2671
  // `deepseek-v4-pro` now serves DeepSeek-V4-Pro-0813 (released 2026-08-13,
2622
2672
  // first STABLE V4 Pro — supersedes the April preview; calling name
2623
2673
  // unchanged, same 1.6T/49B MoE). 1M context, text-only, low/high/max effort.
2674
+ // DeepSeek reversed its planned 2026-09-14 retirement, so it stays served.
2624
2675
  // Docs abbreviate output as 384K; use the same conservative 384,000-token
2625
2676
  // application cap across V4 models rather than mixing decimal/binary units.
2626
2677
  id: "deepseek-v4-pro",
@@ -2635,21 +2686,10 @@ var MODELS = [
2635
2686
  maxThinkingLevel: "max"
2636
2687
  },
2637
2688
  {
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)",
2689
+ // `deepseek-flash` is the rolling alias for the latest Flash — currently
2690
+ // V4.1 Flash (2026-09-10): native image input, 1M context, 384K output.
2691
+ id: "deepseek-flash",
2692
+ name: "DeepSeek V4.1 Flash",
2653
2693
  provider: "deepseek",
2654
2694
  contextWindow: 1048576,
2655
2695
  maxOutputTokens: 384e3,
@@ -2661,11 +2701,13 @@ var MODELS = [
2661
2701
  },
2662
2702
  // ── OpenRouter ─────────────────────────────────────────
2663
2703
  {
2664
- id: "qwen/qwen3.6-plus",
2665
- name: "Qwen3.6-Plus",
2704
+ // Qwen3.8 Max — Alibaba's flagship (live /endpoints, 2026-09-28): 1M
2705
+ // context, 131,072 output, text + image + video input, reasoning on.
2706
+ id: "qwen/qwen3.8-max",
2707
+ name: "Qwen3.8 Max",
2666
2708
  provider: "openrouter",
2667
2709
  contextWindow: 1e6,
2668
- maxOutputTokens: 65536,
2710
+ maxOutputTokens: 131072,
2669
2711
  supportsThinking: true,
2670
2712
  supportsImages: true,
2671
2713
  supportsVideo: true,
@@ -2751,7 +2793,7 @@ function getVideoByteLimit(modelId) {
2751
2793
  }
2752
2794
  function getDefaultModel(provider) {
2753
2795
  if (provider === "xiaomi") return MODELS.find((m) => m.id === "mimo-v2.6-pro");
2754
- if (provider === "openai") return MODELS.find((m) => m.id === "gpt-6-sol");
2796
+ if (provider === "openai") return MODELS.find((m) => m.id === "gpt-6.1-sol");
2755
2797
  if (provider === "gemini") return MODELS.find((m) => m.id === "gemini-3.1-flash-lite");
2756
2798
  if (provider === "glm") return MODELS.find((m) => m.id === "glm-5.3");
2757
2799
  if (provider === "moonshot") return MODELS.find((m) => m.id === "kimi-k3");
@@ -2759,13 +2801,13 @@ function getDefaultModel(provider) {
2759
2801
  if (provider === "deepseek") return MODELS.find((m) => m.id === "deepseek-v4-pro");
2760
2802
  if (provider === "huggingface")
2761
2803
  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");
2804
+ if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.8-max");
2763
2805
  if (provider === "sakana") return MODELS.find((m) => m.id === "fugu");
2764
2806
  if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.7");
2765
2807
  if (provider === "local") {
2766
2808
  return getModelsForProvider("local")[0] ?? PLACEHOLDER_LOCAL_MODEL;
2767
2809
  }
2768
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2810
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2769
2811
  }
2770
2812
  var PLACEHOLDER_LOCAL_MODEL = {
2771
2813
  id: "local/none/none",
@@ -2803,7 +2845,7 @@ function getDefaultThinkingLevel(modelId, options) {
2803
2845
  }
2804
2846
  function getSummaryModel(provider, currentModelId) {
2805
2847
  if (provider === "anthropic") {
2806
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2848
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2807
2849
  }
2808
2850
  if (provider === "openai" || provider === "glm" || provider === "deepseek" || provider === "huggingface") {
2809
2851
  const low = getModelsForProvider(provider).find((m) => m.costTier === "low");
@@ -2855,16 +2897,16 @@ function isXaiModel(provider) {
2855
2897
  return provider === "xai";
2856
2898
  }
2857
2899
  function isMoonshotK3Model(provider, model) {
2858
- return provider === "moonshot" && model === "kimi-k3";
2900
+ return provider === "moonshot" && (model === "kimi-k3" || model === "kimi-for-coding");
2859
2901
  }
2860
2902
  function isGlmModel(provider) {
2861
2903
  return provider === "glm";
2862
2904
  }
2863
2905
  function isAnthropicXhighModel(provider, model) {
2864
- return provider === "anthropic" && /opus-5|opus-4-8|opus-4-7/.test(model);
2906
+ return provider === "anthropic" && /opus-5|opus-4[-.]8|opus-4[-.]7|sonnet-5[-.]5/.test(model);
2865
2907
  }
2866
2908
  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);
2909
+ return provider === "anthropic" && /opus-5|opus-4[-.]8|opus-4[-.]7|opus-4[-.]6|sonnet-5|fable-5|mythos-5/.test(model);
2868
2910
  }
2869
2911
  function getSupportedThinkingLevels(provider, model) {
2870
2912
  if (provider === "local") {
@@ -2898,7 +2940,7 @@ function getSupportedThinkingLevels(provider, model) {
2898
2940
  return GLM_THINKING_LEVELS.slice(0, maxIndex2 + 1);
2899
2941
  }
2900
2942
  if (!isOpenAIGptModel(provider, model)) return [maxLevel];
2901
- const levels = model.startsWith("gpt-5.6-") || model.startsWith("gpt-6-") ? OPENAI_GPT_56_THINKING_LEVELS : OPENAI_GPT_THINKING_LEVELS;
2943
+ const levels = model.startsWith("gpt-5.6-") || model.startsWith("gpt-6-") || model.startsWith("gpt-6.") ? OPENAI_GPT_56_THINKING_LEVELS : OPENAI_GPT_THINKING_LEVELS;
2902
2944
  const maxIndex = levels.indexOf(maxLevel);
2903
2945
  if (maxIndex === -1) return ["medium"];
2904
2946
  return levels.slice(0, maxIndex + 1);