@prestyj/core 5.24.0 → 5.25.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.
@@ -76,7 +76,7 @@ function isKimiCodingEndpoint(baseUrl) {
76
76
 
77
77
  // src/auth-storage.ts
78
78
  var import_promises4 = __toESM(require("fs/promises"), 1);
79
- var import_node_fs3 = require("fs");
79
+ var import_node_fs4 = require("fs");
80
80
  var import_node_crypto6 = __toESM(require("crypto"), 1);
81
81
 
82
82
  // src/oauth/anthropic.ts
@@ -84,6 +84,7 @@ var import_node_crypto3 = __toESM(require("crypto"), 1);
84
84
 
85
85
  // src/claude-code-version.ts
86
86
  var import_promises = __toESM(require("fs/promises"), 1);
87
+ var import_node_fs3 = require("fs");
87
88
  var import_node_path4 = __toESM(require("path"), 1);
88
89
 
89
90
  // src/logger.ts
@@ -95,7 +96,8 @@ var MAX_BYTES = 10 * 1024 * 1024;
95
96
  var MIN_HEADROOM_BYTES = 64 * 1024;
96
97
 
97
98
  // src/claude-code-version.ts
98
- var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
99
+ var CACHE_FRESH_MS = 60 * 60 * 1e3;
100
+ var CACHE_HARD_MS = 24 * 60 * 60 * 1e3;
99
101
 
100
102
  // src/oauth/anthropic.ts
101
103
  var CLIENT_ID = atob("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl");
@@ -163,11 +165,37 @@ var MODELS = [
163
165
  // costTier: "high",
164
166
  // maxThinkingLevel: "max",
165
167
  // },
168
+ {
169
+ // Released 2026-09-22 — "For long-running agentic coding and knowledge
170
+ // work". Fable-class capability at $4/$20 MTok (cheaper than the Opus 5 it
171
+ // replaces, $5/$25). Adaptive thinking with the full effort ladder
172
+ // (low→max, xhigh included), but thinking can no longer be disabled: a
173
+ // `thinking: {type: "disabled"}` or budget_tokens request 400s. @prestyj/ai
174
+ // omits the field entirely when thinking is off, so that path is safe.
175
+ // Forced tool use (`tool_choice` any/tool) also 400s — see
176
+ // `toAnthropicToolChoice`, which downgrades it to `auto` for this model.
177
+ // Anthropic declares the server-side default effort as `medium` (Opus 5
178
+ // ran `high`), and 5.5 thinks more per turn at a given level, so a fresh
179
+ // session starts at `medium` rather than the ladder ceiling.
180
+ id: "claude-opus-5-5",
181
+ name: "Claude Opus 5.5",
182
+ provider: "anthropic",
183
+ contextWindow: 1e6,
184
+ maxOutputTokens: 128e3,
185
+ supportsThinking: true,
186
+ defaultThinkingLevel: "medium",
187
+ supportsImages: true,
188
+ supportsVideo: false,
189
+ costTier: "high",
190
+ maxThinkingLevel: "max"
191
+ },
166
192
  {
167
193
  // Released 2026-07-24 — "For complex agentic coding and enterprise work".
168
194
  // Near-Fable capability at half the price ($5/$25 vs $10/$50). Adaptive
169
195
  // thinking with the full effort ladder (low→max, xhigh included); dateless
170
- // ID is the canonical pinned snapshot (post-4.6 naming scheme).
196
+ // ID is the canonical pinned snapshot (post-4.6 naming scheme). Kept as a
197
+ // legacy option now that Opus 5.5 leads the line: it's the last Opus that
198
+ // accepts disabled thinking and forced tool use.
171
199
  id: "claude-opus-5",
172
200
  name: "Claude Opus 5",
173
201
  provider: "anthropic",
@@ -316,16 +344,21 @@ var MODELS = [
316
344
  maxThinkingLevel: "max"
317
345
  },
318
346
  // ── xAI (Grok) ─────────────────────────────────────────
319
- // Grok 4.6 (released 2026-08-12) is xAI's flagship for coding, agentic tasks,
320
- // and knowledge work, with a focus on long-running agents — 500K context,
321
- // text+image input, and a `reasoning_effort` ladder that adds a new `xhigh`
322
- // top rung (low/medium/high default/xhigh; reasoning still can't be fully
347
+ // Grok 4.7 (released 2026-09-21) — xAI's flagship for coding, agentic tasks,
348
+ // and knowledge work: a new, larger base model with a longer RL run weighted
349
+ // toward hours-long tasks, plus stronger self-verification and long-context
350
+ // management. 500K context, text+image input, and a `reasoning_effort`
351
+ // ladder of low/medium/high default/xhigh (reasoning still can't be fully
323
352
  // disabled). $2/$6 per MTok under 200K prompt tokens ($4/$12 at or above),
324
- // and it's the default model of the Grok Build coding agent. xAI advertises "no text output limit"; we keep the same
325
- // 131K practical cap as 4.5 for budget predictability and input headroom.
326
- {
327
- id: "grok-4.6",
328
- name: "Grok 4.6",
353
+ // and it's the default model of the Grok Build coding agent. xAI advertises
354
+ // "no fixed text output limit"; we keep the 131K practical cap for budget
355
+ // predictability and input headroom. (A faster "Grok 4.7 Fast" variant
356
+ // exists but is Cursor/Grok Build-only — not on the public API — so it isn't
357
+ // registered.) Only the newest Grok ships — 4.6/4.5 are superseded and
358
+ // retired; saved sessions on them fall back to this default.
359
+ {
360
+ id: "grok-4.7",
361
+ name: "Grok 4.7",
329
362
  provider: "xai",
330
363
  contextWindow: 5e5,
331
364
  maxOutputTokens: 131072,
@@ -335,24 +368,6 @@ var MODELS = [
335
368
  costTier: "medium",
336
369
  maxThinkingLevel: "xhigh"
337
370
  },
338
- // Grok 4.5 (released 2026-07-08) — superseded by 4.6 but retained as an explicit option. 500K context, text+image input,
339
- // configurable `reasoning_effort` (low/medium/high, server default high;
340
- // reasoning can't be fully disabled). Served over the OpenAI-compatible API
341
- // at https://api.x.ai/v1 (API key from console.x.ai). xAI hasn't published an
342
- // official max-output cap for 4.5; 131K matches the Grok Responses ceiling
343
- // third-party integrations use.
344
- {
345
- id: "grok-4.5",
346
- name: "Grok 4.5",
347
- provider: "xai",
348
- contextWindow: 5e5,
349
- maxOutputTokens: 131072,
350
- supportsThinking: true,
351
- supportsImages: true,
352
- supportsVideo: false,
353
- costTier: "medium",
354
- maxThinkingLevel: "high"
355
- },
356
371
  // ── Gemini ─────────────────────────────────────────
357
372
  {
358
373
  id: "gemini-3.1-flash-lite",
@@ -541,11 +556,15 @@ var MODELS = [
541
556
  maxThinkingLevel: "high"
542
557
  },
543
558
  // ── Xiaomi (MiMo) ──────────────────────────────────────
544
- // V2.6 series (2026-09) supersedes V2.5 one-for-one: pro → pro, the omni
545
- // `mimo-v2.5` → flash, ultraspeed → ultraspeed. The whole series is now
546
- // full-modality, so unlike V2.5-Pro the flagship no longer needs a separate
547
- // omni sibling for attachments. V2.5 entries are retired here — a session
548
- // that still has one saved falls back to the provider default on next start.
559
+ // V2.6 series (released 2026-09-22, open-weight: Pro 1.02T/42B-A, Flash
560
+ // 309B/15B-A, plus a 9B Qwen distill not served over the API) supersedes V2.5
561
+ // one-for-one: pro → pro, the omni `mimo-v2.5` → flash, ultraspeed →
562
+ // ultraspeed. Every V2.6 text model is natively full-modality, so unlike
563
+ // V2.5-Pro the flagship no longer needs a separate omni sibling for
564
+ // attachments — image/video ride the same OpenAI-compatible base64 transport
565
+ // the old omni model used. API prices are unchanged from V2.5. The V2.5 ids
566
+ // deprecate on the platform 2026-10-21 and are retired here — a session that
567
+ // still has one saved falls back to the provider default on next start.
549
568
  //
550
569
  // Capabilities below are measured against the Token Plan host, not taken
551
570
  // from marketing copy: image and video both come back with `image_tokens` /
@@ -555,6 +574,8 @@ var MODELS = [
555
574
  // binary 1M below (2^20) and not the decimal 1e6 V2.5 was listed with — the
556
575
  // few-token gap is the chat envelope the server adds on top of the content.
557
576
  {
577
+ // Coding/agentic flagship — highest open-weight score on Artificial
578
+ // Analysis at launch (46, tied with Grok 4.7).
558
579
  id: "mimo-v2.6-pro",
559
580
  name: "MiMo-V2.6-Pro",
560
581
  provider: "xiaomi",
@@ -568,9 +589,10 @@ var MODELS = [
568
589
  maxThinkingLevel: "high",
569
590
  authStorageKeys: ["xiaomi", XIAOMI_CREDITS_KEY]
570
591
  },
571
- // Flash: the cheap, high-frequency sibling at the same modality surface and
572
- // window as Pro. It is the provider's `low` tier, so scout sub-agents and
573
- // compaction summaries route here instead of paying Pro rates.
592
+ // Flash: the cheap, high-frequency sibling (~10% of Pro's price class) at the
593
+ // same modality surface and window as Pro. It is the provider's `low` tier,
594
+ // so scout sub-agents and compaction summaries route here instead of paying
595
+ // Pro rates.
574
596
  {
575
597
  id: "mimo-v2.6-flash",
576
598
  name: "MiMo-V2.6-Flash",
@@ -591,9 +613,9 @@ var MODELS = [
591
613
  // authStorageKeys doc). The Token Plan host rejects it with "Not supported
592
614
  // model" — the known-model/wrong-host reply — where an invented id gets
593
615
  // "Unsupported model", which is how this id was confirmed without a
594
- // Credits key. Attachment support is inferred from the series announcement
595
- // ("full modality across the series") rather than measured: images are
596
- // enabled, video stays off until it can be verified on the platform host.
616
+ // Credits key. Attachments can't be probed directly for the same reason, so
617
+ // this entry tracks the rest of the V2.6 series ("full modality across the
618
+ // series") and mirrors Pro's verified image+video surface.
597
619
  {
598
620
  id: "mimo-v2.6-pro-ultraspeed",
599
621
  name: "MiMo-V2.6-Pro-UltraSpeed",
@@ -602,7 +624,8 @@ var MODELS = [
602
624
  maxOutputTokens: 131072,
603
625
  supportsThinking: true,
604
626
  supportsImages: true,
605
- supportsVideo: false,
627
+ supportsVideo: true,
628
+ maxVideoBytes: 36 * 1024 * 1024,
606
629
  costTier: "high",
607
630
  maxThinkingLevel: "high",
608
631
  authStorageKeys: [XIAOMI_CREDITS_KEY]
@@ -752,7 +775,7 @@ function getDefaultModel(provider) {
752
775
  return MODELS.find((m) => m.id === "Qwen/Qwen3-Coder-480B-A35B-Instruct");
753
776
  if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.6-plus");
754
777
  if (provider === "sakana") return MODELS.find((m) => m.id === "fugu");
755
- if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.6");
778
+ if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.7");
756
779
  if (provider === "local") {
757
780
  return getModelsForProvider("local")[0] ?? PLACEHOLDER_LOCAL_MODEL;
758
781
  }