@prestyj/core 5.33.0 → 5.34.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",
@@ -3348,6 +3356,93 @@ var MODELS = [
3348
3356
  costTier: "medium",
3349
3357
  maxThinkingLevel: "high"
3350
3358
  },
3359
+ // ── OpenCode Console (Go subscription, then pay-as-you-go) ────────
3360
+ // One Console API key reaches many labs' models through opencode.ai. Ids
3361
+ // carry the plan prefix (`opencode-go/kimi-k3`) because the gateway reuses
3362
+ // the vendors' own ids; @prestyj/ai strips it at the wire. These rows are only the
3363
+ // offline fallback: the desktop app replaces them with each plan's live,
3364
+ // public model list (core/opencode-catalog-store.ts). Limits, image input
3365
+ // and effort ladders are from GET /inference[/go]/v1/models (2026-11-11);
3366
+ // all three speak Chat Completions natively.
3367
+ {
3368
+ // Go declares `max` as K3's only effort; pay-as-you-go adds low and high.
3369
+ id: "opencode-go/kimi-k3",
3370
+ name: "Kimi K3",
3371
+ provider: "opencode-go",
3372
+ contextWindow: 1048576,
3373
+ maxOutputTokens: 131072,
3374
+ supportsThinking: true,
3375
+ supportsImages: true,
3376
+ supportsVideo: false,
3377
+ costTier: "high",
3378
+ maxThinkingLevel: "max",
3379
+ thinkingLevels: ["max"]
3380
+ },
3381
+ {
3382
+ id: "opencode-go/glm-5.3",
3383
+ name: "GLM-5.3",
3384
+ provider: "opencode-go",
3385
+ contextWindow: 1e6,
3386
+ maxOutputTokens: 131072,
3387
+ supportsThinking: true,
3388
+ supportsImages: false,
3389
+ supportsVideo: false,
3390
+ costTier: "medium",
3391
+ maxThinkingLevel: "max",
3392
+ thinkingLevels: ["low", "high", "max"]
3393
+ },
3394
+ {
3395
+ id: "opencode-go/glm-5.3-flash",
3396
+ name: "GLM-5.3-Flash",
3397
+ provider: "opencode-go",
3398
+ contextWindow: 1e6,
3399
+ maxOutputTokens: 131072,
3400
+ supportsThinking: true,
3401
+ supportsImages: true,
3402
+ supportsVideo: false,
3403
+ costTier: "low",
3404
+ maxThinkingLevel: "max",
3405
+ thinkingLevels: ["low", "high", "max"]
3406
+ },
3407
+ {
3408
+ id: "opencode/kimi-k3",
3409
+ name: "Kimi K3",
3410
+ provider: "opencode",
3411
+ contextWindow: 1048576,
3412
+ maxOutputTokens: 131072,
3413
+ supportsThinking: true,
3414
+ supportsImages: true,
3415
+ supportsVideo: false,
3416
+ costTier: "high",
3417
+ maxThinkingLevel: "max",
3418
+ thinkingLevels: ["low", "high", "max"]
3419
+ },
3420
+ {
3421
+ id: "opencode/glm-5.3",
3422
+ name: "GLM-5.3",
3423
+ provider: "opencode",
3424
+ contextWindow: 1e6,
3425
+ maxOutputTokens: 131072,
3426
+ supportsThinking: true,
3427
+ supportsImages: false,
3428
+ supportsVideo: false,
3429
+ costTier: "medium",
3430
+ maxThinkingLevel: "max",
3431
+ thinkingLevels: ["low", "high", "max"]
3432
+ },
3433
+ {
3434
+ id: "opencode/glm-5.3-flash",
3435
+ name: "GLM-5.3-Flash",
3436
+ provider: "opencode",
3437
+ contextWindow: 1e6,
3438
+ maxOutputTokens: 131072,
3439
+ supportsThinking: true,
3440
+ supportsImages: true,
3441
+ supportsVideo: false,
3442
+ costTier: "low",
3443
+ maxThinkingLevel: "max",
3444
+ thinkingLevels: ["low", "high", "max"]
3445
+ },
3351
3446
  // ── Hugging Face (Inference Providers router) ────────
3352
3447
  // One HF token (hf.co/settings/tokens, "Make calls to Inference Providers"
3353
3448
  // permission) routes to whichever hosted backend serves each open model;
@@ -3498,13 +3593,15 @@ function getVideoByteLimit(modelId) {
3498
3593
  }
3499
3594
  var DEFAULT_MODEL_IDS = {
3500
3595
  xiaomi: "mimo-v2.6-pro",
3501
- openai: "gpt-6.1-sol",
3596
+ openai: "gpt-6.2-sol",
3502
3597
  gemini: "gemini-3.1-flash-lite",
3503
3598
  glm: "glm-5.3",
3504
3599
  moonshot: "kimi-k3",
3505
3600
  minimax: "MiniMax-M3.1-Flash",
3506
3601
  deepseek: "deepseek-v4-pro",
3507
3602
  huggingface: "moonshotai/Kimi-K2.7-Code",
3603
+ opencode: "opencode/kimi-k3",
3604
+ "opencode-go": "opencode-go/kimi-k3",
3508
3605
  openrouter: "qwen/qwen3.8-max",
3509
3606
  sakana: "fugu",
3510
3607
  xai: "grok-4.7"
@@ -3656,4 +3753,4 @@ export {
3656
3753
  getDefaultThinkingLevel,
3657
3754
  getSummaryModel
3658
3755
  };
3659
- //# sourceMappingURL=chunk-G3ZS4V2K.js.map
3756
+ //# sourceMappingURL=chunk-7IHCMEIY.js.map