@prestyj/core 5.33.0 → 5.35.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.
@@ -1232,6 +1232,7 @@ import path2 from "path";
1232
1232
  import { randomBytes } from "crypto";
1233
1233
  import { environmentSecrets, redactText, redactValue } from "@prestyj/ai";
1234
1234
  var MAX_BYTES = 10 * 1024 * 1024;
1235
+ var ROTATED_GENERATIONS = 3;
1235
1236
  var MIN_HEADROOM_BYTES = 64 * 1024;
1236
1237
  var fd = null;
1237
1238
  var logPath = null;
@@ -1248,6 +1249,17 @@ function rotateIfNeeded(filePath, force = false) {
1248
1249
  const st = fs2.statSync(filePath);
1249
1250
  if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
1250
1251
  const rotated = `${filePath}.1`;
1252
+ for (let generation = ROTATED_GENERATIONS - 1; generation >= 1; generation--) {
1253
+ const older = `${filePath}.${generation + 1}`;
1254
+ try {
1255
+ fs2.unlinkSync(older);
1256
+ } catch {
1257
+ }
1258
+ try {
1259
+ fs2.renameSync(`${filePath}.${generation}`, older);
1260
+ } catch {
1261
+ }
1262
+ }
1251
1263
  try {
1252
1264
  fs2.unlinkSync(rotated);
1253
1265
  } catch {
@@ -2761,18 +2773,13 @@ var MODELS = [
2761
2773
  },
2762
2774
  // ── OpenAI (Codex) ─────────────────────────────────────
2763
2775
  {
2764
- // GPT-6 Astra — "Our most capable model for complex, demanding work."
2765
- // (Codex catalog priority 2, listed for every ChatGPT plan, requires a
2766
- // Codex client >= 0.153.0 — see CODEX_CLIENT_VERSION). Same split as 5.6:
2767
- // 1.05M on the public Responses API, 272K on the ChatGPT OAuth route
2768
- // (openai/codex models.json, `gpt-6-astra`). Reasoning ladder low → medium
2769
- // → high → xhigh → max → ultra; `ultra` is the Codex orchestration preset
2770
- // (multi_agent v2) and is Codex-only — the public API tops out at `max`.
2771
- // Note: through a plain API key OpenAI requires the Responses API for tool
2772
- // calling on Astra, so the Chat Completions path is text-only; the OAuth
2773
- // Codex route is the supported way to use it as an agent.
2774
- id: "gpt-6-astra",
2775
- name: "GPT-6 Astra",
2776
+ // GPT-6.2 Astra — released 2026-11-17, "Our most capable model for your
2777
+ // hardest projects." (Codex catalog priority 2, default low, client >=
2778
+ // 0.166.0). $8/$40 MTok, cached input $0.40. 1.05M on the public Responses
2779
+ // API, 272K on the Codex route; 128K output, text+image input. Same ladder
2780
+ // and Ultra preset as GPT-6 Astra, which it retires; the API rejects reasoning effort `none`.
2781
+ id: "gpt-6.2-astra",
2782
+ name: "GPT-6.2 Astra",
2776
2783
  provider: "openai",
2777
2784
  contextWindow: 105e4,
2778
2785
  codexContextWindow: 272e3,
@@ -2785,12 +2792,12 @@ var MODELS = [
2785
2792
  maxThinkingLevel: "ultra"
2786
2793
  },
2787
2794
  {
2788
- // Codex Fast mode for Astra (catalog `service_tiers: priority`, "2x speed,
2789
- // increased usage"). @prestyj/ai's `stream()` sends it as `gpt-6-astra` +
2790
- // `service_tier: "priority"`, exactly what the Codex CLI sends. On a
2791
- // ChatGPT plan it draws included limits at 2.5x the standard rate.
2792
- id: "gpt-6-astra-fast",
2793
- name: "GPT-6 Astra Fast",
2795
+ // Codex Fast mode for 6.2 Astra ("2x speed, increased usage"). @prestyj/ai's
2796
+ // `stream()` sends it as `gpt-6.2-astra` + `service_tier: "priority"`,
2797
+ // exactly what the Codex CLI sends. On a ChatGPT plan it draws included
2798
+ // limits at 2.5x the standard rate.
2799
+ id: "gpt-6.2-astra-fast",
2800
+ name: "GPT-6.2 Astra Fast",
2794
2801
  provider: "openai",
2795
2802
  contextWindow: 105e4,
2796
2803
  codexContextWindow: 272e3,
@@ -2805,24 +2812,25 @@ var MODELS = [
2805
2812
  },
2806
2813
  // GPT-6 Sol + Luna — released 2026-09-22 below Astra, replacing the whole
2807
2814
  // GPT-5.6 family (Sol/Terra/Luna; there was no GPT-6 Terra — OpenAI's Codex
2808
- // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) then replaced
2809
- // GPT-6 Sol, and GPT-6.1 Terra (2026-10-26) sits between Sol and Luna. Same window split as Astra: 1.05M on the public Responses API,
2810
- // 272K on the Codex route; 128K output, text+image input, freeform
2811
- // apply_patch, responses-lite transport. The GPT-5.6 ids and `gpt-6-sol` are
2812
- // retired — a saved session on one falls back to the provider default on
2813
- // next start.
2815
+ // catalog upgrades 5.6 Terra to 6 Sol). GPT-6.1 Sol (2026-09-29) replaced
2816
+ // GPT-6 Sol, GPT-6.1 Terra (2026-10-26) sits between Sol and Luna, and
2817
+ // GPT-6.2 Sol (2026-11-17) replaced GPT-6.1 Sol. 1.05M on the public
2818
+ // Responses API; 128K output, text+image input, freeform apply_patch,
2819
+ // responses-lite transport. The GPT-5.6 ids, `gpt-6-sol` and `gpt-6.1-sol`
2820
+ // are retired — a saved session on one falls back to the provider default
2821
+ // on next start.
2814
2822
  {
2815
- // GPT-6.1 Sol — "Latest workhorse model for coding and everyday work."
2816
- // (Codex priority 1, default low). The catalog says Codex client >= 0.153.0,
2817
- // but the ChatGPT backend only serves it from 0.159.0 (see
2818
- // CODEX_CLIENT_VERSION). $2/$10 MTok, cached input $0.10. Ladder low →
2823
+ // GPT-6.2 Sol — "Our go-to model for everyday work, from coding to
2824
+ // powering agents at scale." (Codex priority 1, default low, client >=
2825
+ // 0.166.0). $2/$10 MTok, cached input $0.10. Like Terra, the Codex route
2826
+ // gets a 500K window (catalog `context_window`). Ladder low →
2819
2827
  // medium → high → xhigh → max → ultra; ultra is the Codex orchestration
2820
2828
  // preset (xhigh effort on the wire + proactive local subagent delegation).
2821
- id: "gpt-6.1-sol",
2822
- name: "GPT-6.1 Sol",
2829
+ id: "gpt-6.2-sol",
2830
+ name: "GPT-6.2 Sol",
2823
2831
  provider: "openai",
2824
2832
  contextWindow: 105e4,
2825
- codexContextWindow: 272e3,
2833
+ codexContextWindow: 5e5,
2826
2834
  maxOutputTokens: 128e3,
2827
2835
  supportsThinking: true,
2828
2836
  defaultThinkingLevel: "low",
@@ -2832,13 +2840,13 @@ var MODELS = [
2832
2840
  maxThinkingLevel: "ultra"
2833
2841
  },
2834
2842
  {
2835
- // Codex Fast mode for 6.1 Sol ("2x speed, increased usage") — see
2836
- // `gpt-6-astra-fast` for the wire mapping and billing.
2837
- id: "gpt-6.1-sol-fast",
2838
- name: "GPT-6.1 Sol Fast",
2843
+ // Codex Fast mode for 6.2 Sol ("2x speed, increased usage") — see
2844
+ // `gpt-6.2-astra-fast` for the wire mapping and billing.
2845
+ id: "gpt-6.2-sol-fast",
2846
+ name: "GPT-6.2 Sol Fast",
2839
2847
  provider: "openai",
2840
2848
  contextWindow: 105e4,
2841
- codexContextWindow: 272e3,
2849
+ codexContextWindow: 5e5,
2842
2850
  maxOutputTokens: 128e3,
2843
2851
  supportsThinking: true,
2844
2852
  defaultThinkingLevel: "low",
@@ -2866,7 +2874,7 @@ var MODELS = [
2866
2874
  maxThinkingLevel: "ultra"
2867
2875
  },
2868
2876
  {
2869
- // Codex Fast mode for 6.1 Terra ("1.5x speed") — see `gpt-6-astra-fast`
2877
+ // Codex Fast mode for 6.1 Terra ("1.5x speed") — see `gpt-6.2-astra-fast`
2870
2878
  // for the wire mapping and billing.
2871
2879
  id: "gpt-6.1-terra-fast",
2872
2880
  name: "GPT-6.1 Terra Fast",
@@ -2900,7 +2908,7 @@ var MODELS = [
2900
2908
  maxThinkingLevel: "max"
2901
2909
  },
2902
2910
  {
2903
- // Codex Fast mode for Luna ("1.5x speed") — see `gpt-6-astra-fast` for the
2911
+ // Codex Fast mode for Luna ("1.5x speed") — see `gpt-6.2-astra-fast` for the
2904
2912
  // wire mapping and billing. Listed after Luna so compaction summaries
2905
2913
  // (first `low` OpenAI model) stay on standard-speed Luna.
2906
2914
  id: "gpt-6-luna-fast",
@@ -3003,7 +3011,56 @@ var MODELS = [
3003
3011
  authStorageKeys: GEMINI_AUTH_KEYS
3004
3012
  },
3005
3013
  // Keep 3.1 Flash Lite first for the working OAuth default and fast-model routing.
3006
- // New GA models are opt-in; Code Assist access varies by account. Gemini 3.7
3014
+ // New GA models are opt-in; Code Assist access varies by account.
3015
+ // Gemini 4 (GA Nov 2026, ai.google.dev/gemini-api/docs/changelog): a unified 1M window and
3016
+ // 64K synchronous output. Hydrogen also takes an `xhigh` thinking level; the ladder here
3017
+ // stops at `high` like the other Gemini models.
3018
+ {
3019
+ // The fast everyday model, on the free tier too ($1.50 / $7.50 per 1M paid).
3020
+ id: "gemini-4-hydrogen",
3021
+ name: "Gemini 4 Hydrogen",
3022
+ provider: "gemini",
3023
+ contextWindow: 1048576,
3024
+ maxOutputTokens: 65536,
3025
+ supportsThinking: true,
3026
+ supportsImages: true,
3027
+ supportsVideo: true,
3028
+ maxVideoBytes: 20 * 1024 * 1024,
3029
+ costTier: "medium",
3030
+ maxThinkingLevel: "high",
3031
+ authStorageKeys: GEMINI_AUTH_KEYS
3032
+ },
3033
+ {
3034
+ // Paid tier only ($4 / $20 per 1M from Dec 1, 2026).
3035
+ id: "gemini-4-argon",
3036
+ name: "Gemini 4 Argon",
3037
+ provider: "gemini",
3038
+ contextWindow: 1048576,
3039
+ maxOutputTokens: 65536,
3040
+ supportsThinking: true,
3041
+ supportsImages: true,
3042
+ supportsVideo: true,
3043
+ maxVideoBytes: 20 * 1024 * 1024,
3044
+ costTier: "high",
3045
+ maxThinkingLevel: "high",
3046
+ authStorageKeys: GEMINI_AUTH_KEYS
3047
+ },
3048
+ {
3049
+ // The strongest Gemini 4 reasoning model; paid tier only.
3050
+ id: "gemini-4-carbon",
3051
+ name: "Gemini 4 Carbon",
3052
+ provider: "gemini",
3053
+ contextWindow: 1048576,
3054
+ maxOutputTokens: 65536,
3055
+ supportsThinking: true,
3056
+ supportsImages: true,
3057
+ supportsVideo: true,
3058
+ maxVideoBytes: 20 * 1024 * 1024,
3059
+ costTier: "high",
3060
+ maxThinkingLevel: "high",
3061
+ authStorageKeys: GEMINI_AUTH_KEYS
3062
+ },
3063
+ // Gemini 3.7
3007
3064
  // Flash is retired: Google deprecated it on 2026-10-08 and routes every
3008
3065
  // `gemini-3.7-flash` request to 3.8 Flash (ai.google.dev/gemini-api/docs/
3009
3066
  // changelog), so a saved session on it falls back to the provider default.
@@ -3021,6 +3078,21 @@ var MODELS = [
3021
3078
  maxThinkingLevel: "high",
3022
3079
  authStorageKeys: GEMINI_AUTH_KEYS
3023
3080
  },
3081
+ {
3082
+ // Replaced 3.5 Flash, which Google now routes here (changelog).
3083
+ id: "gemini-3.6-flash",
3084
+ name: "Gemini 3.6 Flash",
3085
+ provider: "gemini",
3086
+ contextWindow: 1048576,
3087
+ maxOutputTokens: 65536,
3088
+ supportsThinking: true,
3089
+ supportsImages: true,
3090
+ supportsVideo: true,
3091
+ maxVideoBytes: 20 * 1024 * 1024,
3092
+ costTier: "low",
3093
+ maxThinkingLevel: "high",
3094
+ authStorageKeys: GEMINI_AUTH_KEYS
3095
+ },
3024
3096
  {
3025
3097
  id: "gemini-3.5-flash-lite",
3026
3098
  name: "Gemini 3.5 Flash Lite",
@@ -3348,6 +3420,93 @@ var MODELS = [
3348
3420
  costTier: "medium",
3349
3421
  maxThinkingLevel: "high"
3350
3422
  },
3423
+ // ── OpenCode Console (Go subscription, then pay-as-you-go) ────────
3424
+ // One Console API key reaches many labs' models through opencode.ai. Ids
3425
+ // carry the plan prefix (`opencode-go/kimi-k3`) because the gateway reuses
3426
+ // the vendors' own ids; @prestyj/ai strips it at the wire. These rows are only the
3427
+ // offline fallback: the desktop app replaces them with each plan's live,
3428
+ // public model list (core/opencode-catalog-store.ts). Limits, image input
3429
+ // and effort ladders are from GET /inference[/go]/v1/models (2026-11-11);
3430
+ // all three speak Chat Completions natively.
3431
+ {
3432
+ // Go declares `max` as K3's only effort; pay-as-you-go adds low and high.
3433
+ id: "opencode-go/kimi-k3",
3434
+ name: "Kimi K3",
3435
+ provider: "opencode-go",
3436
+ contextWindow: 1048576,
3437
+ maxOutputTokens: 131072,
3438
+ supportsThinking: true,
3439
+ supportsImages: true,
3440
+ supportsVideo: false,
3441
+ costTier: "high",
3442
+ maxThinkingLevel: "max",
3443
+ thinkingLevels: ["max"]
3444
+ },
3445
+ {
3446
+ id: "opencode-go/glm-5.3",
3447
+ name: "GLM-5.3",
3448
+ provider: "opencode-go",
3449
+ contextWindow: 1e6,
3450
+ maxOutputTokens: 131072,
3451
+ supportsThinking: true,
3452
+ supportsImages: false,
3453
+ supportsVideo: false,
3454
+ costTier: "medium",
3455
+ maxThinkingLevel: "max",
3456
+ thinkingLevels: ["low", "high", "max"]
3457
+ },
3458
+ {
3459
+ id: "opencode-go/glm-5.3-flash",
3460
+ name: "GLM-5.3-Flash",
3461
+ provider: "opencode-go",
3462
+ contextWindow: 1e6,
3463
+ maxOutputTokens: 131072,
3464
+ supportsThinking: true,
3465
+ supportsImages: true,
3466
+ supportsVideo: false,
3467
+ costTier: "low",
3468
+ maxThinkingLevel: "max",
3469
+ thinkingLevels: ["low", "high", "max"]
3470
+ },
3471
+ {
3472
+ id: "opencode/kimi-k3",
3473
+ name: "Kimi K3",
3474
+ provider: "opencode",
3475
+ contextWindow: 1048576,
3476
+ maxOutputTokens: 131072,
3477
+ supportsThinking: true,
3478
+ supportsImages: true,
3479
+ supportsVideo: false,
3480
+ costTier: "high",
3481
+ maxThinkingLevel: "max",
3482
+ thinkingLevels: ["low", "high", "max"]
3483
+ },
3484
+ {
3485
+ id: "opencode/glm-5.3",
3486
+ name: "GLM-5.3",
3487
+ provider: "opencode",
3488
+ contextWindow: 1e6,
3489
+ maxOutputTokens: 131072,
3490
+ supportsThinking: true,
3491
+ supportsImages: false,
3492
+ supportsVideo: false,
3493
+ costTier: "medium",
3494
+ maxThinkingLevel: "max",
3495
+ thinkingLevels: ["low", "high", "max"]
3496
+ },
3497
+ {
3498
+ id: "opencode/glm-5.3-flash",
3499
+ name: "GLM-5.3-Flash",
3500
+ provider: "opencode",
3501
+ contextWindow: 1e6,
3502
+ maxOutputTokens: 131072,
3503
+ supportsThinking: true,
3504
+ supportsImages: true,
3505
+ supportsVideo: false,
3506
+ costTier: "low",
3507
+ maxThinkingLevel: "max",
3508
+ thinkingLevels: ["low", "high", "max"]
3509
+ },
3351
3510
  // ── Hugging Face (Inference Providers router) ────────
3352
3511
  // One HF token (hf.co/settings/tokens, "Make calls to Inference Providers"
3353
3512
  // permission) routes to whichever hosted backend serves each open model;
@@ -3498,13 +3657,15 @@ function getVideoByteLimit(modelId) {
3498
3657
  }
3499
3658
  var DEFAULT_MODEL_IDS = {
3500
3659
  xiaomi: "mimo-v2.6-pro",
3501
- openai: "gpt-6.1-sol",
3660
+ openai: "gpt-6.2-sol",
3502
3661
  gemini: "gemini-3.1-flash-lite",
3503
3662
  glm: "glm-5.3",
3504
3663
  moonshot: "kimi-k3",
3505
3664
  minimax: "MiniMax-M3.1-Flash",
3506
3665
  deepseek: "deepseek-v4-pro",
3507
3666
  huggingface: "moonshotai/Kimi-K2.7-Code",
3667
+ opencode: "opencode/kimi-k3",
3668
+ "opencode-go": "opencode-go/kimi-k3",
3508
3669
  openrouter: "qwen/qwen3.8-max",
3509
3670
  sakana: "fugu",
3510
3671
  xai: "grok-4.7"
@@ -3656,4 +3817,4 @@ export {
3656
3817
  getDefaultThinkingLevel,
3657
3818
  getSummaryModel
3658
3819
  };
3659
- //# sourceMappingURL=chunk-G3ZS4V2K.js.map
3820
+ //# sourceMappingURL=chunk-WSFHVWQ4.js.map