@prestyj/core 5.30.0 → 5.30.2
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/README.md +68 -0
- package/dist/{chunk-43OF6BOE.js → chunk-724LOLDH.js} +91 -32
- package/dist/{chunk-43OF6BOE.js.map → chunk-724LOLDH.js.map} +1 -1
- package/dist/index.cjs +92 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +91 -32
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.d.cts +3 -3
- package/dist/model-registry.d.ts +3 -3
- package/dist/model-registry.js +1 -1
- package/package.json +5 -2
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @prestyj/core
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Model registry, auth storage and local-model discovery. No UI, no agent loop.</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@prestyj/core"><img src="https://img.shields.io/npm/v/@prestyj/core?style=for-the-badge" alt="npm version"></a>
|
|
9
|
+
<a href="../../LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="MIT License"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
The shared foundation under EZ Coder's app and CLI. It depends only on [`@prestyj/ai`](../@prestyj/ai/README.md), never on React, Ink or the agent loop.
|
|
13
|
+
|
|
14
|
+
Part of the [EZCoder Framework](../../README.md) monorepo.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i @prestyj/core
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## What's inside
|
|
27
|
+
|
|
28
|
+
| Area | Main exports |
|
|
29
|
+
|---|---|
|
|
30
|
+
| Model registry | `getModel`, `getAllModels`, `getModelsForProvider`, `getDefaultModel`, `getContextWindow` |
|
|
31
|
+
| Thinking levels | `getSupportedThinkingLevels`, `getMaxThinkingLevel`, `getDefaultThinkingLevel` |
|
|
32
|
+
| Auth storage | `AuthStorage` (reads and writes `~/.ezcoder/auth.json`, refreshes OAuth tokens) |
|
|
33
|
+
| OAuth | Anthropic, OpenAI, Gemini, Kimi and xAI login flows |
|
|
34
|
+
| Local models | `discoverLocalModels` (Ollama, LM Studio, llama.cpp, vLLM, custom endpoints) |
|
|
35
|
+
| Paths | `getAppPaths` (every file under `~/.ezcoder/`) |
|
|
36
|
+
| Other | Logger, file lock, usage limits, Telegram, voice transcription, auto-update |
|
|
37
|
+
|
|
38
|
+
Two lighter subpath entries skip the rest of the package:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { getModel } from "@prestyj/core/models";
|
|
42
|
+
import { getAppPaths } from "@prestyj/core/paths";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Example
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { AuthStorage, discoverLocalModels, getModel } from "@prestyj/core";
|
|
51
|
+
|
|
52
|
+
const model = getModel("claude-sonnet-5-5");
|
|
53
|
+
console.log(model?.contextWindow);
|
|
54
|
+
|
|
55
|
+
const auth = new AuthStorage();
|
|
56
|
+
const token = await auth.resolveToken("anthropic");
|
|
57
|
+
|
|
58
|
+
const { models } = await discoverLocalModels();
|
|
59
|
+
console.log(models.map((m) => m.id));
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`AuthStorage` throws `NotLoggedInError` when a provider has no stored credentials.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|
|
@@ -2012,9 +2012,10 @@ var NotLoggedInError = class extends Error {
|
|
|
2012
2012
|
// src/model-registry.ts
|
|
2013
2013
|
var MODELS = [
|
|
2014
2014
|
// ── Anthropic ──────────────────────────────────────────
|
|
2015
|
-
// NOTE: Claude Mythos 5 (`claude-mythos-5
|
|
2016
|
-
// Project Glasswing
|
|
2017
|
-
// users. Re-enable once it's
|
|
2015
|
+
// NOTE: Claude Mythos 5.1 (`claude-mythos-5-1`, 2026-09-01) is kept commented
|
|
2016
|
+
// out — it's a Project Glasswing model, still "Active (invite only)" in
|
|
2017
|
+
// Anthropic's docs and unavailable to most users. Re-enable once it's
|
|
2018
|
+
// generally available.
|
|
2018
2019
|
{
|
|
2019
2020
|
// Released 2026-09-01 — replaces Fable 5 at the same $10/$50 MTok (cache
|
|
2020
2021
|
// reads drop to $0.25). Always-on adaptive thinking steered by effort;
|
|
@@ -2036,8 +2037,8 @@ var MODELS = [
|
|
|
2036
2037
|
// // Mythos-class model offered through Project Glasswing (limited
|
|
2037
2038
|
// // availability, invitation-only). Same underlying model as Fable 5.1 with
|
|
2038
2039
|
// // some safeguards lifted; kept here so approved accounts can select it.
|
|
2039
|
-
// id: "claude-mythos-5",
|
|
2040
|
-
// name: "Claude Mythos 5",
|
|
2040
|
+
// id: "claude-mythos-5-1",
|
|
2041
|
+
// name: "Claude Mythos 5.1",
|
|
2041
2042
|
// provider: "anthropic",
|
|
2042
2043
|
// contextWindow: 1_000_000,
|
|
2043
2044
|
// maxOutputTokens: 128_000,
|
|
@@ -2104,16 +2105,24 @@ var MODELS = [
|
|
|
2104
2105
|
maxThinkingLevel: "max"
|
|
2105
2106
|
},
|
|
2106
2107
|
{
|
|
2107
|
-
|
|
2108
|
-
|
|
2108
|
+
// Released 2026-10-07 — replaces Haiku 4.5 at $0.10/$0.50 MTok (prompts
|
|
2109
|
+
// up to 100K tokens; $0.50/$2.50 above). 1M context, 128K output, image
|
|
2110
|
+
// input. Adaptive thinking with the full effort ladder (low→max, xhigh
|
|
2111
|
+
// included; API default `medium`) — manual budget_tokens, non-default
|
|
2112
|
+
// sampling params and assistant prefill all 400. No server-side refusal
|
|
2113
|
+
// fallback: `fallbacks: "default"` is accepted but a refusal stays a
|
|
2114
|
+
// refusal. Haiku 4.5 is retired here — a session that still has it saved
|
|
2115
|
+
// falls back to the provider default on next start.
|
|
2116
|
+
id: "claude-haiku-5-5",
|
|
2117
|
+
name: "Claude Haiku 5.5",
|
|
2109
2118
|
provider: "anthropic",
|
|
2110
|
-
contextWindow:
|
|
2111
|
-
maxOutputTokens:
|
|
2119
|
+
contextWindow: 1e6,
|
|
2120
|
+
maxOutputTokens: 128e3,
|
|
2112
2121
|
supportsThinking: true,
|
|
2113
2122
|
supportsImages: true,
|
|
2114
2123
|
supportsVideo: false,
|
|
2115
2124
|
costTier: "low",
|
|
2116
|
-
maxThinkingLevel: "
|
|
2125
|
+
maxThinkingLevel: "max"
|
|
2117
2126
|
},
|
|
2118
2127
|
// ── OpenAI (Codex) ─────────────────────────────────────
|
|
2119
2128
|
{
|
|
@@ -2403,6 +2412,25 @@ var MODELS = [
|
|
|
2403
2412
|
costTier: "medium",
|
|
2404
2413
|
maxThinkingLevel: "high"
|
|
2405
2414
|
},
|
|
2415
|
+
// K2.7 Code HighSpeed — the same model as K2.7 Code served at ~180 tok/s
|
|
2416
|
+
// (up to ~260 on short contexts), 256K context (platform.kimi.ai model list,
|
|
2417
|
+
// 2026-10-08). The `kimi-k2.7-code` prefix gives it K2.7's always-thinking
|
|
2418
|
+
// wire handling in @prestyj/ai. The Kimi For Coding endpoint lists this model as
|
|
2419
|
+
// `kimi-for-coding-highspeed`; like `kimi-k2.7-code` and `kimi-k3`, we send
|
|
2420
|
+
// the public id there too.
|
|
2421
|
+
{
|
|
2422
|
+
id: "kimi-k2.7-code-highspeed",
|
|
2423
|
+
name: "Kimi K2.7 Code HighSpeed",
|
|
2424
|
+
provider: "moonshot",
|
|
2425
|
+
contextWindow: 262144,
|
|
2426
|
+
maxOutputTokens: 262144,
|
|
2427
|
+
supportsThinking: true,
|
|
2428
|
+
supportsImages: true,
|
|
2429
|
+
supportsVideo: true,
|
|
2430
|
+
maxVideoBytes: 100 * 1024 * 1024,
|
|
2431
|
+
costTier: "medium",
|
|
2432
|
+
maxThinkingLevel: "high"
|
|
2433
|
+
},
|
|
2406
2434
|
// ── Z.AI (GLM) ─────────────────────────────────────────
|
|
2407
2435
|
// Two GLM entries, both live on the coding endpoint (verified against its
|
|
2408
2436
|
// /models list). The pre-5.3 ids stay retired: they routed to strictly worse
|
|
@@ -2594,23 +2622,47 @@ var MODELS = [
|
|
|
2594
2622
|
// billing follows each backend's rates on the HF account (small free tier).
|
|
2595
2623
|
// Model ids are Hub repo paths, so they intentionally contain a slash — the
|
|
2596
2624
|
// same shape local/ vLLM ids already use (`local/vllm/Qwen/Qwen3-32B`).
|
|
2625
|
+
// Live GET /v1/models (2026-10-08) is the source for hosts, context and
|
|
2626
|
+
// modalities. Qwen3 Coder 480B is retired here: only one tool-calling host
|
|
2627
|
+
// (Novita) still served it. We keep bare repo ids (no :auto suffix) so the
|
|
2628
|
+
// picker matches what GET /v1/models reports.
|
|
2597
2629
|
{
|
|
2598
|
-
//
|
|
2599
|
-
//
|
|
2600
|
-
//
|
|
2601
|
-
//
|
|
2602
|
-
//
|
|
2603
|
-
|
|
2604
|
-
|
|
2630
|
+
// Moonshot's open coding model. Served with tool calling by Novita and
|
|
2631
|
+
// DeepInfra at 262K context, with image input (video is a Moonshot-API-only
|
|
2632
|
+
// upload path). It always thinks, but the router has no documented effort
|
|
2633
|
+
// control for it, so we register it as non-thinking: we never send a
|
|
2634
|
+
// reasoning_effort that a host might reject. Output is capped at half the
|
|
2635
|
+
// window so the input keeps room.
|
|
2636
|
+
id: "moonshotai/Kimi-K2.7-Code",
|
|
2637
|
+
name: "Kimi K2.7 Code",
|
|
2605
2638
|
provider: "huggingface",
|
|
2606
2639
|
contextWindow: 262144,
|
|
2607
2640
|
maxOutputTokens: 131072,
|
|
2608
2641
|
supportsThinking: false,
|
|
2609
|
-
supportsImages:
|
|
2642
|
+
supportsImages: true,
|
|
2610
2643
|
supportsVideo: false,
|
|
2611
2644
|
costTier: "medium",
|
|
2612
2645
|
maxThinkingLevel: "low"
|
|
2613
2646
|
},
|
|
2647
|
+
{
|
|
2648
|
+
// DeepSeek V4.1 Flash open weights: 1M context and image input on four
|
|
2649
|
+
// tool-calling hosts (Novita, Fireworks, Baseten, DeepInfra; $0.20–0.30 in /
|
|
2650
|
+
// $0.60–1.20 out per MTok). It is listed before gpt-oss so it becomes the
|
|
2651
|
+
// low-tier summary model, because its 1M window can take a full long
|
|
2652
|
+
// session. Thinking control over the router is unverified, so it is
|
|
2653
|
+
// registered as non-thinking. Output is a conservative 131K: hosts don't
|
|
2654
|
+
// publish the 384K first-party cap.
|
|
2655
|
+
id: "deepseek-ai/DeepSeek-V4.1-Flash",
|
|
2656
|
+
name: "DeepSeek V4.1 Flash",
|
|
2657
|
+
provider: "huggingface",
|
|
2658
|
+
contextWindow: 1048576,
|
|
2659
|
+
maxOutputTokens: 131072,
|
|
2660
|
+
supportsThinking: false,
|
|
2661
|
+
supportsImages: true,
|
|
2662
|
+
supportsVideo: false,
|
|
2663
|
+
costTier: "low",
|
|
2664
|
+
maxThinkingLevel: "low"
|
|
2665
|
+
},
|
|
2614
2666
|
{
|
|
2615
2667
|
// OpenAI's open-weight 120B MoE (5.1B active) — general-purpose, tool-calling
|
|
2616
2668
|
// native, adjustable reasoning effort (low/medium/high, default medium) over
|
|
@@ -2663,23 +2715,30 @@ function getVideoByteLimit(modelId) {
|
|
|
2663
2715
|
if (!model?.supportsVideo) return void 0;
|
|
2664
2716
|
return model.maxVideoBytes ?? DEFAULT_MAX_VIDEO_BYTES;
|
|
2665
2717
|
}
|
|
2718
|
+
var DEFAULT_MODEL_IDS = {
|
|
2719
|
+
xiaomi: "mimo-v2.6-pro",
|
|
2720
|
+
openai: "gpt-6.1-sol",
|
|
2721
|
+
gemini: "gemini-3.1-flash-lite",
|
|
2722
|
+
glm: "glm-5.3",
|
|
2723
|
+
moonshot: "kimi-k3",
|
|
2724
|
+
minimax: "MiniMax-M3",
|
|
2725
|
+
deepseek: "deepseek-v4-pro",
|
|
2726
|
+
huggingface: "moonshotai/Kimi-K2.7-Code",
|
|
2727
|
+
openrouter: "qwen/qwen3.8-max",
|
|
2728
|
+
sakana: "fugu",
|
|
2729
|
+
xai: "grok-4.7"
|
|
2730
|
+
};
|
|
2731
|
+
var FALLBACK_DEFAULT_MODEL_ID = "claude-sonnet-5-5";
|
|
2732
|
+
function registeredModel(id) {
|
|
2733
|
+
const model = MODELS.find((m) => m.id === id);
|
|
2734
|
+
if (!model) throw new Error(`Default model "${id}" is not in the model registry`);
|
|
2735
|
+
return model;
|
|
2736
|
+
}
|
|
2666
2737
|
function getDefaultModel(provider) {
|
|
2667
|
-
if (provider === "xiaomi") return MODELS.find((m) => m.id === "mimo-v2.6-pro");
|
|
2668
|
-
if (provider === "openai") return MODELS.find((m) => m.id === "gpt-6.1-sol");
|
|
2669
|
-
if (provider === "gemini") return MODELS.find((m) => m.id === "gemini-3.1-flash-lite");
|
|
2670
|
-
if (provider === "glm") return MODELS.find((m) => m.id === "glm-5.3");
|
|
2671
|
-
if (provider === "moonshot") return MODELS.find((m) => m.id === "kimi-k3");
|
|
2672
|
-
if (provider === "minimax") return MODELS.find((m) => m.id === "MiniMax-M3");
|
|
2673
|
-
if (provider === "deepseek") return MODELS.find((m) => m.id === "deepseek-v4-pro");
|
|
2674
|
-
if (provider === "huggingface")
|
|
2675
|
-
return MODELS.find((m) => m.id === "Qwen/Qwen3-Coder-480B-A35B-Instruct");
|
|
2676
|
-
if (provider === "openrouter") return MODELS.find((m) => m.id === "qwen/qwen3.8-max");
|
|
2677
|
-
if (provider === "sakana") return MODELS.find((m) => m.id === "fugu");
|
|
2678
|
-
if (provider === "xai") return MODELS.find((m) => m.id === "grok-4.7");
|
|
2679
2738
|
if (provider === "local") {
|
|
2680
2739
|
return getModelsForProvider("local")[0] ?? PLACEHOLDER_LOCAL_MODEL;
|
|
2681
2740
|
}
|
|
2682
|
-
return
|
|
2741
|
+
return registeredModel(DEFAULT_MODEL_IDS[provider] ?? FALLBACK_DEFAULT_MODEL_ID);
|
|
2683
2742
|
}
|
|
2684
2743
|
var PLACEHOLDER_LOCAL_MODEL = {
|
|
2685
2744
|
id: "local/none/none",
|
|
@@ -2786,4 +2845,4 @@ export {
|
|
|
2786
2845
|
getDefaultThinkingLevel,
|
|
2787
2846
|
getSummaryModel
|
|
2788
2847
|
};
|
|
2789
|
-
//# sourceMappingURL=chunk-
|
|
2848
|
+
//# sourceMappingURL=chunk-724LOLDH.js.map
|