@prestyj/core 5.26.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,
@@ -2257,11 +2266,18 @@ var MODELS = [
2257
2266
  costTier: "high",
2258
2267
  maxThinkingLevel: "ultra"
2259
2268
  },
2269
+ // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
2270
+ // GPT-5.6 family (Sol/Terra/Luna; there is no GPT-6 Terra — OpenAI's Codex
2271
+ // catalog upgrades 5.6 Terra to 6 Sol). Both need a Codex client >= 0.155.0
2272
+ // on the ChatGPT OAuth route. Same window split as Astra: 1.05M on the public
2273
+ // Responses API, 272K on the Codex route; 128K output, text+image input,
2274
+ // freeform apply_patch, responses-lite transport. The 5.6 ids are retired —
2275
+ // a saved session on one falls back to the provider default on next start.
2260
2276
  {
2261
- // GPT-6 Sol — "Workhorse model for coding and everyday work." (Codex
2262
- // catalog priority 2, default medium, requires Codex client >= 0.155.0).
2263
- // Launched Sep 22 2026 at $2/$10 per 1M tokens — half of GPT-5.6 Sol.
2264
- // Same 1.05M public / 272K Codex split and low → ultra ladder as Astra.
2277
+ // Sol — "Workhorse model for coding and everyday work." (Codex priority 2,
2278
+ // default medium). $2/$10 MTok. Ladder low → medium → high → xhigh → max →
2279
+ // ultra; ultra is the Codex orchestration preset (max effort on the wire +
2280
+ // proactive local subagent delegation).
2265
2281
  id: "gpt-6-sol",
2266
2282
  name: "GPT-6 Sol",
2267
2283
  provider: "openai",
@@ -2276,10 +2292,8 @@ var MODELS = [
2276
2292
  maxThinkingLevel: "ultra"
2277
2293
  },
2278
2294
  {
2279
- // GPT-6 Luna — "Fast and affordable model for easier tasks." (Codex
2280
- // catalog priority 3, default medium, client >= 0.155.0). $0.10/$0.50 per
2281
- // 1M tokens. Reasoning tops out at `max` (no ultra preset). Listed ahead of
2282
- // GPT-5.6 Luna so getFastModel picks it as the OpenAI fast tier.
2295
+ // Luna — "Fast and affordable model for easier tasks." (Codex priority 3,
2296
+ // default medium). $0.10/$0.50 MTok. Reasoning tops out at `max`.
2283
2297
  id: "gpt-6-luna",
2284
2298
  name: "GPT-6 Luna",
2285
2299
  provider: "openai",
@@ -2293,71 +2307,29 @@ var MODELS = [
2293
2307
  costTier: "low",
2294
2308
  maxThinkingLevel: "max"
2295
2309
  },
2296
- // GPT-5.6 family — three agentic coding tiers launched July 2026. The public
2297
- // Responses API advertises a 1.05M context window; OpenAI's Codex product
2298
- // catalog advertises 272K on the ChatGPT OAuth route (corrected from the
2299
- // initially advertised 372K — openai/codex PR #33972, Jul 18 2026 hotfix). All three take
2300
- // text+image input, freeform apply_patch, text+image web search, and parallel
2301
- // tool calls.
2302
- {
2303
- // Sol — "Latest frontier agentic coding model." (priority 1, default low).
2304
- // Reasoning ladder: low → medium → high → xhigh → max → ultra. Ultra is a
2305
- // Codex orchestration preset: the request uses max effort while the local
2306
- // runtime proactively delegates suitable independent work to subagents.
2307
- id: "gpt-5.6-sol",
2308
- name: "GPT-5.6 Sol",
2309
- provider: "openai",
2310
- contextWindow: 105e4,
2311
- codexContextWindow: 272e3,
2312
- maxOutputTokens: 128e3,
2313
- supportsThinking: true,
2314
- defaultThinkingLevel: "low",
2315
- supportsImages: true,
2316
- supportsVideo: false,
2317
- costTier: "high",
2318
- maxThinkingLevel: "ultra"
2319
- },
2310
+ // ── Sakana (Fugu) ──────────────────────────────────────
2311
+ // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
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.
2320
2318
  {
2321
- // Terra — "Balanced agentic coding model for everyday work." (priority 2,
2322
- // default medium).
2323
- id: "gpt-5.6-terra",
2324
- name: "GPT-5.6 Terra",
2325
- provider: "openai",
2326
- contextWindow: 105e4,
2327
- codexContextWindow: 272e3,
2319
+ id: "fugu",
2320
+ name: "Fugu",
2321
+ provider: "sakana",
2322
+ contextWindow: 1e6,
2328
2323
  maxOutputTokens: 128e3,
2329
2324
  supportsThinking: true,
2330
- defaultThinkingLevel: "medium",
2331
2325
  supportsImages: true,
2332
2326
  supportsVideo: false,
2333
2327
  costTier: "medium",
2334
- maxThinkingLevel: "ultra"
2335
- },
2336
- {
2337
- // Luna — "Fast and affordable agentic coding model." (priority 3, default
2338
- // medium). Reasoning tops out at `max`.
2339
- id: "gpt-5.6-luna",
2340
- name: "GPT-5.6 Luna",
2341
- provider: "openai",
2342
- contextWindow: 105e4,
2343
- codexContextWindow: 272e3,
2344
- maxOutputTokens: 128e3,
2345
- supportsThinking: true,
2346
- defaultThinkingLevel: "medium",
2347
- supportsImages: true,
2348
- supportsVideo: false,
2349
- costTier: "low",
2350
- maxThinkingLevel: "max"
2328
+ maxThinkingLevel: "xhigh"
2351
2329
  },
2352
- // ── Sakana (Fugu) ──────────────────────────────────────
2353
- // Sakana Fugu is a multi-agent system surfaced as a standard LLM via the
2354
- // OpenAI-compatible Sakana API (https://api.sakana.ai/v1). Both models take
2355
- // text + image input. Plain Fugu stops at xhigh; Ultra v1.1 also supports max.
2356
- // `fugu` routes across all providers; `fugu-ultra` is
2357
- // the heavier tier (may need larger client timeouts on complex tasks).
2358
2330
  {
2359
- id: "fugu",
2360
- name: "Fugu",
2331
+ id: "fugu-max",
2332
+ name: "Fugu Max",
2361
2333
  provider: "sakana",
2362
2334
  contextWindow: 1e6,
2363
2335
  maxOutputTokens: 128e3,
@@ -2377,7 +2349,7 @@ var MODELS = [
2377
2349
  supportsImages: true,
2378
2350
  supportsVideo: false,
2379
2351
  costTier: "high",
2380
- // 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.
2381
2353
  maxThinkingLevel: "max"
2382
2354
  },
2383
2355
  // ── xAI (Grok) ─────────────────────────────────────────
@@ -2521,7 +2493,27 @@ var MODELS = [
2521
2493
  costTier: "high",
2522
2494
  maxThinkingLevel: "max"
2523
2495
  },
2524
- // 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.
2525
2517
  {
2526
2518
  id: "kimi-k2.7-code",
2527
2519
  name: "Kimi K2.7 Code",
@@ -2668,10 +2660,14 @@ var MODELS = [
2668
2660
  authStorageKeys: [XIAOMI_CREDITS_KEY]
2669
2661
  },
2670
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.
2671
2666
  {
2672
2667
  // `deepseek-v4-pro` now serves DeepSeek-V4-Pro-0813 (released 2026-08-13,
2673
2668
  // first STABLE V4 Pro — supersedes the April preview; calling name
2674
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.
2675
2671
  // Docs abbreviate output as 384K; use the same conservative 384,000-token
2676
2672
  // application cap across V4 models rather than mixing decimal/binary units.
2677
2673
  id: "deepseek-v4-pro",
@@ -2686,21 +2682,10 @@ var MODELS = [
2686
2682
  maxThinkingLevel: "max"
2687
2683
  },
2688
2684
  {
2689
- id: "deepseek-v4-flash",
2690
- name: "DeepSeek V4 Flash",
2691
- provider: "deepseek",
2692
- contextWindow: 1048576,
2693
- maxOutputTokens: 384e3,
2694
- supportsThinking: true,
2695
- supportsImages: false,
2696
- supportsVideo: false,
2697
- costTier: "low",
2698
- maxThinkingLevel: "max"
2699
- },
2700
- // Opt-in experimental vision sibling; never replaces the stable summary model.
2701
- {
2702
- id: "deepseek-v4-flash-vision-exp",
2703
- 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",
2704
2689
  provider: "deepseek",
2705
2690
  contextWindow: 1048576,
2706
2691
  maxOutputTokens: 384e3,
@@ -2712,11 +2697,13 @@ var MODELS = [
2712
2697
  },
2713
2698
  // ── OpenRouter ─────────────────────────────────────────
2714
2699
  {
2715
- id: "qwen/qwen3.6-plus",
2716
- 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",
2717
2704
  provider: "openrouter",
2718
2705
  contextWindow: 1e6,
2719
- maxOutputTokens: 65536,
2706
+ maxOutputTokens: 131072,
2720
2707
  supportsThinking: true,
2721
2708
  supportsImages: true,
2722
2709
  supportsVideo: true,
@@ -2810,13 +2797,13 @@ function getDefaultModel(provider) {
2810
2797
  if (provider === "deepseek") return MODELS.find((m) => m.id === "deepseek-v4-pro");
2811
2798
  if (provider === "huggingface")
2812
2799
  return MODELS.find((m) => m.id === "Qwen/Qwen3-Coder-480B-A35B-Instruct");
2813
- 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");
2814
2801
  if (provider === "sakana") return MODELS.find((m) => m.id === "fugu");
2815
2802
  if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.7");
2816
2803
  if (provider === "local") {
2817
2804
  return getModelsForProvider("local")[0] ?? PLACEHOLDER_LOCAL_MODEL;
2818
2805
  }
2819
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2806
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2820
2807
  }
2821
2808
  var PLACEHOLDER_LOCAL_MODEL = {
2822
2809
  id: "local/none/none",
@@ -2854,7 +2841,7 @@ function getDefaultThinkingLevel(modelId, options) {
2854
2841
  }
2855
2842
  function getSummaryModel(provider, currentModelId) {
2856
2843
  if (provider === "anthropic") {
2857
- return MODELS.find((m) => m.id === "claude-sonnet-5");
2844
+ return MODELS.find((m) => m.id === "claude-sonnet-5-5");
2858
2845
  }
2859
2846
  if (provider === "openai" || provider === "glm" || provider === "deepseek" || provider === "huggingface") {
2860
2847
  const low = getModelsForProvider(provider).find((m) => m.costTier === "low");
@@ -2906,16 +2893,16 @@ function isXaiModel(provider) {
2906
2893
  return provider === "xai";
2907
2894
  }
2908
2895
  function isMoonshotK3Model(provider, model) {
2909
- return provider === "moonshot" && model === "kimi-k3";
2896
+ return provider === "moonshot" && (model === "kimi-k3" || model === "kimi-for-coding");
2910
2897
  }
2911
2898
  function isGlmModel(provider) {
2912
2899
  return provider === "glm";
2913
2900
  }
2914
2901
  function isAnthropicXhighModel(provider, model) {
2915
- 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);
2916
2903
  }
2917
2904
  function isAnthropicAdaptiveModel(provider, model) {
2918
- 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);
2919
2906
  }
2920
2907
  function getSupportedThinkingLevels(provider, model) {
2921
2908
  if (provider === "local") {