claudish 5.15.0 → 5.16.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/index.js +796 -470
- package/package.json +1 -1
- package/recommended-models.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29162,6 +29162,7 @@ __export(exports_logger, {
|
|
|
29162
29162
|
structuralRedact: () => structuralRedact,
|
|
29163
29163
|
setStderrQuiet: () => setStderrQuiet,
|
|
29164
29164
|
setLogLevel: () => setLogLevel,
|
|
29165
|
+
setDiagOutput: () => setDiagOutput,
|
|
29165
29166
|
maskCredential: () => maskCredential,
|
|
29166
29167
|
logStructured: () => logStructured,
|
|
29167
29168
|
logStderr: () => logStderr,
|
|
@@ -29329,12 +29330,17 @@ function log(message, forceConsole = false) {
|
|
|
29329
29330
|
}
|
|
29330
29331
|
}
|
|
29331
29332
|
function logStderr(message) {
|
|
29332
|
-
if (
|
|
29333
|
+
if (diagOutput) {
|
|
29334
|
+
diagOutput.write(message);
|
|
29335
|
+
} else if (!stderrQuiet) {
|
|
29333
29336
|
process.stderr.write(`[claudish] ${message}
|
|
29334
29337
|
`);
|
|
29335
29338
|
}
|
|
29336
29339
|
log(message);
|
|
29337
29340
|
}
|
|
29341
|
+
function setDiagOutput(output) {
|
|
29342
|
+
diagOutput = output;
|
|
29343
|
+
}
|
|
29338
29344
|
function setStderrQuiet(quiet) {
|
|
29339
29345
|
stderrQuiet = quiet;
|
|
29340
29346
|
}
|
|
@@ -29392,7 +29398,7 @@ function logStructured(label, data) {
|
|
|
29392
29398
|
}
|
|
29393
29399
|
log(`[${label}] ${JSON.stringify(data, null, 2)}`);
|
|
29394
29400
|
}
|
|
29395
|
-
var logFilePath = null, logLevel = "info", stderrQuiet = false, logBuffer, flushTimer = null, FLUSH_INTERVAL_MS = 100, MAX_BUFFER_SIZE = 50, alwaysOnLogPath = null, alwaysOnBuffer, CONTENT_KEYS;
|
|
29401
|
+
var logFilePath = null, logLevel = "info", stderrQuiet = false, diagOutput = null, logBuffer, flushTimer = null, FLUSH_INTERVAL_MS = 100, MAX_BUFFER_SIZE = 50, alwaysOnLogPath = null, alwaysOnBuffer, CONTENT_KEYS;
|
|
29396
29402
|
var init_logger = __esm(() => {
|
|
29397
29403
|
logBuffer = [];
|
|
29398
29404
|
alwaysOnBuffer = [];
|
|
@@ -30799,6 +30805,554 @@ var init_profile_config = __esm(() => {
|
|
|
30799
30805
|
};
|
|
30800
30806
|
});
|
|
30801
30807
|
|
|
30808
|
+
// src/providers/provider-definitions.ts
|
|
30809
|
+
function ensureProviderByNameCache() {
|
|
30810
|
+
if (!_providerByNameCache) {
|
|
30811
|
+
_providerByNameCache = new Map;
|
|
30812
|
+
for (const def of BUILTIN_PROVIDERS) {
|
|
30813
|
+
_providerByNameCache.set(def.name, def);
|
|
30814
|
+
}
|
|
30815
|
+
}
|
|
30816
|
+
return _providerByNameCache;
|
|
30817
|
+
}
|
|
30818
|
+
function getShortcuts() {
|
|
30819
|
+
if (!_shortcutsCache) {
|
|
30820
|
+
_shortcutsCache = {};
|
|
30821
|
+
for (const def of BUILTIN_PROVIDERS) {
|
|
30822
|
+
for (const shortcut of def.shortcuts) {
|
|
30823
|
+
_shortcutsCache[shortcut] = def.name;
|
|
30824
|
+
}
|
|
30825
|
+
}
|
|
30826
|
+
}
|
|
30827
|
+
return _shortcutsCache;
|
|
30828
|
+
}
|
|
30829
|
+
function getLegacyPrefixPatterns() {
|
|
30830
|
+
if (!_legacyPrefixCache) {
|
|
30831
|
+
_legacyPrefixCache = [];
|
|
30832
|
+
for (const def of BUILTIN_PROVIDERS) {
|
|
30833
|
+
for (const lp of def.legacyPrefixes) {
|
|
30834
|
+
_legacyPrefixCache.push({
|
|
30835
|
+
prefix: lp.prefix,
|
|
30836
|
+
provider: def.name,
|
|
30837
|
+
stripPrefix: lp.stripPrefix
|
|
30838
|
+
});
|
|
30839
|
+
}
|
|
30840
|
+
}
|
|
30841
|
+
}
|
|
30842
|
+
return _legacyPrefixCache;
|
|
30843
|
+
}
|
|
30844
|
+
function getNativeModelPatterns() {
|
|
30845
|
+
if (!_nativeModelPatternsCache) {
|
|
30846
|
+
_nativeModelPatternsCache = [];
|
|
30847
|
+
for (const def of BUILTIN_PROVIDERS) {
|
|
30848
|
+
if (def.nativeModelPatterns) {
|
|
30849
|
+
for (const np of def.nativeModelPatterns) {
|
|
30850
|
+
_nativeModelPatternsCache.push({
|
|
30851
|
+
pattern: np.pattern,
|
|
30852
|
+
provider: def.name
|
|
30853
|
+
});
|
|
30854
|
+
}
|
|
30855
|
+
}
|
|
30856
|
+
}
|
|
30857
|
+
}
|
|
30858
|
+
return _nativeModelPatternsCache;
|
|
30859
|
+
}
|
|
30860
|
+
function getProviderByName(name) {
|
|
30861
|
+
return ensureProviderByNameCache().get(name);
|
|
30862
|
+
}
|
|
30863
|
+
function getApiKeyInfo(providerName) {
|
|
30864
|
+
const def = getProviderByName(providerName);
|
|
30865
|
+
if (!def)
|
|
30866
|
+
return null;
|
|
30867
|
+
return {
|
|
30868
|
+
envVar: def.apiKeyEnvVar,
|
|
30869
|
+
description: def.apiKeyDescription,
|
|
30870
|
+
url: def.apiKeyUrl,
|
|
30871
|
+
aliases: def.apiKeyAliases,
|
|
30872
|
+
oauthFallback: def.oauthFallback
|
|
30873
|
+
};
|
|
30874
|
+
}
|
|
30875
|
+
function getDisplayName(providerName) {
|
|
30876
|
+
const def = getProviderByName(providerName);
|
|
30877
|
+
return def?.displayName || providerName.charAt(0).toUpperCase() + providerName.slice(1);
|
|
30878
|
+
}
|
|
30879
|
+
function getEffectiveBaseUrl(def) {
|
|
30880
|
+
if (def.baseUrlEnvVars) {
|
|
30881
|
+
for (const envVar of def.baseUrlEnvVars) {
|
|
30882
|
+
const value = process.env[envVar];
|
|
30883
|
+
if (value)
|
|
30884
|
+
return value;
|
|
30885
|
+
}
|
|
30886
|
+
}
|
|
30887
|
+
return def.baseUrl;
|
|
30888
|
+
}
|
|
30889
|
+
function isLocalTransport(providerName) {
|
|
30890
|
+
if (!_localProvidersCache) {
|
|
30891
|
+
_localProvidersCache = new Set;
|
|
30892
|
+
for (const def of BUILTIN_PROVIDERS) {
|
|
30893
|
+
if (def.isLocal) {
|
|
30894
|
+
_localProvidersCache.add(def.name);
|
|
30895
|
+
}
|
|
30896
|
+
}
|
|
30897
|
+
}
|
|
30898
|
+
return _localProvidersCache.has(providerName.toLowerCase());
|
|
30899
|
+
}
|
|
30900
|
+
function toRemoteProvider(def) {
|
|
30901
|
+
const baseUrl = getEffectiveBaseUrl(def);
|
|
30902
|
+
let effectiveBaseUrl = baseUrl;
|
|
30903
|
+
if (def.name === "opencode-zen-go" && def.baseUrlEnvVars) {
|
|
30904
|
+
const envOverride = process.env[def.baseUrlEnvVars[0]];
|
|
30905
|
+
if (envOverride) {
|
|
30906
|
+
effectiveBaseUrl = envOverride.replace("/zen", "/zen/go");
|
|
30907
|
+
}
|
|
30908
|
+
}
|
|
30909
|
+
return {
|
|
30910
|
+
name: def.name === "google" ? "gemini" : def.name,
|
|
30911
|
+
baseUrl: effectiveBaseUrl,
|
|
30912
|
+
apiPath: def.apiPath,
|
|
30913
|
+
apiKeyEnvVar: def.apiKeyEnvVar,
|
|
30914
|
+
prefixes: def.legacyPrefixes.map((lp) => lp.prefix),
|
|
30915
|
+
headers: def.headers,
|
|
30916
|
+
authScheme: def.authScheme
|
|
30917
|
+
};
|
|
30918
|
+
}
|
|
30919
|
+
function getAllProviders() {
|
|
30920
|
+
return BUILTIN_PROVIDERS;
|
|
30921
|
+
}
|
|
30922
|
+
function getApiKeyEnvVars(providerName) {
|
|
30923
|
+
const def = getProviderByName(providerName);
|
|
30924
|
+
if (!def)
|
|
30925
|
+
return null;
|
|
30926
|
+
return {
|
|
30927
|
+
envVar: def.apiKeyEnvVar,
|
|
30928
|
+
aliases: def.apiKeyAliases
|
|
30929
|
+
};
|
|
30930
|
+
}
|
|
30931
|
+
var BUILTIN_PROVIDERS, _shortcutsCache = null, _legacyPrefixCache = null, _nativeModelPatternsCache = null, _providerByNameCache = null, _localProvidersCache = null;
|
|
30932
|
+
var init_provider_definitions = __esm(() => {
|
|
30933
|
+
BUILTIN_PROVIDERS = [
|
|
30934
|
+
{
|
|
30935
|
+
name: "google",
|
|
30936
|
+
displayName: "Gemini",
|
|
30937
|
+
transport: "gemini",
|
|
30938
|
+
baseUrl: "https://generativelanguage.googleapis.com",
|
|
30939
|
+
baseUrlEnvVars: ["GEMINI_BASE_URL"],
|
|
30940
|
+
apiPath: "/v1beta/models/{model}:streamGenerateContent?alt=sse",
|
|
30941
|
+
apiKeyEnvVar: "GEMINI_API_KEY",
|
|
30942
|
+
apiKeyDescription: "Google Gemini API Key",
|
|
30943
|
+
apiKeyUrl: "https://aistudio.google.com/app/apikey",
|
|
30944
|
+
shortcuts: ["g", "gemini"],
|
|
30945
|
+
shortestPrefix: "g",
|
|
30946
|
+
legacyPrefixes: [
|
|
30947
|
+
{ prefix: "g/", stripPrefix: true },
|
|
30948
|
+
{ prefix: "gemini/", stripPrefix: true }
|
|
30949
|
+
],
|
|
30950
|
+
nativeModelPatterns: [{ pattern: /^google\//i }, { pattern: /^gemini-/i }],
|
|
30951
|
+
isDirectApi: true
|
|
30952
|
+
},
|
|
30953
|
+
{
|
|
30954
|
+
name: "gemini-codeassist",
|
|
30955
|
+
displayName: "Gemini Code Assist",
|
|
30956
|
+
transport: "gemini-oauth",
|
|
30957
|
+
baseUrl: "https://cloudcode-pa.googleapis.com",
|
|
30958
|
+
apiPath: "/v1internal:streamGenerateContent?alt=sse",
|
|
30959
|
+
apiKeyEnvVar: "",
|
|
30960
|
+
apiKeyDescription: "Gemini Code Assist (OAuth)",
|
|
30961
|
+
apiKeyUrl: "https://cloud.google.com/code-assist",
|
|
30962
|
+
shortcuts: ["go"],
|
|
30963
|
+
shortestPrefix: "go",
|
|
30964
|
+
legacyPrefixes: [{ prefix: "go/", stripPrefix: true }],
|
|
30965
|
+
isDirectApi: true
|
|
30966
|
+
},
|
|
30967
|
+
{
|
|
30968
|
+
name: "openai",
|
|
30969
|
+
displayName: "OpenAI",
|
|
30970
|
+
transport: "openai",
|
|
30971
|
+
tokenStrategy: "delta-aware",
|
|
30972
|
+
baseUrl: "https://api.openai.com",
|
|
30973
|
+
baseUrlEnvVars: ["OPENAI_BASE_URL"],
|
|
30974
|
+
apiPath: "/v1/chat/completions",
|
|
30975
|
+
apiKeyEnvVar: "OPENAI_API_KEY",
|
|
30976
|
+
apiKeyDescription: "OpenAI API Key",
|
|
30977
|
+
apiKeyUrl: "https://platform.openai.com/api-keys",
|
|
30978
|
+
shortcuts: ["oai"],
|
|
30979
|
+
shortestPrefix: "oai",
|
|
30980
|
+
legacyPrefixes: [{ prefix: "oai/", stripPrefix: true }],
|
|
30981
|
+
nativeModelPatterns: [
|
|
30982
|
+
{ pattern: /^openai\//i },
|
|
30983
|
+
{ pattern: /^gpt-/i },
|
|
30984
|
+
{ pattern: /^o1(-|$)/i },
|
|
30985
|
+
{ pattern: /^o3(-|$)/i },
|
|
30986
|
+
{ pattern: /^chatgpt-/i }
|
|
30987
|
+
],
|
|
30988
|
+
isDirectApi: true
|
|
30989
|
+
},
|
|
30990
|
+
{
|
|
30991
|
+
name: "openrouter",
|
|
30992
|
+
displayName: "OpenRouter",
|
|
30993
|
+
transport: "openrouter",
|
|
30994
|
+
baseUrl: "https://openrouter.ai",
|
|
30995
|
+
apiPath: "/api/v1/chat/completions",
|
|
30996
|
+
apiKeyEnvVar: "OPENROUTER_API_KEY",
|
|
30997
|
+
apiKeyDescription: "OpenRouter API Key",
|
|
30998
|
+
apiKeyUrl: "https://openrouter.ai/keys",
|
|
30999
|
+
shortcuts: ["or"],
|
|
31000
|
+
shortestPrefix: "or",
|
|
31001
|
+
legacyPrefixes: [{ prefix: "or/", stripPrefix: true }],
|
|
31002
|
+
nativeModelPatterns: [{ pattern: /^openrouter\//i }],
|
|
31003
|
+
headers: {
|
|
31004
|
+
"HTTP-Referer": "https://claudish.com",
|
|
31005
|
+
"X-Title": "Claudish - OpenRouter Proxy"
|
|
31006
|
+
},
|
|
31007
|
+
isDirectApi: true
|
|
31008
|
+
},
|
|
31009
|
+
{
|
|
31010
|
+
name: "minimax",
|
|
31011
|
+
displayName: "MiniMax",
|
|
31012
|
+
transport: "anthropic",
|
|
31013
|
+
baseUrl: "https://api.minimax.io",
|
|
31014
|
+
baseUrlEnvVars: ["MINIMAX_BASE_URL"],
|
|
31015
|
+
apiPath: "/anthropic/v1/messages",
|
|
31016
|
+
apiKeyEnvVar: "MINIMAX_API_KEY",
|
|
31017
|
+
apiKeyDescription: "MiniMax API Key",
|
|
31018
|
+
apiKeyUrl: "https://www.minimaxi.com/",
|
|
31019
|
+
authScheme: "bearer",
|
|
31020
|
+
shortcuts: ["mm", "mmax"],
|
|
31021
|
+
shortestPrefix: "mm",
|
|
31022
|
+
legacyPrefixes: [
|
|
31023
|
+
{ prefix: "mmax/", stripPrefix: true },
|
|
31024
|
+
{ prefix: "mm/", stripPrefix: true }
|
|
31025
|
+
],
|
|
31026
|
+
nativeModelPatterns: [
|
|
31027
|
+
{ pattern: /^minimax\//i },
|
|
31028
|
+
{ pattern: /^minimax-/i },
|
|
31029
|
+
{ pattern: /^abab-/i }
|
|
31030
|
+
],
|
|
31031
|
+
isDirectApi: true
|
|
31032
|
+
},
|
|
31033
|
+
{
|
|
31034
|
+
name: "minimax-coding",
|
|
31035
|
+
displayName: "MiniMax Coding",
|
|
31036
|
+
transport: "anthropic",
|
|
31037
|
+
baseUrl: "https://api.minimax.io",
|
|
31038
|
+
baseUrlEnvVars: ["MINIMAX_CODING_BASE_URL"],
|
|
31039
|
+
apiPath: "/anthropic/v1/messages",
|
|
31040
|
+
apiKeyEnvVar: "MINIMAX_CODING_API_KEY",
|
|
31041
|
+
apiKeyDescription: "MiniMax Coding Plan API Key",
|
|
31042
|
+
apiKeyUrl: "https://platform.minimax.io/user-center/basic-information/interface-key",
|
|
31043
|
+
authScheme: "bearer",
|
|
31044
|
+
shortcuts: ["mmc"],
|
|
31045
|
+
shortestPrefix: "mmc",
|
|
31046
|
+
legacyPrefixes: [{ prefix: "mmc/", stripPrefix: true }],
|
|
31047
|
+
isDirectApi: true
|
|
31048
|
+
},
|
|
31049
|
+
{
|
|
31050
|
+
name: "kimi-coding",
|
|
31051
|
+
displayName: "Kimi Coding",
|
|
31052
|
+
transport: "kimi-coding",
|
|
31053
|
+
baseUrl: "https://api.kimi.com/coding/v1",
|
|
31054
|
+
apiPath: "/messages",
|
|
31055
|
+
apiKeyEnvVar: "KIMI_CODING_API_KEY",
|
|
31056
|
+
apiKeyDescription: "Kimi Coding API Key",
|
|
31057
|
+
apiKeyUrl: "https://kimi.com/code (get key from membership page, or run: claudish --kimi-login)",
|
|
31058
|
+
oauthFallback: "kimi-oauth.json",
|
|
31059
|
+
shortcuts: ["kc"],
|
|
31060
|
+
shortestPrefix: "kc",
|
|
31061
|
+
legacyPrefixes: [{ prefix: "kc/", stripPrefix: true }],
|
|
31062
|
+
nativeModelPatterns: [{ pattern: /^kimi-for-coding$/i }],
|
|
31063
|
+
isDirectApi: true
|
|
31064
|
+
},
|
|
31065
|
+
{
|
|
31066
|
+
name: "kimi",
|
|
31067
|
+
displayName: "Kimi",
|
|
31068
|
+
transport: "anthropic",
|
|
31069
|
+
baseUrl: "https://api.moonshot.ai",
|
|
31070
|
+
baseUrlEnvVars: ["MOONSHOT_BASE_URL", "KIMI_BASE_URL"],
|
|
31071
|
+
apiPath: "/anthropic/v1/messages",
|
|
31072
|
+
apiKeyEnvVar: "MOONSHOT_API_KEY",
|
|
31073
|
+
apiKeyAliases: ["KIMI_API_KEY"],
|
|
31074
|
+
apiKeyDescription: "Kimi/Moonshot API Key",
|
|
31075
|
+
apiKeyUrl: "https://platform.moonshot.cn/",
|
|
31076
|
+
shortcuts: ["kimi", "moon", "moonshot"],
|
|
31077
|
+
shortestPrefix: "kimi",
|
|
31078
|
+
legacyPrefixes: [
|
|
31079
|
+
{ prefix: "kimi/", stripPrefix: true },
|
|
31080
|
+
{ prefix: "moonshot/", stripPrefix: true }
|
|
31081
|
+
],
|
|
31082
|
+
nativeModelPatterns: [
|
|
31083
|
+
{ pattern: /^moonshot(ai)?\//i },
|
|
31084
|
+
{ pattern: /^moonshot-/i },
|
|
31085
|
+
{ pattern: /^kimi-/i }
|
|
31086
|
+
],
|
|
31087
|
+
isDirectApi: true
|
|
31088
|
+
},
|
|
31089
|
+
{
|
|
31090
|
+
name: "glm",
|
|
31091
|
+
displayName: "GLM",
|
|
31092
|
+
transport: "openai",
|
|
31093
|
+
tokenStrategy: "delta-aware",
|
|
31094
|
+
baseUrl: "https://open.bigmodel.cn",
|
|
31095
|
+
baseUrlEnvVars: ["ZHIPU_BASE_URL", "GLM_BASE_URL"],
|
|
31096
|
+
apiPath: "/api/paas/v4/chat/completions",
|
|
31097
|
+
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
31098
|
+
apiKeyAliases: ["GLM_API_KEY"],
|
|
31099
|
+
apiKeyDescription: "GLM/Zhipu API Key",
|
|
31100
|
+
apiKeyUrl: "https://open.bigmodel.cn/",
|
|
31101
|
+
shortcuts: ["glm", "zhipu"],
|
|
31102
|
+
shortestPrefix: "glm",
|
|
31103
|
+
legacyPrefixes: [
|
|
31104
|
+
{ prefix: "glm/", stripPrefix: true },
|
|
31105
|
+
{ prefix: "zhipu/", stripPrefix: true }
|
|
31106
|
+
],
|
|
31107
|
+
nativeModelPatterns: [
|
|
31108
|
+
{ pattern: /^zhipu\//i },
|
|
31109
|
+
{ pattern: /^glm-/i },
|
|
31110
|
+
{ pattern: /^chatglm-/i }
|
|
31111
|
+
],
|
|
31112
|
+
isDirectApi: true
|
|
31113
|
+
},
|
|
31114
|
+
{
|
|
31115
|
+
name: "glm-coding",
|
|
31116
|
+
displayName: "GLM Coding",
|
|
31117
|
+
transport: "openai",
|
|
31118
|
+
tokenStrategy: "delta-aware",
|
|
31119
|
+
baseUrl: "https://api.z.ai",
|
|
31120
|
+
apiPath: "/api/coding/paas/v4/chat/completions",
|
|
31121
|
+
apiKeyEnvVar: "GLM_CODING_API_KEY",
|
|
31122
|
+
apiKeyAliases: ["ZAI_CODING_API_KEY"],
|
|
31123
|
+
apiKeyDescription: "GLM Coding Plan API Key",
|
|
31124
|
+
apiKeyUrl: "https://z.ai/subscribe",
|
|
31125
|
+
shortcuts: ["gc"],
|
|
31126
|
+
shortestPrefix: "gc",
|
|
31127
|
+
legacyPrefixes: [{ prefix: "gc/", stripPrefix: true }],
|
|
31128
|
+
isDirectApi: true
|
|
31129
|
+
},
|
|
31130
|
+
{
|
|
31131
|
+
name: "zai",
|
|
31132
|
+
displayName: "Z.AI",
|
|
31133
|
+
transport: "anthropic",
|
|
31134
|
+
baseUrl: "https://api.z.ai",
|
|
31135
|
+
baseUrlEnvVars: ["ZAI_BASE_URL"],
|
|
31136
|
+
apiPath: "/api/anthropic/v1/messages",
|
|
31137
|
+
apiKeyEnvVar: "ZAI_API_KEY",
|
|
31138
|
+
apiKeyDescription: "Z.AI API Key",
|
|
31139
|
+
apiKeyUrl: "https://z.ai/",
|
|
31140
|
+
shortcuts: ["zai"],
|
|
31141
|
+
shortestPrefix: "zai",
|
|
31142
|
+
legacyPrefixes: [{ prefix: "zai/", stripPrefix: true }],
|
|
31143
|
+
nativeModelPatterns: [{ pattern: /^z-ai\//i }, { pattern: /^zai\//i }],
|
|
31144
|
+
isDirectApi: true
|
|
31145
|
+
},
|
|
31146
|
+
{
|
|
31147
|
+
name: "ollamacloud",
|
|
31148
|
+
displayName: "OllamaCloud",
|
|
31149
|
+
transport: "ollamacloud",
|
|
31150
|
+
tokenStrategy: "accumulate-both",
|
|
31151
|
+
baseUrl: "https://ollama.com",
|
|
31152
|
+
baseUrlEnvVars: ["OLLAMACLOUD_BASE_URL"],
|
|
31153
|
+
apiPath: "/api/chat",
|
|
31154
|
+
apiKeyEnvVar: "OLLAMA_API_KEY",
|
|
31155
|
+
apiKeyDescription: "OllamaCloud API Key",
|
|
31156
|
+
apiKeyUrl: "https://ollama.com/account",
|
|
31157
|
+
shortcuts: ["oc", "llama", "lc", "meta"],
|
|
31158
|
+
shortestPrefix: "oc",
|
|
31159
|
+
legacyPrefixes: [{ prefix: "oc/", stripPrefix: true }],
|
|
31160
|
+
nativeModelPatterns: [
|
|
31161
|
+
{ pattern: /^ollamacloud\//i },
|
|
31162
|
+
{ pattern: /^meta-llama\//i },
|
|
31163
|
+
{ pattern: /^llama-/i },
|
|
31164
|
+
{ pattern: /^llama3/i }
|
|
31165
|
+
],
|
|
31166
|
+
isDirectApi: true
|
|
31167
|
+
},
|
|
31168
|
+
{
|
|
31169
|
+
name: "opencode-zen",
|
|
31170
|
+
displayName: "OpenCode Zen",
|
|
31171
|
+
transport: "openai",
|
|
31172
|
+
tokenStrategy: "delta-aware",
|
|
31173
|
+
baseUrl: "https://opencode.ai/zen",
|
|
31174
|
+
baseUrlEnvVars: ["OPENCODE_BASE_URL"],
|
|
31175
|
+
apiPath: "/v1/chat/completions",
|
|
31176
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
31177
|
+
apiKeyDescription: "OpenCode Zen (Free)",
|
|
31178
|
+
apiKeyUrl: "https://opencode.ai/",
|
|
31179
|
+
publicKeyFallback: "public",
|
|
31180
|
+
shortcuts: ["zen"],
|
|
31181
|
+
shortestPrefix: "zen",
|
|
31182
|
+
legacyPrefixes: [{ prefix: "zen/", stripPrefix: true }],
|
|
31183
|
+
isDirectApi: true
|
|
31184
|
+
},
|
|
31185
|
+
{
|
|
31186
|
+
name: "opencode-zen-go",
|
|
31187
|
+
displayName: "OpenCode Zen Go",
|
|
31188
|
+
transport: "openai",
|
|
31189
|
+
tokenStrategy: "delta-aware",
|
|
31190
|
+
baseUrl: "https://opencode.ai/zen/go",
|
|
31191
|
+
baseUrlEnvVars: ["OPENCODE_BASE_URL"],
|
|
31192
|
+
apiPath: "/v1/chat/completions",
|
|
31193
|
+
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
31194
|
+
apiKeyDescription: "OpenCode Zen Go (Lite Plan)",
|
|
31195
|
+
apiKeyUrl: "https://opencode.ai/",
|
|
31196
|
+
shortcuts: ["zengo", "zgo"],
|
|
31197
|
+
shortestPrefix: "zengo",
|
|
31198
|
+
legacyPrefixes: [
|
|
31199
|
+
{ prefix: "zengo/", stripPrefix: true },
|
|
31200
|
+
{ prefix: "zgo/", stripPrefix: true }
|
|
31201
|
+
],
|
|
31202
|
+
isDirectApi: true
|
|
31203
|
+
},
|
|
31204
|
+
{
|
|
31205
|
+
name: "vertex",
|
|
31206
|
+
displayName: "Vertex AI",
|
|
31207
|
+
transport: "vertex",
|
|
31208
|
+
baseUrl: "",
|
|
31209
|
+
apiPath: "",
|
|
31210
|
+
apiKeyEnvVar: "VERTEX_PROJECT",
|
|
31211
|
+
apiKeyAliases: ["VERTEX_API_KEY"],
|
|
31212
|
+
apiKeyDescription: "Vertex AI API Key",
|
|
31213
|
+
apiKeyUrl: "https://console.cloud.google.com/vertex-ai",
|
|
31214
|
+
shortcuts: ["v", "vertex"],
|
|
31215
|
+
shortestPrefix: "v",
|
|
31216
|
+
legacyPrefixes: [
|
|
31217
|
+
{ prefix: "v/", stripPrefix: true },
|
|
31218
|
+
{ prefix: "vertex/", stripPrefix: true }
|
|
31219
|
+
],
|
|
31220
|
+
isDirectApi: true
|
|
31221
|
+
},
|
|
31222
|
+
{
|
|
31223
|
+
name: "litellm",
|
|
31224
|
+
displayName: "LiteLLM",
|
|
31225
|
+
transport: "litellm",
|
|
31226
|
+
baseUrl: "",
|
|
31227
|
+
baseUrlEnvVars: ["LITELLM_BASE_URL"],
|
|
31228
|
+
apiPath: "/v1/chat/completions",
|
|
31229
|
+
apiKeyEnvVar: "LITELLM_API_KEY",
|
|
31230
|
+
apiKeyDescription: "LiteLLM API Key",
|
|
31231
|
+
apiKeyUrl: "https://docs.litellm.ai/",
|
|
31232
|
+
shortcuts: ["litellm", "ll"],
|
|
31233
|
+
shortestPrefix: "ll",
|
|
31234
|
+
legacyPrefixes: [
|
|
31235
|
+
{ prefix: "litellm/", stripPrefix: true },
|
|
31236
|
+
{ prefix: "ll/", stripPrefix: true }
|
|
31237
|
+
],
|
|
31238
|
+
isDirectApi: true
|
|
31239
|
+
},
|
|
31240
|
+
{
|
|
31241
|
+
name: "poe",
|
|
31242
|
+
displayName: "Poe",
|
|
31243
|
+
transport: "poe",
|
|
31244
|
+
baseUrl: "https://api.poe.com",
|
|
31245
|
+
apiPath: "/v1/chat/completions",
|
|
31246
|
+
apiKeyEnvVar: "POE_API_KEY",
|
|
31247
|
+
apiKeyDescription: "Poe API Key",
|
|
31248
|
+
apiKeyUrl: "https://poe.com/api_key",
|
|
31249
|
+
shortcuts: ["poe"],
|
|
31250
|
+
shortestPrefix: "poe",
|
|
31251
|
+
legacyPrefixes: [],
|
|
31252
|
+
nativeModelPatterns: [{ pattern: /^poe:/i }],
|
|
31253
|
+
isDirectApi: true
|
|
31254
|
+
},
|
|
31255
|
+
{
|
|
31256
|
+
name: "ollama",
|
|
31257
|
+
displayName: "Ollama",
|
|
31258
|
+
transport: "local",
|
|
31259
|
+
baseUrl: "http://localhost:11434",
|
|
31260
|
+
apiPath: "/api/chat",
|
|
31261
|
+
apiKeyEnvVar: "",
|
|
31262
|
+
apiKeyDescription: "Ollama (Local)",
|
|
31263
|
+
apiKeyUrl: "",
|
|
31264
|
+
shortcuts: ["ollama"],
|
|
31265
|
+
shortestPrefix: "ollama",
|
|
31266
|
+
legacyPrefixes: [
|
|
31267
|
+
{ prefix: "ollama/", stripPrefix: true },
|
|
31268
|
+
{ prefix: "ollama:", stripPrefix: true }
|
|
31269
|
+
],
|
|
31270
|
+
isLocal: true
|
|
31271
|
+
},
|
|
31272
|
+
{
|
|
31273
|
+
name: "lmstudio",
|
|
31274
|
+
displayName: "LM Studio",
|
|
31275
|
+
transport: "local",
|
|
31276
|
+
baseUrl: "http://localhost:1234",
|
|
31277
|
+
apiPath: "/v1/chat/completions",
|
|
31278
|
+
apiKeyEnvVar: "",
|
|
31279
|
+
apiKeyDescription: "LM Studio (Local)",
|
|
31280
|
+
apiKeyUrl: "",
|
|
31281
|
+
shortcuts: ["lms", "lmstudio", "mlstudio"],
|
|
31282
|
+
shortestPrefix: "lms",
|
|
31283
|
+
legacyPrefixes: [
|
|
31284
|
+
{ prefix: "lmstudio/", stripPrefix: true },
|
|
31285
|
+
{ prefix: "lmstudio:", stripPrefix: true },
|
|
31286
|
+
{ prefix: "mlstudio/", stripPrefix: true },
|
|
31287
|
+
{ prefix: "mlstudio:", stripPrefix: true }
|
|
31288
|
+
],
|
|
31289
|
+
isLocal: true
|
|
31290
|
+
},
|
|
31291
|
+
{
|
|
31292
|
+
name: "vllm",
|
|
31293
|
+
displayName: "vLLM",
|
|
31294
|
+
transport: "local",
|
|
31295
|
+
baseUrl: "http://localhost:8000",
|
|
31296
|
+
apiPath: "/v1/chat/completions",
|
|
31297
|
+
apiKeyEnvVar: "",
|
|
31298
|
+
apiKeyDescription: "vLLM (Local)",
|
|
31299
|
+
apiKeyUrl: "",
|
|
31300
|
+
shortcuts: ["vllm"],
|
|
31301
|
+
shortestPrefix: "vllm",
|
|
31302
|
+
legacyPrefixes: [
|
|
31303
|
+
{ prefix: "vllm/", stripPrefix: true },
|
|
31304
|
+
{ prefix: "vllm:", stripPrefix: true }
|
|
31305
|
+
],
|
|
31306
|
+
isLocal: true
|
|
31307
|
+
},
|
|
31308
|
+
{
|
|
31309
|
+
name: "mlx",
|
|
31310
|
+
displayName: "MLX",
|
|
31311
|
+
transport: "local",
|
|
31312
|
+
baseUrl: "http://localhost:8080",
|
|
31313
|
+
apiPath: "/v1/chat/completions",
|
|
31314
|
+
apiKeyEnvVar: "",
|
|
31315
|
+
apiKeyDescription: "MLX (Local)",
|
|
31316
|
+
apiKeyUrl: "",
|
|
31317
|
+
shortcuts: ["mlx"],
|
|
31318
|
+
shortestPrefix: "mlx",
|
|
31319
|
+
legacyPrefixes: [
|
|
31320
|
+
{ prefix: "mlx/", stripPrefix: true },
|
|
31321
|
+
{ prefix: "mlx:", stripPrefix: true }
|
|
31322
|
+
],
|
|
31323
|
+
isLocal: true
|
|
31324
|
+
},
|
|
31325
|
+
{
|
|
31326
|
+
name: "qwen",
|
|
31327
|
+
displayName: "Qwen",
|
|
31328
|
+
transport: "openai",
|
|
31329
|
+
baseUrl: "",
|
|
31330
|
+
apiPath: "",
|
|
31331
|
+
apiKeyEnvVar: "",
|
|
31332
|
+
apiKeyDescription: "Qwen (auto-routed via OpenRouter)",
|
|
31333
|
+
apiKeyUrl: "",
|
|
31334
|
+
shortcuts: [],
|
|
31335
|
+
shortestPrefix: "qwen",
|
|
31336
|
+
legacyPrefixes: [],
|
|
31337
|
+
nativeModelPatterns: [{ pattern: /^qwen/i }]
|
|
31338
|
+
},
|
|
31339
|
+
{
|
|
31340
|
+
name: "native-anthropic",
|
|
31341
|
+
displayName: "Anthropic (Native)",
|
|
31342
|
+
transport: "anthropic",
|
|
31343
|
+
baseUrl: "",
|
|
31344
|
+
apiPath: "",
|
|
31345
|
+
apiKeyEnvVar: "",
|
|
31346
|
+
apiKeyDescription: "Anthropic (Native Claude Code auth)",
|
|
31347
|
+
apiKeyUrl: "",
|
|
31348
|
+
shortcuts: [],
|
|
31349
|
+
shortestPrefix: "",
|
|
31350
|
+
legacyPrefixes: [],
|
|
31351
|
+
nativeModelPatterns: [{ pattern: /^anthropic\//i }, { pattern: /^claude-/i }]
|
|
31352
|
+
}
|
|
31353
|
+
];
|
|
31354
|
+
});
|
|
31355
|
+
|
|
30802
31356
|
// src/providers/model-parser.ts
|
|
30803
31357
|
function parseModelSpec(modelSpec) {
|
|
30804
31358
|
const original = modelSpec;
|
|
@@ -30895,125 +31449,17 @@ function getLegacySyntaxWarning(parsed) {
|
|
|
30895
31449
|
return `Deprecation warning: "${parsed.original}" uses legacy prefix syntax.
|
|
30896
31450
|
` + ` Consider using: ${newSyntax}`;
|
|
30897
31451
|
}
|
|
30898
|
-
var PROVIDER_SHORTCUTS,
|
|
31452
|
+
var PROVIDER_SHORTCUTS, LOCAL_PROVIDERS, NATIVE_MODEL_PATTERNS, LEGACY_PREFIX_PATTERNS;
|
|
30899
31453
|
var init_model_parser = __esm(() => {
|
|
30900
|
-
|
|
30901
|
-
|
|
30902
|
-
|
|
30903
|
-
|
|
30904
|
-
|
|
30905
|
-
|
|
30906
|
-
|
|
30907
|
-
|
|
30908
|
-
|
|
30909
|
-
moon: "kimi",
|
|
30910
|
-
moonshot: "kimi",
|
|
30911
|
-
kc: "kimi-coding",
|
|
30912
|
-
glm: "glm",
|
|
30913
|
-
zhipu: "glm",
|
|
30914
|
-
gc: "glm-coding",
|
|
30915
|
-
zai: "zai",
|
|
30916
|
-
oc: "ollamacloud",
|
|
30917
|
-
zen: "opencode-zen",
|
|
30918
|
-
zengo: "opencode-zen-go",
|
|
30919
|
-
zgo: "opencode-zen-go",
|
|
30920
|
-
v: "vertex",
|
|
30921
|
-
vertex: "vertex",
|
|
30922
|
-
go: "gemini-codeassist",
|
|
30923
|
-
llama: "ollamacloud",
|
|
30924
|
-
lc: "ollamacloud",
|
|
30925
|
-
meta: "ollamacloud",
|
|
30926
|
-
poe: "poe",
|
|
30927
|
-
litellm: "litellm",
|
|
30928
|
-
ll: "litellm",
|
|
30929
|
-
ollama: "ollama",
|
|
30930
|
-
lms: "lmstudio",
|
|
30931
|
-
lmstudio: "lmstudio",
|
|
30932
|
-
mlstudio: "lmstudio",
|
|
30933
|
-
vllm: "vllm",
|
|
30934
|
-
mlx: "mlx"
|
|
30935
|
-
};
|
|
30936
|
-
DIRECT_API_PROVIDERS = new Set([
|
|
30937
|
-
"google",
|
|
30938
|
-
"openai",
|
|
30939
|
-
"minimax",
|
|
30940
|
-
"kimi",
|
|
30941
|
-
"minimax-coding",
|
|
30942
|
-
"kimi-coding",
|
|
30943
|
-
"glm",
|
|
30944
|
-
"glm-coding",
|
|
30945
|
-
"zai",
|
|
30946
|
-
"ollamacloud",
|
|
30947
|
-
"opencode-zen",
|
|
30948
|
-
"vertex",
|
|
30949
|
-
"gemini-codeassist",
|
|
30950
|
-
"poe",
|
|
30951
|
-
"litellm"
|
|
30952
|
-
]);
|
|
30953
|
-
LOCAL_PROVIDERS = new Set(["ollama", "lmstudio", "vllm", "mlx"]);
|
|
30954
|
-
NATIVE_MODEL_PATTERNS = [
|
|
30955
|
-
{ pattern: /^google\//i, provider: "google" },
|
|
30956
|
-
{ pattern: /^gemini-/i, provider: "google" },
|
|
30957
|
-
{ pattern: /^openai\//i, provider: "openai" },
|
|
30958
|
-
{ pattern: /^gpt-/i, provider: "openai" },
|
|
30959
|
-
{ pattern: /^o1(-|$)/i, provider: "openai" },
|
|
30960
|
-
{ pattern: /^o3(-|$)/i, provider: "openai" },
|
|
30961
|
-
{ pattern: /^chatgpt-/i, provider: "openai" },
|
|
30962
|
-
{ pattern: /^minimax\//i, provider: "minimax" },
|
|
30963
|
-
{ pattern: /^minimax-/i, provider: "minimax" },
|
|
30964
|
-
{ pattern: /^abab-/i, provider: "minimax" },
|
|
30965
|
-
{ pattern: /^kimi-for-coding$/i, provider: "kimi-coding" },
|
|
30966
|
-
{ pattern: /^moonshot(ai)?\//i, provider: "kimi" },
|
|
30967
|
-
{ pattern: /^moonshot-/i, provider: "kimi" },
|
|
30968
|
-
{ pattern: /^kimi-/i, provider: "kimi" },
|
|
30969
|
-
{ pattern: /^zhipu\//i, provider: "glm" },
|
|
30970
|
-
{ pattern: /^glm-/i, provider: "glm" },
|
|
30971
|
-
{ pattern: /^chatglm-/i, provider: "glm" },
|
|
30972
|
-
{ pattern: /^z-ai\//i, provider: "zai" },
|
|
30973
|
-
{ pattern: /^zai\//i, provider: "zai" },
|
|
30974
|
-
{ pattern: /^ollamacloud\//i, provider: "ollamacloud" },
|
|
30975
|
-
{ pattern: /^meta-llama\//i, provider: "ollamacloud" },
|
|
30976
|
-
{ pattern: /^llama-/i, provider: "ollamacloud" },
|
|
30977
|
-
{ pattern: /^llama3/i, provider: "ollamacloud" },
|
|
30978
|
-
{ pattern: /^openrouter\//i, provider: "openrouter" },
|
|
30979
|
-
{ pattern: /^qwen/i, provider: "qwen" },
|
|
30980
|
-
{ pattern: /^poe:/i, provider: "poe" },
|
|
30981
|
-
{ pattern: /^anthropic\//i, provider: "native-anthropic" },
|
|
30982
|
-
{ pattern: /^claude-/i, provider: "native-anthropic" }
|
|
30983
|
-
];
|
|
30984
|
-
LEGACY_PREFIX_PATTERNS = [
|
|
30985
|
-
{ prefix: "g/", provider: "google", stripPrefix: true },
|
|
30986
|
-
{ prefix: "gemini/", provider: "google", stripPrefix: true },
|
|
30987
|
-
{ prefix: "oai/", provider: "openai", stripPrefix: true },
|
|
30988
|
-
{ prefix: "or/", provider: "openrouter", stripPrefix: true },
|
|
30989
|
-
{ prefix: "mmax/", provider: "minimax", stripPrefix: true },
|
|
30990
|
-
{ prefix: "mm/", provider: "minimax", stripPrefix: true },
|
|
30991
|
-
{ prefix: "mmc/", provider: "minimax-coding", stripPrefix: true },
|
|
30992
|
-
{ prefix: "kimi/", provider: "kimi", stripPrefix: true },
|
|
30993
|
-
{ prefix: "moonshot/", provider: "kimi", stripPrefix: true },
|
|
30994
|
-
{ prefix: "kc/", provider: "kimi-coding", stripPrefix: true },
|
|
30995
|
-
{ prefix: "glm/", provider: "glm", stripPrefix: true },
|
|
30996
|
-
{ prefix: "zhipu/", provider: "glm", stripPrefix: true },
|
|
30997
|
-
{ prefix: "gc/", provider: "glm-coding", stripPrefix: true },
|
|
30998
|
-
{ prefix: "zai/", provider: "zai", stripPrefix: true },
|
|
30999
|
-
{ prefix: "oc/", provider: "ollamacloud", stripPrefix: true },
|
|
31000
|
-
{ prefix: "zen/", provider: "opencode-zen", stripPrefix: true },
|
|
31001
|
-
{ prefix: "zengo/", provider: "opencode-zen-go", stripPrefix: true },
|
|
31002
|
-
{ prefix: "zgo/", provider: "opencode-zen-go", stripPrefix: true },
|
|
31003
|
-
{ prefix: "v/", provider: "vertex", stripPrefix: true },
|
|
31004
|
-
{ prefix: "vertex/", provider: "vertex", stripPrefix: true },
|
|
31005
|
-
{ prefix: "go/", provider: "gemini-codeassist", stripPrefix: true },
|
|
31006
|
-
{ prefix: "ollama/", provider: "ollama", stripPrefix: true },
|
|
31007
|
-
{ prefix: "ollama:", provider: "ollama", stripPrefix: true },
|
|
31008
|
-
{ prefix: "lmstudio/", provider: "lmstudio", stripPrefix: true },
|
|
31009
|
-
{ prefix: "lmstudio:", provider: "lmstudio", stripPrefix: true },
|
|
31010
|
-
{ prefix: "mlstudio/", provider: "lmstudio", stripPrefix: true },
|
|
31011
|
-
{ prefix: "mlstudio:", provider: "lmstudio", stripPrefix: true },
|
|
31012
|
-
{ prefix: "vllm/", provider: "vllm", stripPrefix: true },
|
|
31013
|
-
{ prefix: "vllm:", provider: "vllm", stripPrefix: true },
|
|
31014
|
-
{ prefix: "mlx/", provider: "mlx", stripPrefix: true },
|
|
31015
|
-
{ prefix: "mlx:", provider: "mlx", stripPrefix: true }
|
|
31016
|
-
];
|
|
31454
|
+
init_provider_definitions();
|
|
31455
|
+
PROVIDER_SHORTCUTS = getShortcuts();
|
|
31456
|
+
LOCAL_PROVIDERS = {
|
|
31457
|
+
has(name) {
|
|
31458
|
+
return isLocalTransport(name);
|
|
31459
|
+
}
|
|
31460
|
+
};
|
|
31461
|
+
NATIVE_MODEL_PATTERNS = getNativeModelPatterns();
|
|
31462
|
+
LEGACY_PREFIX_PATTERNS = getLegacyPrefixPatterns();
|
|
31017
31463
|
});
|
|
31018
31464
|
|
|
31019
31465
|
// src/auth/oauth-registry.ts
|
|
@@ -31320,7 +31766,7 @@ function checkOAuthForProvider(nativeProvider, modelName) {
|
|
|
31320
31766
|
};
|
|
31321
31767
|
}
|
|
31322
31768
|
function checkApiKeyForProvider(nativeProvider, modelName) {
|
|
31323
|
-
const keyInfo =
|
|
31769
|
+
const keyInfo = getApiKeyEnvVars(nativeProvider);
|
|
31324
31770
|
if (!keyInfo)
|
|
31325
31771
|
return null;
|
|
31326
31772
|
if (keyInfo.envVar && process.env[keyInfo.envVar]) {
|
|
@@ -31448,7 +31894,7 @@ async function warmZenModelCache() {
|
|
|
31448
31894
|
writeSync3(join11(cacheDir, "zen-models.json"), JSON.stringify({ models, fetchedAt: new Date().toISOString() }));
|
|
31449
31895
|
}
|
|
31450
31896
|
function hasProviderCredentials(provider) {
|
|
31451
|
-
const keyInfo =
|
|
31897
|
+
const keyInfo = getApiKeyEnvVars(provider);
|
|
31452
31898
|
if (keyInfo?.envVar && process.env[keyInfo.envVar])
|
|
31453
31899
|
return true;
|
|
31454
31900
|
if (keyInfo?.aliases?.some((a) => process.env[a]))
|
|
@@ -31501,27 +31947,12 @@ function getFallbackChain(modelName, nativeProvider) {
|
|
|
31501
31947
|
}
|
|
31502
31948
|
return routes;
|
|
31503
31949
|
}
|
|
31504
|
-
var
|
|
31950
|
+
var PROVIDER_HINT_MAP, PROVIDER_TO_PREFIX, DISPLAY_NAMES, SUBSCRIPTION_ALTERNATIVES;
|
|
31505
31951
|
var init_auto_route = __esm(() => {
|
|
31506
31952
|
init_oauth_registry();
|
|
31507
31953
|
init_model_catalog_resolver();
|
|
31508
|
-
|
|
31509
|
-
|
|
31510
|
-
"gemini-codeassist": { envVar: "GEMINI_API_KEY" },
|
|
31511
|
-
openai: { envVar: "OPENAI_API_KEY" },
|
|
31512
|
-
minimax: { envVar: "MINIMAX_API_KEY" },
|
|
31513
|
-
"minimax-coding": { envVar: "MINIMAX_CODING_API_KEY" },
|
|
31514
|
-
kimi: { envVar: "MOONSHOT_API_KEY", aliases: ["KIMI_API_KEY"] },
|
|
31515
|
-
"kimi-coding": { envVar: "KIMI_CODING_API_KEY" },
|
|
31516
|
-
glm: { envVar: "ZHIPU_API_KEY", aliases: ["GLM_API_KEY"] },
|
|
31517
|
-
"glm-coding": { envVar: "GLM_CODING_API_KEY", aliases: ["ZAI_CODING_API_KEY"] },
|
|
31518
|
-
zai: { envVar: "ZAI_API_KEY" },
|
|
31519
|
-
ollamacloud: { envVar: "OLLAMA_API_KEY" },
|
|
31520
|
-
litellm: { envVar: "LITELLM_API_KEY" },
|
|
31521
|
-
openrouter: { envVar: "OPENROUTER_API_KEY" },
|
|
31522
|
-
vertex: { envVar: "VERTEX_API_KEY", aliases: ["VERTEX_PROJECT"] },
|
|
31523
|
-
poe: { envVar: "POE_API_KEY" }
|
|
31524
|
-
};
|
|
31954
|
+
init_provider_definitions();
|
|
31955
|
+
init_provider_definitions();
|
|
31525
31956
|
PROVIDER_HINT_MAP = {
|
|
31526
31957
|
"kimi-coding": {
|
|
31527
31958
|
loginFlag: "--kimi-login",
|
|
@@ -31565,39 +31996,22 @@ var init_auto_route = __esm(() => {
|
|
|
31565
31996
|
apiKeyEnvVar: "OLLAMA_API_KEY"
|
|
31566
31997
|
}
|
|
31567
31998
|
};
|
|
31568
|
-
PROVIDER_TO_PREFIX = {
|
|
31569
|
-
|
|
31570
|
-
|
|
31571
|
-
|
|
31572
|
-
|
|
31573
|
-
|
|
31574
|
-
|
|
31575
|
-
|
|
31576
|
-
|
|
31577
|
-
|
|
31578
|
-
|
|
31579
|
-
|
|
31580
|
-
|
|
31581
|
-
|
|
31582
|
-
|
|
31583
|
-
|
|
31584
|
-
};
|
|
31585
|
-
DISPLAY_NAMES = {
|
|
31586
|
-
google: "Gemini",
|
|
31587
|
-
openai: "OpenAI",
|
|
31588
|
-
minimax: "MiniMax",
|
|
31589
|
-
"minimax-coding": "MiniMax Coding",
|
|
31590
|
-
kimi: "Kimi",
|
|
31591
|
-
"kimi-coding": "Kimi Coding",
|
|
31592
|
-
glm: "GLM",
|
|
31593
|
-
"glm-coding": "GLM Coding",
|
|
31594
|
-
zai: "Z.AI",
|
|
31595
|
-
ollamacloud: "OllamaCloud",
|
|
31596
|
-
"opencode-zen": "OpenCode Zen",
|
|
31597
|
-
"opencode-zen-go": "OpenCode Zen Go",
|
|
31598
|
-
litellm: "LiteLLM",
|
|
31599
|
-
openrouter: "OpenRouter"
|
|
31600
|
-
};
|
|
31999
|
+
PROVIDER_TO_PREFIX = (() => {
|
|
32000
|
+
const map3 = {};
|
|
32001
|
+
for (const def of getAllProviders()) {
|
|
32002
|
+
if (def.shortestPrefix) {
|
|
32003
|
+
map3[def.name] = def.shortestPrefix;
|
|
32004
|
+
}
|
|
32005
|
+
}
|
|
32006
|
+
return map3;
|
|
32007
|
+
})();
|
|
32008
|
+
DISPLAY_NAMES = (() => {
|
|
32009
|
+
const map3 = {};
|
|
32010
|
+
for (const def of getAllProviders()) {
|
|
32011
|
+
map3[def.name] = def.displayName;
|
|
32012
|
+
}
|
|
32013
|
+
return map3;
|
|
32014
|
+
})();
|
|
31601
32015
|
SUBSCRIPTION_ALTERNATIVES = {
|
|
31602
32016
|
kimi: {
|
|
31603
32017
|
subscriptionProvider: "kimi-coding",
|
|
@@ -31828,40 +32242,20 @@ function resolveRemoteProvider(modelId) {
|
|
|
31828
32242
|
if (parsed.provider === "custom-url") {
|
|
31829
32243
|
return null;
|
|
31830
32244
|
}
|
|
31831
|
-
const
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
|
|
31837
|
-
|
|
31838
|
-
|
|
31839
|
-
glm: "glm",
|
|
31840
|
-
"glm-coding": "glm-coding",
|
|
31841
|
-
zai: "zai",
|
|
31842
|
-
ollamacloud: "ollamacloud",
|
|
31843
|
-
"opencode-zen": "opencode-zen",
|
|
31844
|
-
"opencode-zen-go": "opencode-zen-go",
|
|
31845
|
-
vertex: "vertex",
|
|
31846
|
-
"gemini-codeassist": "gemini-codeassist",
|
|
31847
|
-
litellm: "litellm"
|
|
31848
|
-
};
|
|
31849
|
-
const mappedProviderName = providerNameMap[parsed.provider];
|
|
31850
|
-
if (mappedProviderName) {
|
|
31851
|
-
const provider = providers.find((p) => p.name === mappedProviderName);
|
|
31852
|
-
if (provider) {
|
|
31853
|
-
return {
|
|
31854
|
-
provider,
|
|
31855
|
-
modelName: parsed.model,
|
|
31856
|
-
isLegacySyntax: parsed.isLegacySyntax
|
|
31857
|
-
};
|
|
31858
|
-
}
|
|
32245
|
+
const mappedName = parsed.provider === "google" ? "gemini" : parsed.provider;
|
|
32246
|
+
const provider = providers.find((p) => p.name === mappedName || p.name === parsed.provider);
|
|
32247
|
+
if (provider) {
|
|
32248
|
+
return {
|
|
32249
|
+
provider,
|
|
32250
|
+
modelName: parsed.model,
|
|
32251
|
+
isLegacySyntax: parsed.isLegacySyntax
|
|
32252
|
+
};
|
|
31859
32253
|
}
|
|
31860
|
-
for (const
|
|
31861
|
-
for (const prefix of
|
|
32254
|
+
for (const provider2 of providers) {
|
|
32255
|
+
for (const prefix of provider2.prefixes) {
|
|
31862
32256
|
if (modelId.startsWith(prefix)) {
|
|
31863
32257
|
return {
|
|
31864
|
-
provider,
|
|
32258
|
+
provider: provider2,
|
|
31865
32259
|
modelName: modelId.slice(prefix.length),
|
|
31866
32260
|
isLegacySyntax: true
|
|
31867
32261
|
};
|
|
@@ -31907,128 +32301,12 @@ Set it with:
|
|
|
31907
32301
|
function getRegisteredRemoteProviders() {
|
|
31908
32302
|
return getRemoteProviders();
|
|
31909
32303
|
}
|
|
31910
|
-
var getRemoteProviders = () =>
|
|
31911
|
-
|
|
31912
|
-
|
|
31913
|
-
baseUrl: process.env.GEMINI_BASE_URL || "https://generativelanguage.googleapis.com",
|
|
31914
|
-
apiPath: "/v1beta/models/{model}:streamGenerateContent?alt=sse",
|
|
31915
|
-
apiKeyEnvVar: "GEMINI_API_KEY",
|
|
31916
|
-
prefixes: ["g/", "gemini/"]
|
|
31917
|
-
},
|
|
31918
|
-
{
|
|
31919
|
-
name: "gemini-codeassist",
|
|
31920
|
-
baseUrl: "https://cloudcode-pa.googleapis.com",
|
|
31921
|
-
apiPath: "/v1internal:streamGenerateContent?alt=sse",
|
|
31922
|
-
apiKeyEnvVar: "",
|
|
31923
|
-
prefixes: ["go/"]
|
|
31924
|
-
},
|
|
31925
|
-
{
|
|
31926
|
-
name: "openai",
|
|
31927
|
-
baseUrl: process.env.OPENAI_BASE_URL || "https://api.openai.com",
|
|
31928
|
-
apiPath: "/v1/chat/completions",
|
|
31929
|
-
apiKeyEnvVar: "OPENAI_API_KEY",
|
|
31930
|
-
prefixes: ["oai/"]
|
|
31931
|
-
},
|
|
31932
|
-
{
|
|
31933
|
-
name: "openrouter",
|
|
31934
|
-
baseUrl: "https://openrouter.ai",
|
|
31935
|
-
apiPath: "/api/v1/chat/completions",
|
|
31936
|
-
apiKeyEnvVar: "OPENROUTER_API_KEY",
|
|
31937
|
-
prefixes: ["or/"],
|
|
31938
|
-
headers: {
|
|
31939
|
-
"HTTP-Referer": "https://claudish.com",
|
|
31940
|
-
"X-Title": "Claudish - OpenRouter Proxy"
|
|
31941
|
-
}
|
|
31942
|
-
},
|
|
31943
|
-
{
|
|
31944
|
-
name: "minimax",
|
|
31945
|
-
baseUrl: process.env.MINIMAX_BASE_URL || "https://api.minimax.io",
|
|
31946
|
-
apiPath: "/anthropic/v1/messages",
|
|
31947
|
-
apiKeyEnvVar: "MINIMAX_API_KEY",
|
|
31948
|
-
prefixes: ["mmax/", "mm/"],
|
|
31949
|
-
authScheme: "bearer"
|
|
31950
|
-
},
|
|
31951
|
-
{
|
|
31952
|
-
name: "minimax-coding",
|
|
31953
|
-
baseUrl: process.env.MINIMAX_CODING_BASE_URL || "https://api.minimax.io",
|
|
31954
|
-
apiPath: "/anthropic/v1/messages",
|
|
31955
|
-
apiKeyEnvVar: "MINIMAX_CODING_API_KEY",
|
|
31956
|
-
prefixes: ["mmc/"],
|
|
31957
|
-
authScheme: "bearer"
|
|
31958
|
-
},
|
|
31959
|
-
{
|
|
31960
|
-
name: "kimi",
|
|
31961
|
-
baseUrl: process.env.MOONSHOT_BASE_URL || process.env.KIMI_BASE_URL || "https://api.moonshot.ai",
|
|
31962
|
-
apiPath: "/anthropic/v1/messages",
|
|
31963
|
-
apiKeyEnvVar: "MOONSHOT_API_KEY",
|
|
31964
|
-
prefixes: ["kimi/", "moonshot/"]
|
|
31965
|
-
},
|
|
31966
|
-
{
|
|
31967
|
-
name: "kimi-coding",
|
|
31968
|
-
baseUrl: "https://api.kimi.com/coding/v1",
|
|
31969
|
-
apiPath: "/messages",
|
|
31970
|
-
apiKeyEnvVar: "KIMI_CODING_API_KEY",
|
|
31971
|
-
prefixes: ["kc/"]
|
|
31972
|
-
},
|
|
31973
|
-
{
|
|
31974
|
-
name: "glm",
|
|
31975
|
-
baseUrl: process.env.ZHIPU_BASE_URL || process.env.GLM_BASE_URL || "https://open.bigmodel.cn",
|
|
31976
|
-
apiPath: "/api/paas/v4/chat/completions",
|
|
31977
|
-
apiKeyEnvVar: "ZHIPU_API_KEY",
|
|
31978
|
-
prefixes: ["glm/", "zhipu/"]
|
|
31979
|
-
},
|
|
31980
|
-
{
|
|
31981
|
-
name: "glm-coding",
|
|
31982
|
-
baseUrl: "https://api.z.ai",
|
|
31983
|
-
apiPath: "/api/coding/paas/v4/chat/completions",
|
|
31984
|
-
apiKeyEnvVar: "GLM_CODING_API_KEY",
|
|
31985
|
-
prefixes: ["gc/"]
|
|
31986
|
-
},
|
|
31987
|
-
{
|
|
31988
|
-
name: "zai",
|
|
31989
|
-
baseUrl: process.env.ZAI_BASE_URL || "https://api.z.ai",
|
|
31990
|
-
apiPath: "/api/anthropic/v1/messages",
|
|
31991
|
-
apiKeyEnvVar: "ZAI_API_KEY",
|
|
31992
|
-
prefixes: ["zai/"]
|
|
31993
|
-
},
|
|
31994
|
-
{
|
|
31995
|
-
name: "ollamacloud",
|
|
31996
|
-
baseUrl: process.env.OLLAMACLOUD_BASE_URL || "https://ollama.com",
|
|
31997
|
-
apiPath: "/api/chat",
|
|
31998
|
-
apiKeyEnvVar: "OLLAMA_API_KEY",
|
|
31999
|
-
prefixes: ["oc/"]
|
|
32000
|
-
},
|
|
32001
|
-
{
|
|
32002
|
-
name: "opencode-zen",
|
|
32003
|
-
baseUrl: process.env.OPENCODE_BASE_URL || "https://opencode.ai/zen",
|
|
32004
|
-
apiPath: "/v1/chat/completions",
|
|
32005
|
-
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
32006
|
-
prefixes: ["zen/"]
|
|
32007
|
-
},
|
|
32008
|
-
{
|
|
32009
|
-
name: "opencode-zen-go",
|
|
32010
|
-
baseUrl: process.env.OPENCODE_BASE_URL ? process.env.OPENCODE_BASE_URL.replace("/zen", "/zen/go") : "https://opencode.ai/zen/go",
|
|
32011
|
-
apiPath: "/v1/chat/completions",
|
|
32012
|
-
apiKeyEnvVar: "OPENCODE_API_KEY",
|
|
32013
|
-
prefixes: ["zengo/", "zgo/"]
|
|
32014
|
-
},
|
|
32015
|
-
{
|
|
32016
|
-
name: "vertex",
|
|
32017
|
-
baseUrl: "",
|
|
32018
|
-
apiPath: "",
|
|
32019
|
-
apiKeyEnvVar: "VERTEX_PROJECT",
|
|
32020
|
-
prefixes: ["v/", "vertex/"]
|
|
32021
|
-
},
|
|
32022
|
-
{
|
|
32023
|
-
name: "litellm",
|
|
32024
|
-
baseUrl: process.env.LITELLM_BASE_URL || "",
|
|
32025
|
-
apiPath: "/v1/chat/completions",
|
|
32026
|
-
apiKeyEnvVar: "LITELLM_API_KEY",
|
|
32027
|
-
prefixes: ["litellm/", "ll/"]
|
|
32028
|
-
}
|
|
32029
|
-
];
|
|
32304
|
+
var getRemoteProviders = () => {
|
|
32305
|
+
return getAllProviders().filter((def) => !def.isLocal && def.baseUrl !== "" && def.name !== "qwen" && def.name !== "native-anthropic").map(toRemoteProvider);
|
|
32306
|
+
};
|
|
32030
32307
|
var init_remote_provider_registry = __esm(() => {
|
|
32031
32308
|
init_model_parser();
|
|
32309
|
+
init_provider_definitions();
|
|
32032
32310
|
});
|
|
32033
32311
|
|
|
32034
32312
|
// src/providers/provider-resolver.ts
|
|
@@ -32045,6 +32323,24 @@ __export(exports_provider_resolver, {
|
|
|
32045
32323
|
import { existsSync as existsSync12 } from "fs";
|
|
32046
32324
|
import { join as join12 } from "path";
|
|
32047
32325
|
import { homedir as homedir11 } from "os";
|
|
32326
|
+
function getApiKeyInfoForProvider(providerName) {
|
|
32327
|
+
const lookupName = providerName === "gemini" ? "google" : providerName;
|
|
32328
|
+
const info = getApiKeyInfo(lookupName);
|
|
32329
|
+
if (info) {
|
|
32330
|
+
return {
|
|
32331
|
+
envVar: info.envVar,
|
|
32332
|
+
description: info.description,
|
|
32333
|
+
url: info.url,
|
|
32334
|
+
aliases: info.aliases,
|
|
32335
|
+
oauthFallback: info.oauthFallback
|
|
32336
|
+
};
|
|
32337
|
+
}
|
|
32338
|
+
return {
|
|
32339
|
+
envVar: "",
|
|
32340
|
+
description: `${providerName} API Key`,
|
|
32341
|
+
url: ""
|
|
32342
|
+
};
|
|
32343
|
+
}
|
|
32048
32344
|
function isApiKeyAvailable(info) {
|
|
32049
32345
|
if (!info.envVar) {
|
|
32050
32346
|
return true;
|
|
@@ -32345,105 +32641,21 @@ var init_provider_resolver = __esm(() => {
|
|
|
32345
32641
|
init_remote_provider_registry();
|
|
32346
32642
|
init_auto_route();
|
|
32347
32643
|
init_model_parser();
|
|
32348
|
-
|
|
32349
|
-
|
|
32350
|
-
|
|
32351
|
-
|
|
32352
|
-
url: "https://openrouter.ai/keys"
|
|
32353
|
-
},
|
|
32354
|
-
gemini: {
|
|
32355
|
-
envVar: "GEMINI_API_KEY",
|
|
32356
|
-
description: "Google Gemini API Key",
|
|
32357
|
-
url: "https://aistudio.google.com/app/apikey"
|
|
32358
|
-
},
|
|
32359
|
-
"gemini-codeassist": {
|
|
32360
|
-
envVar: "",
|
|
32361
|
-
description: "Gemini Code Assist (OAuth)",
|
|
32362
|
-
url: "https://cloud.google.com/code-assist"
|
|
32363
|
-
},
|
|
32364
|
-
vertex: {
|
|
32365
|
-
envVar: "VERTEX_API_KEY",
|
|
32366
|
-
description: "Vertex AI API Key",
|
|
32367
|
-
url: "https://console.cloud.google.com/vertex-ai",
|
|
32368
|
-
aliases: ["VERTEX_PROJECT"]
|
|
32369
|
-
},
|
|
32370
|
-
openai: {
|
|
32371
|
-
envVar: "OPENAI_API_KEY",
|
|
32372
|
-
description: "OpenAI API Key",
|
|
32373
|
-
url: "https://platform.openai.com/api-keys"
|
|
32374
|
-
},
|
|
32375
|
-
minimax: {
|
|
32376
|
-
envVar: "MINIMAX_API_KEY",
|
|
32377
|
-
description: "MiniMax API Key",
|
|
32378
|
-
url: "https://www.minimaxi.com/"
|
|
32379
|
-
},
|
|
32380
|
-
"minimax-coding": {
|
|
32381
|
-
envVar: "MINIMAX_CODING_API_KEY",
|
|
32382
|
-
description: "MiniMax Coding Plan API Key",
|
|
32383
|
-
url: "https://platform.minimax.io/user-center/basic-information/interface-key"
|
|
32384
|
-
},
|
|
32385
|
-
kimi: {
|
|
32386
|
-
envVar: "MOONSHOT_API_KEY",
|
|
32387
|
-
description: "Kimi/Moonshot API Key",
|
|
32388
|
-
url: "https://platform.moonshot.cn/",
|
|
32389
|
-
aliases: ["KIMI_API_KEY"]
|
|
32390
|
-
},
|
|
32391
|
-
"kimi-coding": {
|
|
32392
|
-
envVar: "KIMI_CODING_API_KEY",
|
|
32393
|
-
description: "Kimi Coding API Key",
|
|
32394
|
-
url: "https://kimi.com/code (get key from membership page, or run: claudish --kimi-login)",
|
|
32395
|
-
oauthFallback: "kimi-oauth.json"
|
|
32396
|
-
},
|
|
32397
|
-
glm: {
|
|
32398
|
-
envVar: "ZHIPU_API_KEY",
|
|
32399
|
-
description: "GLM/Zhipu API Key",
|
|
32400
|
-
url: "https://open.bigmodel.cn/",
|
|
32401
|
-
aliases: ["GLM_API_KEY"]
|
|
32402
|
-
},
|
|
32403
|
-
"glm-coding": {
|
|
32404
|
-
envVar: "GLM_CODING_API_KEY",
|
|
32405
|
-
description: "GLM Coding Plan API Key",
|
|
32406
|
-
url: "https://z.ai/subscribe",
|
|
32407
|
-
aliases: ["ZAI_CODING_API_KEY"]
|
|
32408
|
-
},
|
|
32409
|
-
ollamacloud: {
|
|
32410
|
-
envVar: "OLLAMA_API_KEY",
|
|
32411
|
-
description: "OllamaCloud API Key",
|
|
32412
|
-
url: "https://ollama.com/account"
|
|
32413
|
-
},
|
|
32414
|
-
"opencode-zen": {
|
|
32415
|
-
envVar: "",
|
|
32416
|
-
description: "OpenCode Zen (Free)",
|
|
32417
|
-
url: "https://opencode.ai/"
|
|
32418
|
-
},
|
|
32419
|
-
zai: {
|
|
32420
|
-
envVar: "ZAI_API_KEY",
|
|
32421
|
-
description: "Z.AI API Key",
|
|
32422
|
-
url: "https://z.ai/"
|
|
32644
|
+
init_provider_definitions();
|
|
32645
|
+
API_KEY_INFO = new Proxy({}, {
|
|
32646
|
+
get(_target, prop) {
|
|
32647
|
+
return getApiKeyInfoForProvider(prop);
|
|
32423
32648
|
},
|
|
32424
|
-
|
|
32425
|
-
|
|
32426
|
-
description: "LiteLLM API Key",
|
|
32427
|
-
url: "https://docs.litellm.ai/"
|
|
32649
|
+
has() {
|
|
32650
|
+
return true;
|
|
32428
32651
|
}
|
|
32429
|
-
};
|
|
32430
|
-
PROVIDER_DISPLAY_NAMES = {
|
|
32431
|
-
|
|
32432
|
-
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
32436
|
-
minimax: "MiniMax",
|
|
32437
|
-
"minimax-coding": "MiniMax Coding",
|
|
32438
|
-
kimi: "Kimi",
|
|
32439
|
-
"kimi-coding": "Kimi Coding",
|
|
32440
|
-
glm: "GLM",
|
|
32441
|
-
"glm-coding": "GLM Coding",
|
|
32442
|
-
zai: "Z.AI",
|
|
32443
|
-
ollamacloud: "OllamaCloud",
|
|
32444
|
-
"opencode-zen": "OpenCode Zen",
|
|
32445
|
-
litellm: "LiteLLM"
|
|
32446
|
-
};
|
|
32652
|
+
});
|
|
32653
|
+
PROVIDER_DISPLAY_NAMES = new Proxy({}, {
|
|
32654
|
+
get(_target, prop) {
|
|
32655
|
+
const lookupName = prop === "gemini" ? "google" : prop;
|
|
32656
|
+
return getDisplayName(lookupName);
|
|
32657
|
+
}
|
|
32658
|
+
});
|
|
32447
32659
|
});
|
|
32448
32660
|
|
|
32449
32661
|
// src/adapters/tool-name-utils.ts
|
|
@@ -32772,6 +32984,12 @@ var init_openai_tools = __esm(() => {
|
|
|
32772
32984
|
});
|
|
32773
32985
|
|
|
32774
32986
|
// src/adapters/base-adapter.ts
|
|
32987
|
+
function matchesModelFamily(modelId, family) {
|
|
32988
|
+
const lower = modelId.toLowerCase();
|
|
32989
|
+
const fam = family.toLowerCase();
|
|
32990
|
+
return lower.startsWith(fam) || lower.includes(`/${fam}`);
|
|
32991
|
+
}
|
|
32992
|
+
|
|
32775
32993
|
class BaseModelAdapter {
|
|
32776
32994
|
modelId;
|
|
32777
32995
|
toolNameMap = new Map;
|
|
@@ -32967,7 +33185,7 @@ var init_grok_adapter = __esm(() => {
|
|
|
32967
33185
|
return params;
|
|
32968
33186
|
}
|
|
32969
33187
|
shouldHandle(modelId) {
|
|
32970
|
-
return modelId
|
|
33188
|
+
return matchesModelFamily(modelId, "grok") || modelId.toLowerCase().includes("x-ai/");
|
|
32971
33189
|
}
|
|
32972
33190
|
getName() {
|
|
32973
33191
|
return "GrokAdapter";
|
|
@@ -34224,7 +34442,7 @@ CRITICAL INSTRUCTION FOR OUTPUT FORMAT:
|
|
|
34224
34442
|
return 1048576;
|
|
34225
34443
|
}
|
|
34226
34444
|
shouldHandle(modelId) {
|
|
34227
|
-
return modelId
|
|
34445
|
+
return matchesModelFamily(modelId, "gemini") || modelId.toLowerCase().includes("google/");
|
|
34228
34446
|
}
|
|
34229
34447
|
getName() {
|
|
34230
34448
|
return "GeminiAdapter";
|
|
@@ -34277,7 +34495,7 @@ var init_codex_adapter = __esm(() => {
|
|
|
34277
34495
|
};
|
|
34278
34496
|
}
|
|
34279
34497
|
shouldHandle(modelId) {
|
|
34280
|
-
return modelId
|
|
34498
|
+
return matchesModelFamily(modelId, "codex");
|
|
34281
34499
|
}
|
|
34282
34500
|
getName() {
|
|
34283
34501
|
return "CodexAdapter";
|
|
@@ -34551,8 +34769,7 @@ var init_qwen_adapter = __esm(() => {
|
|
|
34551
34769
|
return request;
|
|
34552
34770
|
}
|
|
34553
34771
|
shouldHandle(modelId) {
|
|
34554
|
-
|
|
34555
|
-
return lower.includes("qwen") || lower.includes("alibaba");
|
|
34772
|
+
return matchesModelFamily(modelId, "qwen") || matchesModelFamily(modelId, "alibaba");
|
|
34556
34773
|
}
|
|
34557
34774
|
getName() {
|
|
34558
34775
|
return "QwenAdapter";
|
|
@@ -34582,7 +34799,7 @@ var init_minimax_adapter = __esm(() => {
|
|
|
34582
34799
|
return request;
|
|
34583
34800
|
}
|
|
34584
34801
|
shouldHandle(modelId) {
|
|
34585
|
-
return modelId
|
|
34802
|
+
return matchesModelFamily(modelId, "minimax");
|
|
34586
34803
|
}
|
|
34587
34804
|
getName() {
|
|
34588
34805
|
return "MiniMaxAdapter";
|
|
@@ -34611,7 +34828,7 @@ var init_deepseek_adapter = __esm(() => {
|
|
|
34611
34828
|
return request;
|
|
34612
34829
|
}
|
|
34613
34830
|
shouldHandle(modelId) {
|
|
34614
|
-
return modelId
|
|
34831
|
+
return matchesModelFamily(modelId, "deepseek");
|
|
34615
34832
|
}
|
|
34616
34833
|
getName() {
|
|
34617
34834
|
return "DeepSeekAdapter";
|
|
@@ -34660,7 +34877,7 @@ var init_glm_adapter = __esm(() => {
|
|
|
34660
34877
|
return request;
|
|
34661
34878
|
}
|
|
34662
34879
|
shouldHandle(modelId) {
|
|
34663
|
-
return modelId
|
|
34880
|
+
return matchesModelFamily(modelId, "glm-") || matchesModelFamily(modelId, "chatglm-") || modelId.toLowerCase().includes("zhipu/");
|
|
34664
34881
|
}
|
|
34665
34882
|
getName() {
|
|
34666
34883
|
return "GLMAdapter";
|
|
@@ -34708,8 +34925,7 @@ var init_xiaomi_adapter = __esm(() => {
|
|
|
34708
34925
|
return request;
|
|
34709
34926
|
}
|
|
34710
34927
|
shouldHandle(modelId) {
|
|
34711
|
-
|
|
34712
|
-
return lower.includes("xiaomi") || lower.includes("mimo");
|
|
34928
|
+
return matchesModelFamily(modelId, "xiaomi") || matchesModelFamily(modelId, "mimo");
|
|
34713
34929
|
}
|
|
34714
34930
|
getName() {
|
|
34715
34931
|
return "XiaomiAdapter";
|
|
@@ -36373,7 +36589,7 @@ async function fetchGLMCodingModels() {
|
|
|
36373
36589
|
return [];
|
|
36374
36590
|
}
|
|
36375
36591
|
}
|
|
36376
|
-
var __filename4, __dirname4, VERSION = "5.
|
|
36592
|
+
var __filename4, __dirname4, VERSION = "5.16.0", CACHE_MAX_AGE_DAYS2 = 2, CLAUDISH_CACHE_DIR2, BUNDLED_MODELS_PATH, CACHED_MODELS_PATH, ALL_MODELS_JSON_PATH;
|
|
36377
36593
|
var init_cli = __esm(() => {
|
|
36378
36594
|
init_config();
|
|
36379
36595
|
init_model_loader();
|
|
@@ -83471,9 +83687,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
83471
83687
|
}
|
|
83472
83688
|
function getWrappedDisplayName(outerType, innerType, wrapperName, fallbackName) {
|
|
83473
83689
|
var displayName = outerType === null || outerType === undefined ? undefined : outerType.displayName;
|
|
83474
|
-
return displayName || "".concat(wrapperName, "(").concat(
|
|
83690
|
+
return displayName || "".concat(wrapperName, "(").concat(getDisplayName2(innerType, fallbackName), ")");
|
|
83475
83691
|
}
|
|
83476
|
-
function
|
|
83692
|
+
function getDisplayName2(type) {
|
|
83477
83693
|
var fallbackName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Anonymous";
|
|
83478
83694
|
var nameFromCache = cachedDisplayNames.get(type);
|
|
83479
83695
|
if (nameFromCache != null) {
|
|
@@ -84016,7 +84232,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
84016
84232
|
if (typeof type === "string") {
|
|
84017
84233
|
return type;
|
|
84018
84234
|
} else if (typeof type === "function") {
|
|
84019
|
-
return
|
|
84235
|
+
return getDisplayName2(type, "Anonymous");
|
|
84020
84236
|
} else if (type != null) {
|
|
84021
84237
|
return "NotImplementedInDevtools";
|
|
84022
84238
|
} else {
|
|
@@ -89944,7 +90160,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
89944
90160
|
case IncompleteFunctionComponent:
|
|
89945
90161
|
case FunctionComponent:
|
|
89946
90162
|
case IndeterminateComponent:
|
|
89947
|
-
return
|
|
90163
|
+
return getDisplayName2(resolvedType);
|
|
89948
90164
|
case ForwardRef:
|
|
89949
90165
|
return getWrappedDisplayName(elementType, resolvedType, "ForwardRef", "Anonymous");
|
|
89950
90166
|
case HostRoot:
|
|
@@ -94899,7 +95115,7 @@ The error thrown in the component is:
|
|
|
94899
95115
|
if (typeof elementType === "string") {
|
|
94900
95116
|
displayName = elementType;
|
|
94901
95117
|
} else if (typeof elementType === "function") {
|
|
94902
|
-
displayName =
|
|
95118
|
+
displayName = getDisplayName2(elementType);
|
|
94903
95119
|
}
|
|
94904
95120
|
}
|
|
94905
95121
|
return {
|
|
@@ -99326,7 +99542,7 @@ function mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine) {
|
|
|
99326
99542
|
}
|
|
99327
99543
|
config3.claudeArgs.splice(idx, 2);
|
|
99328
99544
|
}
|
|
99329
|
-
async function runClaudeWithProxy(config3, proxyUrl) {
|
|
99545
|
+
async function runClaudeWithProxy(config3, proxyUrl, onCleanup) {
|
|
99330
99546
|
const hasProfileMappings = config3.modelOpus || config3.modelSonnet || config3.modelHaiku || config3.modelSubagent;
|
|
99331
99547
|
const modelId = config3.model || (hasProfileMappings || config3.monitor ? undefined : "unknown");
|
|
99332
99548
|
const portMatch = proxyUrl.match(/:(\d+)/);
|
|
@@ -99418,7 +99634,7 @@ Or set CLAUDE_PATH to your custom installation:`);
|
|
|
99418
99634
|
stdio: "inherit",
|
|
99419
99635
|
shell: needsShell
|
|
99420
99636
|
});
|
|
99421
|
-
setupSignalHandlers(proc, tempSettingsPath, config3.quiet);
|
|
99637
|
+
setupSignalHandlers(proc, tempSettingsPath, config3.quiet, onCleanup);
|
|
99422
99638
|
const exitCode = await new Promise((resolve3) => {
|
|
99423
99639
|
proc.on("exit", (code) => {
|
|
99424
99640
|
resolve3(code ?? 1);
|
|
@@ -99429,7 +99645,7 @@ Or set CLAUDE_PATH to your custom installation:`);
|
|
|
99429
99645
|
} catch (error46) {}
|
|
99430
99646
|
return exitCode;
|
|
99431
99647
|
}
|
|
99432
|
-
function setupSignalHandlers(proc, tempSettingsPath, quiet) {
|
|
99648
|
+
function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
|
|
99433
99649
|
const signals2 = isWindows2() ? ["SIGINT", "SIGTERM"] : ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
99434
99650
|
for (const signal of signals2) {
|
|
99435
99651
|
process.on(signal, () => {
|
|
@@ -99438,6 +99654,11 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet) {
|
|
|
99438
99654
|
[claudish] Received ${signal}, shutting down...`);
|
|
99439
99655
|
}
|
|
99440
99656
|
proc.kill();
|
|
99657
|
+
if (onCleanup) {
|
|
99658
|
+
try {
|
|
99659
|
+
onCleanup();
|
|
99660
|
+
} catch {}
|
|
99661
|
+
}
|
|
99441
99662
|
try {
|
|
99442
99663
|
unlinkSync7(tempSettingsPath);
|
|
99443
99664
|
} catch {}
|
|
@@ -99521,6 +99742,105 @@ var init_claude_runner = __esm(() => {
|
|
|
99521
99742
|
init_model_parser();
|
|
99522
99743
|
});
|
|
99523
99744
|
|
|
99745
|
+
// src/diag-output.ts
|
|
99746
|
+
var exports_diag_output = {};
|
|
99747
|
+
__export(exports_diag_output, {
|
|
99748
|
+
createDiagOutput: () => createDiagOutput,
|
|
99749
|
+
TmuxDiagOutput: () => TmuxDiagOutput,
|
|
99750
|
+
NullDiagOutput: () => NullDiagOutput,
|
|
99751
|
+
LogFileDiagOutput: () => LogFileDiagOutput
|
|
99752
|
+
});
|
|
99753
|
+
import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync11, writeFileSync as writeFileSync12, unlinkSync as unlinkSync8 } from "fs";
|
|
99754
|
+
import { execFileSync } from "child_process";
|
|
99755
|
+
import { homedir as homedir17 } from "os";
|
|
99756
|
+
import { join as join20 } from "path";
|
|
99757
|
+
function getClaudishDir() {
|
|
99758
|
+
const dir = join20(homedir17(), ".claudish");
|
|
99759
|
+
try {
|
|
99760
|
+
mkdirSync11(dir, { recursive: true });
|
|
99761
|
+
} catch {}
|
|
99762
|
+
return dir;
|
|
99763
|
+
}
|
|
99764
|
+
function getDiagLogPath() {
|
|
99765
|
+
return join20(getClaudishDir(), `diag-${process.pid}.log`);
|
|
99766
|
+
}
|
|
99767
|
+
|
|
99768
|
+
class LogFileDiagOutput {
|
|
99769
|
+
logPath;
|
|
99770
|
+
stream;
|
|
99771
|
+
constructor() {
|
|
99772
|
+
this.logPath = getDiagLogPath();
|
|
99773
|
+
try {
|
|
99774
|
+
writeFileSync12(this.logPath, `--- claudish diag session ${new Date().toISOString()} ---
|
|
99775
|
+
`);
|
|
99776
|
+
} catch {}
|
|
99777
|
+
this.stream = createWriteStream2(this.logPath, { flags: "a" });
|
|
99778
|
+
this.stream.on("error", () => {});
|
|
99779
|
+
}
|
|
99780
|
+
write(msg) {
|
|
99781
|
+
const timestamp = new Date().toISOString();
|
|
99782
|
+
const line = `[${timestamp}] ${msg}
|
|
99783
|
+
`;
|
|
99784
|
+
try {
|
|
99785
|
+
this.stream.write(line);
|
|
99786
|
+
} catch {}
|
|
99787
|
+
}
|
|
99788
|
+
cleanup() {
|
|
99789
|
+
try {
|
|
99790
|
+
this.stream.end();
|
|
99791
|
+
} catch {}
|
|
99792
|
+
try {
|
|
99793
|
+
unlinkSync8(this.logPath);
|
|
99794
|
+
} catch {}
|
|
99795
|
+
}
|
|
99796
|
+
getLogPath() {
|
|
99797
|
+
return this.logPath;
|
|
99798
|
+
}
|
|
99799
|
+
}
|
|
99800
|
+
|
|
99801
|
+
class NullDiagOutput {
|
|
99802
|
+
write(_msg) {}
|
|
99803
|
+
cleanup() {}
|
|
99804
|
+
}
|
|
99805
|
+
function createDiagOutput(options) {
|
|
99806
|
+
if (!options.interactive) {
|
|
99807
|
+
return new NullDiagOutput;
|
|
99808
|
+
}
|
|
99809
|
+
if (process.env.TMUX) {
|
|
99810
|
+
return new TmuxDiagOutput;
|
|
99811
|
+
}
|
|
99812
|
+
return new LogFileDiagOutput;
|
|
99813
|
+
}
|
|
99814
|
+
var TmuxDiagOutput;
|
|
99815
|
+
var init_diag_output = __esm(() => {
|
|
99816
|
+
TmuxDiagOutput = class TmuxDiagOutput extends LogFileDiagOutput {
|
|
99817
|
+
paneId = null;
|
|
99818
|
+
constructor() {
|
|
99819
|
+
super();
|
|
99820
|
+
this.openTmuxPane();
|
|
99821
|
+
}
|
|
99822
|
+
openTmuxPane() {
|
|
99823
|
+
try {
|
|
99824
|
+
const output = execFileSync("tmux", ["split-window", "-v", "-l", "5", "-d", "-P", "-F", "#{pane_id}", "tail", "-f", this.logPath], { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
99825
|
+
this.paneId = output.trim();
|
|
99826
|
+
} catch {
|
|
99827
|
+
this.paneId = null;
|
|
99828
|
+
}
|
|
99829
|
+
}
|
|
99830
|
+
cleanup() {
|
|
99831
|
+
if (this.paneId) {
|
|
99832
|
+
try {
|
|
99833
|
+
execFileSync("tmux", ["kill-pane", "-t", this.paneId], {
|
|
99834
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
99835
|
+
});
|
|
99836
|
+
} catch {}
|
|
99837
|
+
this.paneId = null;
|
|
99838
|
+
}
|
|
99839
|
+
super.cleanup();
|
|
99840
|
+
}
|
|
99841
|
+
};
|
|
99842
|
+
});
|
|
99843
|
+
|
|
99524
99844
|
// src/port-manager.ts
|
|
99525
99845
|
var exports_port_manager = {};
|
|
99526
99846
|
__export(exports_port_manager, {
|
|
@@ -103104,9 +103424,9 @@ var init_middleware = __esm(() => {
|
|
|
103104
103424
|
});
|
|
103105
103425
|
|
|
103106
103426
|
// src/handlers/shared/token-tracker.ts
|
|
103107
|
-
import { mkdirSync as
|
|
103108
|
-
import { homedir as
|
|
103109
|
-
import { join as
|
|
103427
|
+
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync13 } from "fs";
|
|
103428
|
+
import { homedir as homedir18 } from "os";
|
|
103429
|
+
import { join as join21 } from "path";
|
|
103110
103430
|
|
|
103111
103431
|
class TokenTracker {
|
|
103112
103432
|
port;
|
|
@@ -103220,9 +103540,9 @@ class TokenTracker {
|
|
|
103220
103540
|
is_free: isFreeModel,
|
|
103221
103541
|
is_estimated: isEstimate || false
|
|
103222
103542
|
};
|
|
103223
|
-
const claudishDir =
|
|
103224
|
-
|
|
103225
|
-
|
|
103543
|
+
const claudishDir = join21(homedir18(), ".claudish");
|
|
103544
|
+
mkdirSync12(claudishDir, { recursive: true });
|
|
103545
|
+
writeFileSync13(join21(claudishDir, `tokens-${this.port}.json`), JSON.stringify(data), "utf-8");
|
|
103226
103546
|
} catch (e) {
|
|
103227
103547
|
log(`[TokenTracker] Error writing token file: ${e}`);
|
|
103228
103548
|
}
|
|
@@ -104643,9 +104963,9 @@ var init_composed_handler = __esm(() => {
|
|
|
104643
104963
|
});
|
|
104644
104964
|
|
|
104645
104965
|
// src/services/pricing-cache.ts
|
|
104646
|
-
import { readFileSync as readFileSync17, writeFileSync as
|
|
104647
|
-
import { homedir as
|
|
104648
|
-
import { join as
|
|
104966
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync14, existsSync as existsSync19, mkdirSync as mkdirSync13, statSync as statSync2 } from "fs";
|
|
104967
|
+
import { homedir as homedir19 } from "os";
|
|
104968
|
+
import { join as join22 } from "path";
|
|
104649
104969
|
function getDynamicPricingSync(provider, modelName) {
|
|
104650
104970
|
if (provider === "openrouter") {
|
|
104651
104971
|
const direct = pricingMap.get(modelName);
|
|
@@ -104727,12 +105047,12 @@ function loadDiskCache() {
|
|
|
104727
105047
|
}
|
|
104728
105048
|
function saveDiskCache() {
|
|
104729
105049
|
try {
|
|
104730
|
-
|
|
105050
|
+
mkdirSync13(CACHE_DIR, { recursive: true });
|
|
104731
105051
|
const data = {};
|
|
104732
105052
|
for (const [key, pricing] of pricingMap) {
|
|
104733
105053
|
data[key] = pricing;
|
|
104734
105054
|
}
|
|
104735
|
-
|
|
105055
|
+
writeFileSync14(CACHE_FILE, JSON.stringify(data), "utf-8");
|
|
104736
105056
|
} catch (error46) {
|
|
104737
105057
|
log(`[PricingCache] Error saving disk cache: ${error46}`);
|
|
104738
105058
|
}
|
|
@@ -104762,8 +105082,8 @@ var init_pricing_cache = __esm(() => {
|
|
|
104762
105082
|
init_model_loader();
|
|
104763
105083
|
init_remote_provider_types();
|
|
104764
105084
|
pricingMap = new Map;
|
|
104765
|
-
CACHE_DIR =
|
|
104766
|
-
CACHE_FILE =
|
|
105085
|
+
CACHE_DIR = join22(homedir19(), ".claudish");
|
|
105086
|
+
CACHE_FILE = join22(CACHE_DIR, "pricing-cache.json");
|
|
104767
105087
|
CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
104768
105088
|
PROVIDER_TO_OR_PREFIX = {
|
|
104769
105089
|
openai: ["openai/"],
|
|
@@ -105223,9 +105543,9 @@ class AnthropicCompatProvider {
|
|
|
105223
105543
|
if (this.provider.name === "kimi-coding" && !this.apiKey) {
|
|
105224
105544
|
try {
|
|
105225
105545
|
const { existsSync: existsSync20, readFileSync: readFileSync18 } = await import("fs");
|
|
105226
|
-
const { join:
|
|
105227
|
-
const { homedir:
|
|
105228
|
-
const credPath =
|
|
105546
|
+
const { join: join23 } = await import("path");
|
|
105547
|
+
const { homedir: homedir20 } = await import("os");
|
|
105548
|
+
const credPath = join23(homedir20(), ".claudish", "kimi-oauth.json");
|
|
105229
105549
|
if (existsSync20(credPath)) {
|
|
105230
105550
|
const data = JSON.parse(readFileSync18(credPath, "utf-8"));
|
|
105231
105551
|
if (data.access_token && data.refresh_token) {
|
|
@@ -105538,8 +105858,8 @@ var init_litellm2 = __esm(() => {
|
|
|
105538
105858
|
// src/adapters/litellm-adapter.ts
|
|
105539
105859
|
import { existsSync as existsSync20, readFileSync as readFileSync18 } from "fs";
|
|
105540
105860
|
import { createHash as createHash5 } from "crypto";
|
|
105541
|
-
import { homedir as
|
|
105542
|
-
import { join as
|
|
105861
|
+
import { homedir as homedir20 } from "os";
|
|
105862
|
+
import { join as join23 } from "path";
|
|
105543
105863
|
var INLINE_IMAGE_MODEL_PATTERNS, LiteLLMAdapter;
|
|
105544
105864
|
var init_litellm_adapter = __esm(() => {
|
|
105545
105865
|
init_base_adapter();
|
|
@@ -105635,7 +105955,7 @@ var init_litellm_adapter = __esm(() => {
|
|
|
105635
105955
|
checkVisionSupport() {
|
|
105636
105956
|
try {
|
|
105637
105957
|
const hash2 = createHash5("sha256").update(this.baseUrl).digest("hex").substring(0, 16);
|
|
105638
|
-
const cachePath =
|
|
105958
|
+
const cachePath = join23(homedir20(), ".claudish", `litellm-models-${hash2}.json`);
|
|
105639
105959
|
if (!existsSync20(cachePath))
|
|
105640
105960
|
return true;
|
|
105641
105961
|
const cacheData = JSON.parse(readFileSync18(cachePath, "utf-8"));
|
|
@@ -105656,8 +105976,8 @@ var init_litellm_adapter = __esm(() => {
|
|
|
105656
105976
|
import { exec as exec4 } from "child_process";
|
|
105657
105977
|
import { promisify as promisify3 } from "util";
|
|
105658
105978
|
import { existsSync as existsSync21 } from "fs";
|
|
105659
|
-
import { homedir as
|
|
105660
|
-
import { join as
|
|
105979
|
+
import { homedir as homedir21 } from "os";
|
|
105980
|
+
import { join as join24 } from "path";
|
|
105661
105981
|
|
|
105662
105982
|
class VertexAuthManager {
|
|
105663
105983
|
cachedToken = null;
|
|
@@ -105711,7 +106031,7 @@ class VertexAuthManager {
|
|
|
105711
106031
|
}
|
|
105712
106032
|
async tryADC() {
|
|
105713
106033
|
try {
|
|
105714
|
-
const adcPath =
|
|
106034
|
+
const adcPath = join24(homedir21(), ".config/gcloud/application_default_credentials.json");
|
|
105715
106035
|
if (!existsSync21(adcPath)) {
|
|
105716
106036
|
log("[VertexAuth] ADC credentials file not found");
|
|
105717
106037
|
return null;
|
|
@@ -105775,7 +106095,7 @@ function validateVertexOAuthConfig() {
|
|
|
105775
106095
|
` + ` export VERTEX_PROJECT='your-gcp-project-id'
|
|
105776
106096
|
` + " export VERTEX_LOCATION='us-central1' # optional";
|
|
105777
106097
|
}
|
|
105778
|
-
const adcPath =
|
|
106098
|
+
const adcPath = join24(homedir21(), ".config/gcloud/application_default_credentials.json");
|
|
105779
106099
|
const hasADC = existsSync21(adcPath);
|
|
105780
106100
|
const hasServiceAccount = !!process.env.GOOGLE_APPLICATION_CREDENTIALS;
|
|
105781
106101
|
if (!hasADC && !hasServiceAccount) {
|
|
@@ -106413,12 +106733,12 @@ var init_proxy_server = __esm(() => {
|
|
|
106413
106733
|
// src/index.ts
|
|
106414
106734
|
var import_dotenv2 = __toESM(require_main(), 1);
|
|
106415
106735
|
import { existsSync as existsSync23, readFileSync as readFileSync20 } from "fs";
|
|
106416
|
-
import { homedir as
|
|
106417
|
-
import { join as
|
|
106736
|
+
import { homedir as homedir22 } from "os";
|
|
106737
|
+
import { join as join25 } from "path";
|
|
106418
106738
|
import_dotenv2.config({ quiet: true });
|
|
106419
106739
|
function loadStoredApiKeys() {
|
|
106420
106740
|
try {
|
|
106421
|
-
const configPath =
|
|
106741
|
+
const configPath = join25(homedir22(), ".claudish", "config.json");
|
|
106422
106742
|
if (!existsSync23(configPath))
|
|
106423
106743
|
return;
|
|
106424
106744
|
const raw2 = readFileSync20(configPath, "utf-8");
|
|
@@ -106554,7 +106874,8 @@ async function runCli() {
|
|
|
106554
106874
|
getMissingKeyResolutions: getMissingKeyResolutions2,
|
|
106555
106875
|
getMissingKeysError: getMissingKeysError2
|
|
106556
106876
|
} = await Promise.resolve().then(() => (init_provider_resolver(), exports_provider_resolver));
|
|
106557
|
-
const { initLogger: initLogger2, getLogFilePath: getLogFilePath2, getAlwaysOnLogPath: getAlwaysOnLogPath2,
|
|
106877
|
+
const { initLogger: initLogger2, getLogFilePath: getLogFilePath2, getAlwaysOnLogPath: getAlwaysOnLogPath2, setDiagOutput: setDiagOutput2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
|
|
106878
|
+
const { createDiagOutput: createDiagOutput2, LogFileDiagOutput: LogFileDiagOutput2 } = await Promise.resolve().then(() => (init_diag_output(), exports_diag_output));
|
|
106558
106879
|
const { findAvailablePort: findAvailablePort2 } = await Promise.resolve().then(() => (init_port_manager(), exports_port_manager));
|
|
106559
106880
|
const { createProxyServer: createProxyServer2 } = await Promise.resolve().then(() => (init_proxy_server(), exports_proxy_server));
|
|
106560
106881
|
const { checkForUpdates: checkForUpdates2 } = await Promise.resolve().then(() => (init_update_checker(), exports_update_checker));
|
|
@@ -106672,14 +106993,19 @@ async function runCli() {
|
|
|
106672
106993
|
quiet: cliConfig.quiet,
|
|
106673
106994
|
isInteractive: cliConfig.interactive
|
|
106674
106995
|
});
|
|
106996
|
+
const diag = createDiagOutput2({ interactive: cliConfig.interactive });
|
|
106675
106997
|
if (cliConfig.interactive) {
|
|
106676
|
-
|
|
106998
|
+
setDiagOutput2(diag);
|
|
106999
|
+
if (!process.env.TMUX && !cliConfig.quiet && diag instanceof LogFileDiagOutput2) {
|
|
107000
|
+
console.log(`[claudish] Diagnostic log: ${diag.getLogPath()}`);
|
|
107001
|
+
}
|
|
106677
107002
|
}
|
|
106678
107003
|
let exitCode = 0;
|
|
106679
107004
|
try {
|
|
106680
|
-
exitCode = await runClaudeWithProxy2(cliConfig, proxy.url);
|
|
107005
|
+
exitCode = await runClaudeWithProxy2(cliConfig, proxy.url, () => diag.cleanup());
|
|
106681
107006
|
} finally {
|
|
106682
|
-
|
|
107007
|
+
setDiagOutput2(null);
|
|
107008
|
+
diag.cleanup();
|
|
106683
107009
|
if (!cliConfig.quiet) {
|
|
106684
107010
|
console.log(`
|
|
106685
107011
|
[claudish] Shutting down proxy server...`);
|