@kenkaiiii/gg-core 5.97.0 → 5.98.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/{chunk-2ZTKYSSY.js → chunk-Q6ZD2VQV.js} +102 -1
- package/dist/chunk-Q6ZD2VQV.js.map +1 -0
- package/dist/index.cjs +197 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +93 -1
- package/dist/index.js.map +1 -1
- package/dist/model-registry.cjs +89 -0
- package/dist/model-registry.cjs.map +1 -1
- package/dist/model-registry.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2ZTKYSSY.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,8 @@ __export(index_exports, {
|
|
|
56
56
|
MODELS: () => MODELS,
|
|
57
57
|
NotLoggedInError: () => NotLoggedInError,
|
|
58
58
|
OPENAI_CHATGPT_KEY: () => OPENAI_CHATGPT_KEY,
|
|
59
|
+
OPENCODE_CATALOG_URLS: () => OPENCODE_CATALOG_URLS,
|
|
60
|
+
OPENCODE_PROVIDERS: () => OPENCODE_PROVIDERS,
|
|
59
61
|
OPENROUTER_DEFAULT_BASE_URL: () => OPENROUTER_DEFAULT_BASE_URL,
|
|
60
62
|
PLAN_MODE_THINKING_CAP: () => PLAN_MODE_THINKING_CAP,
|
|
61
63
|
RETIRED_SIGN_INS: () => RETIRED_SIGN_INS,
|
|
@@ -94,6 +96,7 @@ __export(index_exports, {
|
|
|
94
96
|
findProbedModel: () => findProbedModel,
|
|
95
97
|
formatClaudeCodeInstallProgress: () => formatClaudeCodeInstallProgress,
|
|
96
98
|
formatLocalModelId: () => formatLocalModelId,
|
|
99
|
+
formatOpenCodeModelId: () => formatOpenCodeModelId,
|
|
97
100
|
generatePKCE: () => generatePKCE,
|
|
98
101
|
getAllModels: () => getAllModels,
|
|
99
102
|
getAppPaths: () => getAppPaths,
|
|
@@ -137,6 +140,7 @@ __export(index_exports, {
|
|
|
137
140
|
openLog: () => openLog,
|
|
138
141
|
parseCallbackInput: () => parseCallbackInput,
|
|
139
142
|
parseLocalModelId: () => parseLocalModelId,
|
|
143
|
+
parseOpenCodeCatalog: () => parseOpenCodeCatalog,
|
|
140
144
|
parseOpenRouterCatalog: () => parseOpenRouterCatalog,
|
|
141
145
|
probeEndpoint: () => probeEndpoint,
|
|
142
146
|
providerStorageKeys: () => providerStorageKeys,
|
|
@@ -1233,6 +1237,7 @@ var import_node_path4 = __toESM(require("path"), 1);
|
|
|
1233
1237
|
var import_node_crypto3 = require("crypto");
|
|
1234
1238
|
var import_gg_ai2 = require("@kenkaiiii/gg-ai");
|
|
1235
1239
|
var MAX_BYTES = 10 * 1024 * 1024;
|
|
1240
|
+
var ROTATED_GENERATIONS = 3;
|
|
1236
1241
|
var MIN_HEADROOM_BYTES = 64 * 1024;
|
|
1237
1242
|
var fd = null;
|
|
1238
1243
|
var logPath = null;
|
|
@@ -1249,6 +1254,17 @@ function rotateIfNeeded(filePath, force = false) {
|
|
|
1249
1254
|
const st = import_node_fs3.default.statSync(filePath);
|
|
1250
1255
|
if (!force && st.size <= MAX_BYTES - MIN_HEADROOM_BYTES) return;
|
|
1251
1256
|
const rotated = `${filePath}.1`;
|
|
1257
|
+
for (let generation = ROTATED_GENERATIONS - 1; generation >= 1; generation--) {
|
|
1258
|
+
const older = `${filePath}.${generation + 1}`;
|
|
1259
|
+
try {
|
|
1260
|
+
import_node_fs3.default.unlinkSync(older);
|
|
1261
|
+
} catch {
|
|
1262
|
+
}
|
|
1263
|
+
try {
|
|
1264
|
+
import_node_fs3.default.renameSync(`${filePath}.${generation}`, older);
|
|
1265
|
+
} catch {
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1252
1268
|
try {
|
|
1253
1269
|
import_node_fs3.default.unlinkSync(rotated);
|
|
1254
1270
|
} catch {
|
|
@@ -2946,6 +2962,93 @@ var MODELS = [
|
|
|
2946
2962
|
costTier: "medium",
|
|
2947
2963
|
maxThinkingLevel: "high"
|
|
2948
2964
|
},
|
|
2965
|
+
// ── OpenCode Console (Go subscription, then pay-as-you-go) ────────
|
|
2966
|
+
// One Console API key reaches many labs' models through opencode.ai. Ids
|
|
2967
|
+
// carry the plan prefix (`opencode-go/kimi-k3`) because the gateway reuses
|
|
2968
|
+
// the vendors' own ids; gg-ai strips it at the wire. These rows are only the
|
|
2969
|
+
// offline fallback: the desktop app replaces them with each plan's live,
|
|
2970
|
+
// public model list (core/opencode-catalog-store.ts). Limits, image input
|
|
2971
|
+
// and effort ladders are from GET /inference[/go]/v1/models (2026-11-11);
|
|
2972
|
+
// all three speak Chat Completions natively.
|
|
2973
|
+
{
|
|
2974
|
+
// Go declares `max` as K3's only effort; pay-as-you-go adds low and high.
|
|
2975
|
+
id: "opencode-go/kimi-k3",
|
|
2976
|
+
name: "Kimi K3",
|
|
2977
|
+
provider: "opencode-go",
|
|
2978
|
+
contextWindow: 1048576,
|
|
2979
|
+
maxOutputTokens: 131072,
|
|
2980
|
+
supportsThinking: true,
|
|
2981
|
+
supportsImages: true,
|
|
2982
|
+
supportsVideo: false,
|
|
2983
|
+
costTier: "high",
|
|
2984
|
+
maxThinkingLevel: "max",
|
|
2985
|
+
thinkingLevels: ["max"]
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
id: "opencode-go/glm-5.3",
|
|
2989
|
+
name: "GLM-5.3",
|
|
2990
|
+
provider: "opencode-go",
|
|
2991
|
+
contextWindow: 1e6,
|
|
2992
|
+
maxOutputTokens: 131072,
|
|
2993
|
+
supportsThinking: true,
|
|
2994
|
+
supportsImages: false,
|
|
2995
|
+
supportsVideo: false,
|
|
2996
|
+
costTier: "medium",
|
|
2997
|
+
maxThinkingLevel: "max",
|
|
2998
|
+
thinkingLevels: ["low", "high", "max"]
|
|
2999
|
+
},
|
|
3000
|
+
{
|
|
3001
|
+
id: "opencode-go/glm-5.3-flash",
|
|
3002
|
+
name: "GLM-5.3-Flash",
|
|
3003
|
+
provider: "opencode-go",
|
|
3004
|
+
contextWindow: 1e6,
|
|
3005
|
+
maxOutputTokens: 131072,
|
|
3006
|
+
supportsThinking: true,
|
|
3007
|
+
supportsImages: true,
|
|
3008
|
+
supportsVideo: false,
|
|
3009
|
+
costTier: "low",
|
|
3010
|
+
maxThinkingLevel: "max",
|
|
3011
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3012
|
+
},
|
|
3013
|
+
{
|
|
3014
|
+
id: "opencode/kimi-k3",
|
|
3015
|
+
name: "Kimi K3",
|
|
3016
|
+
provider: "opencode",
|
|
3017
|
+
contextWindow: 1048576,
|
|
3018
|
+
maxOutputTokens: 131072,
|
|
3019
|
+
supportsThinking: true,
|
|
3020
|
+
supportsImages: true,
|
|
3021
|
+
supportsVideo: false,
|
|
3022
|
+
costTier: "high",
|
|
3023
|
+
maxThinkingLevel: "max",
|
|
3024
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3025
|
+
},
|
|
3026
|
+
{
|
|
3027
|
+
id: "opencode/glm-5.3",
|
|
3028
|
+
name: "GLM-5.3",
|
|
3029
|
+
provider: "opencode",
|
|
3030
|
+
contextWindow: 1e6,
|
|
3031
|
+
maxOutputTokens: 131072,
|
|
3032
|
+
supportsThinking: true,
|
|
3033
|
+
supportsImages: false,
|
|
3034
|
+
supportsVideo: false,
|
|
3035
|
+
costTier: "medium",
|
|
3036
|
+
maxThinkingLevel: "max",
|
|
3037
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3038
|
+
},
|
|
3039
|
+
{
|
|
3040
|
+
id: "opencode/glm-5.3-flash",
|
|
3041
|
+
name: "GLM-5.3-Flash",
|
|
3042
|
+
provider: "opencode",
|
|
3043
|
+
contextWindow: 1e6,
|
|
3044
|
+
maxOutputTokens: 131072,
|
|
3045
|
+
supportsThinking: true,
|
|
3046
|
+
supportsImages: true,
|
|
3047
|
+
supportsVideo: false,
|
|
3048
|
+
costTier: "low",
|
|
3049
|
+
maxThinkingLevel: "max",
|
|
3050
|
+
thinkingLevels: ["low", "high", "max"]
|
|
3051
|
+
},
|
|
2949
3052
|
// ── Hugging Face (Inference Providers router) ────────
|
|
2950
3053
|
// One HF token (hf.co/settings/tokens, "Make calls to Inference Providers"
|
|
2951
3054
|
// permission) routes to whichever hosted backend serves each open model;
|
|
@@ -3103,6 +3206,8 @@ var DEFAULT_MODEL_IDS = {
|
|
|
3103
3206
|
minimax: "MiniMax-M3.1-Flash",
|
|
3104
3207
|
deepseek: "deepseek-v4-pro",
|
|
3105
3208
|
huggingface: "moonshotai/Kimi-K2.7-Code",
|
|
3209
|
+
opencode: "opencode/kimi-k3",
|
|
3210
|
+
"opencode-go": "opencode-go/kimi-k3",
|
|
3106
3211
|
openrouter: "qwen/qwen3.8-max",
|
|
3107
3212
|
sakana: "fugu",
|
|
3108
3213
|
xai: "grok-4.7"
|
|
@@ -3219,6 +3324,70 @@ function parseOpenRouterCatalog(body) {
|
|
|
3219
3324
|
return { models, skipped };
|
|
3220
3325
|
}
|
|
3221
3326
|
|
|
3327
|
+
// src/opencode-catalog.ts
|
|
3328
|
+
var OPENCODE_PROVIDERS = ["opencode-go", "opencode"];
|
|
3329
|
+
var OPENCODE_CATALOG_URLS = {
|
|
3330
|
+
opencode: "https://opencode.ai/inference/v1/models",
|
|
3331
|
+
"opencode-go": "https://opencode.ai/inference/go/v1/models"
|
|
3332
|
+
};
|
|
3333
|
+
var EFFORT_LADDER2 = ["low", "medium", "high", "xhigh", "max"];
|
|
3334
|
+
function positiveInt2(value) {
|
|
3335
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
3336
|
+
}
|
|
3337
|
+
function strings2(value) {
|
|
3338
|
+
return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
|
|
3339
|
+
}
|
|
3340
|
+
function costTier2(price) {
|
|
3341
|
+
if (typeof price !== "number" || !Number.isFinite(price) || price < 0.5) return "low";
|
|
3342
|
+
return price < 3 ? "medium" : "high";
|
|
3343
|
+
}
|
|
3344
|
+
function formatOpenCodeModelId(provider, rawId) {
|
|
3345
|
+
return `${provider}/${rawId}`;
|
|
3346
|
+
}
|
|
3347
|
+
function parseOpenCodeCatalog(provider, body) {
|
|
3348
|
+
const data = body?.data;
|
|
3349
|
+
if (!Array.isArray(data)) return { models: [], skipped: 0 };
|
|
3350
|
+
const models = [];
|
|
3351
|
+
let skipped = 0;
|
|
3352
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3353
|
+
for (const raw of data) {
|
|
3354
|
+
const rawId = typeof raw?.id === "string" ? raw.id.trim() : "";
|
|
3355
|
+
const contextWindow = positiveInt2(raw?.limit?.context);
|
|
3356
|
+
const price = raw?.cost?.text?.input?.price;
|
|
3357
|
+
if (!/^[\w.:-]+$/.test(rawId) || seen.has(rawId) || raw.type !== "chat" || !raw.api?.["chat-completions"] || raw.capabilities?.tools?.supported !== true || !contextWindow || provider === "opencode" && price === 0) {
|
|
3358
|
+
skipped++;
|
|
3359
|
+
continue;
|
|
3360
|
+
}
|
|
3361
|
+
seen.add(rawId);
|
|
3362
|
+
const reasoning = raw.capabilities.reasoning;
|
|
3363
|
+
const efforts = strings2(reasoning?.effort);
|
|
3364
|
+
const ladder = EFFORT_LADDER2.filter((rung) => efforts.includes(rung));
|
|
3365
|
+
const defaultEffort = reasoning?.default?.type === "effort" ? reasoning.default.value : null;
|
|
3366
|
+
const maxOutput = Math.min(
|
|
3367
|
+
positiveInt2(raw.limit?.output) ?? 16384,
|
|
3368
|
+
Math.floor(contextWindow / 2)
|
|
3369
|
+
);
|
|
3370
|
+
models.push({
|
|
3371
|
+
id: formatOpenCodeModelId(provider, rawId),
|
|
3372
|
+
name: typeof raw.name === "string" && raw.name.trim() ? raw.name.trim() : rawId,
|
|
3373
|
+
provider,
|
|
3374
|
+
contextWindow,
|
|
3375
|
+
maxOutputTokens: Math.max(1, maxOutput),
|
|
3376
|
+
// Only a declared effort ladder counts: a model without one is never sent
|
|
3377
|
+
// a reasoning_effort it might reject.
|
|
3378
|
+
supportsThinking: ladder.length > 0,
|
|
3379
|
+
supportsImages: strings2(raw.modalities?.input).some((m) => m.startsWith("image")),
|
|
3380
|
+
// Video needs a per-transport payload cap the catalog doesn't publish.
|
|
3381
|
+
supportsVideo: false,
|
|
3382
|
+
costTier: costTier2(price),
|
|
3383
|
+
maxThinkingLevel: ladder[ladder.length - 1] ?? "low",
|
|
3384
|
+
...ladder.length > 0 ? { thinkingLevels: ladder } : {},
|
|
3385
|
+
...typeof defaultEffort === "string" && ladder.includes(defaultEffort) ? { defaultThinkingLevel: defaultEffort } : {}
|
|
3386
|
+
});
|
|
3387
|
+
}
|
|
3388
|
+
return { models, skipped };
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3222
3391
|
// src/thinking-level.ts
|
|
3223
3392
|
var OPENAI_GPT_THINKING_LEVELS = ["medium", "high", "xhigh"];
|
|
3224
3393
|
var OPENAI_GPT_56_THINKING_LEVELS = [
|
|
@@ -3957,6 +4126,30 @@ var ALL_AUTH_PROVIDERS = [
|
|
|
3957
4126
|
apiKeyLabel: "Sakana",
|
|
3958
4127
|
methodDetails: apiKeyDetails("Sakana API key", "Pay-per-token from your Sakana API account.")
|
|
3959
4128
|
},
|
|
4129
|
+
{
|
|
4130
|
+
value: "opencode-go",
|
|
4131
|
+
label: "OpenCode Go",
|
|
4132
|
+
description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more Go models",
|
|
4133
|
+
methods: ["apikey"],
|
|
4134
|
+
apiKeyLabel: "OpenCode",
|
|
4135
|
+
methodDetails: apiKeyDetails(
|
|
4136
|
+
"OpenCode API key",
|
|
4137
|
+
"Uses your OpenCode Go subscription.",
|
|
4138
|
+
"Create a personal API key in the OpenCode Console, in a workspace subscribed to Go."
|
|
4139
|
+
)
|
|
4140
|
+
},
|
|
4141
|
+
{
|
|
4142
|
+
value: "opencode",
|
|
4143
|
+
label: "OpenCode",
|
|
4144
|
+
description: "Kimi K3, GLM-5.3, GLM-5.3-Flash and more paid Console models",
|
|
4145
|
+
methods: ["apikey"],
|
|
4146
|
+
apiKeyLabel: "OpenCode",
|
|
4147
|
+
methodDetails: apiKeyDetails(
|
|
4148
|
+
"OpenCode API key",
|
|
4149
|
+
"Pay-per-token from your OpenCode Console credits.",
|
|
4150
|
+
"Free-tier models only run inside OpenCode, so they are not listed here."
|
|
4151
|
+
)
|
|
4152
|
+
},
|
|
3960
4153
|
{
|
|
3961
4154
|
value: "openrouter",
|
|
3962
4155
|
label: "OpenRouter",
|
|
@@ -4686,6 +4879,8 @@ function createAutoUpdater(config) {
|
|
|
4686
4879
|
MODELS,
|
|
4687
4880
|
NotLoggedInError,
|
|
4688
4881
|
OPENAI_CHATGPT_KEY,
|
|
4882
|
+
OPENCODE_CATALOG_URLS,
|
|
4883
|
+
OPENCODE_PROVIDERS,
|
|
4689
4884
|
OPENROUTER_DEFAULT_BASE_URL,
|
|
4690
4885
|
PLAN_MODE_THINKING_CAP,
|
|
4691
4886
|
RETIRED_SIGN_INS,
|
|
@@ -4724,6 +4919,7 @@ function createAutoUpdater(config) {
|
|
|
4724
4919
|
findProbedModel,
|
|
4725
4920
|
formatClaudeCodeInstallProgress,
|
|
4726
4921
|
formatLocalModelId,
|
|
4922
|
+
formatOpenCodeModelId,
|
|
4727
4923
|
generatePKCE,
|
|
4728
4924
|
getAllModels,
|
|
4729
4925
|
getAppPaths,
|
|
@@ -4767,6 +4963,7 @@ function createAutoUpdater(config) {
|
|
|
4767
4963
|
openLog,
|
|
4768
4964
|
parseCallbackInput,
|
|
4769
4965
|
parseLocalModelId,
|
|
4966
|
+
parseOpenCodeCatalog,
|
|
4770
4967
|
parseOpenRouterCatalog,
|
|
4771
4968
|
probeEndpoint,
|
|
4772
4969
|
providerStorageKeys,
|