claudish 7.4.0 → 7.5.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 +312 -183
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -26554,7 +26554,7 @@ var init_provider_definitions = __esm(() => {
|
|
|
26554
26554
|
description: "580+ models, default backend (or@)"
|
|
26555
26555
|
},
|
|
26556
26556
|
{
|
|
26557
|
-
name: "
|
|
26557
|
+
name: "x-ai",
|
|
26558
26558
|
displayName: "xAI",
|
|
26559
26559
|
transport: "openai",
|
|
26560
26560
|
tokenStrategy: "delta-aware",
|
|
@@ -26563,8 +26563,8 @@ var init_provider_definitions = __esm(() => {
|
|
|
26563
26563
|
apiKeyEnvVar: "XAI_API_KEY",
|
|
26564
26564
|
apiKeyDescription: "xAI API Key",
|
|
26565
26565
|
apiKeyUrl: "https://console.x.ai/",
|
|
26566
|
-
shortcuts: ["xai", "grok"],
|
|
26567
|
-
shortestPrefix: "
|
|
26566
|
+
shortcuts: ["x-ai", "xai", "grok"],
|
|
26567
|
+
shortestPrefix: "x-ai",
|
|
26568
26568
|
legacyPrefixes: [{ prefix: "xai/", stripPrefix: true }],
|
|
26569
26569
|
nativeModelPatterns: [{ pattern: /^x-ai\//i }, { pattern: /^grok-/i }],
|
|
26570
26570
|
isDirectApi: true
|
|
@@ -26698,7 +26698,7 @@ var init_provider_definitions = __esm(() => {
|
|
|
26698
26698
|
description: "GLM Coding Plan (gc@)"
|
|
26699
26699
|
},
|
|
26700
26700
|
{
|
|
26701
|
-
name: "
|
|
26701
|
+
name: "z-ai",
|
|
26702
26702
|
displayName: "Z.AI",
|
|
26703
26703
|
transport: "anthropic",
|
|
26704
26704
|
baseUrl: "https://api.z.ai",
|
|
@@ -26707,12 +26707,12 @@ var init_provider_definitions = __esm(() => {
|
|
|
26707
26707
|
apiKeyEnvVar: "ZAI_API_KEY",
|
|
26708
26708
|
apiKeyDescription: "Z.AI API Key",
|
|
26709
26709
|
apiKeyUrl: "https://z.ai/",
|
|
26710
|
-
shortcuts: ["zai"],
|
|
26711
|
-
shortestPrefix: "
|
|
26710
|
+
shortcuts: ["z-ai", "zai"],
|
|
26711
|
+
shortestPrefix: "z-ai",
|
|
26712
26712
|
legacyPrefixes: [{ prefix: "zai/", stripPrefix: true }],
|
|
26713
26713
|
nativeModelPatterns: [{ pattern: /^z-ai\//i }, { pattern: /^zai\//i }],
|
|
26714
26714
|
isDirectApi: true,
|
|
26715
|
-
description: "Z.AI API (
|
|
26715
|
+
description: "Z.AI API (z-ai@)"
|
|
26716
26716
|
},
|
|
26717
26717
|
{
|
|
26718
26718
|
name: "ollamacloud",
|
|
@@ -33160,7 +33160,7 @@ var init_vision_proxy = __esm(() => {
|
|
|
33160
33160
|
});
|
|
33161
33161
|
|
|
33162
33162
|
// src/version.ts
|
|
33163
|
-
var VERSION = "7.
|
|
33163
|
+
var VERSION = "7.5.0";
|
|
33164
33164
|
|
|
33165
33165
|
// src/telemetry.ts
|
|
33166
33166
|
var exports_telemetry = {};
|
|
@@ -33582,7 +33582,8 @@ var init_telemetry = __esm(() => {
|
|
|
33582
33582
|
"minimax",
|
|
33583
33583
|
"kimi",
|
|
33584
33584
|
"glm",
|
|
33585
|
-
"
|
|
33585
|
+
"z-ai",
|
|
33586
|
+
"x-ai",
|
|
33586
33587
|
"minimax-coding",
|
|
33587
33588
|
"kimi-coding",
|
|
33588
33589
|
"glm-coding"
|
|
@@ -34968,8 +34969,8 @@ var init_routing_hints = __esm(() => {
|
|
|
34968
34969
|
ollamacloud: { apiKeyEnvVar: "OLLAMA_API_KEY" },
|
|
34969
34970
|
"native-anthropic": { apiKeyEnvVar: "ANTHROPIC_API_KEY" },
|
|
34970
34971
|
openrouter: { apiKeyEnvVar: "OPENROUTER_API_KEY" },
|
|
34971
|
-
|
|
34972
|
-
|
|
34972
|
+
"x-ai": { apiKeyEnvVar: "XAI_API_KEY" },
|
|
34973
|
+
"z-ai": { apiKeyEnvVar: "ZAI_API_KEY" },
|
|
34973
34974
|
"opencode-zen": { apiKeyEnvVar: "OPENCODE_API_KEY" }
|
|
34974
34975
|
};
|
|
34975
34976
|
});
|
|
@@ -35618,8 +35619,8 @@ var init_model_loader = __esm(() => {
|
|
|
35618
35619
|
FIREBASE_SLUG_TO_PROVIDER_NAME = {
|
|
35619
35620
|
openai: "openai",
|
|
35620
35621
|
google: "google",
|
|
35621
|
-
"x-ai": "
|
|
35622
|
-
"z-ai": "
|
|
35622
|
+
"x-ai": "x-ai",
|
|
35623
|
+
"z-ai": "z-ai",
|
|
35623
35624
|
moonshotai: "kimi",
|
|
35624
35625
|
minimax: "minimax",
|
|
35625
35626
|
qwen: "qwen"
|
|
@@ -35874,11 +35875,11 @@ var init_default_routing_rules = __esm(() => {
|
|
|
35874
35875
|
"o1-*": ["openai-codex", "openai", "openrouter"],
|
|
35875
35876
|
"o3-*": ["openai-codex", "openai", "openrouter"],
|
|
35876
35877
|
"gemini-*": ["gemini-codeassist", "google", "openrouter"],
|
|
35877
|
-
"grok-*": ["
|
|
35878
|
+
"grok-*": ["x-ai", "openrouter"],
|
|
35878
35879
|
"kimi-*": ["kimi-coding@kimi-for-coding", "kimi", "openrouter"],
|
|
35879
35880
|
"minimax-*": ["minimax-coding", "minimax", "openrouter"],
|
|
35880
35881
|
"glm-*": ["glm-coding", "glm", "openrouter"],
|
|
35881
|
-
"z-ai-*": ["
|
|
35882
|
+
"z-ai-*": ["z-ai", "openrouter"],
|
|
35882
35883
|
"deepseek-*": ["deepseek", "openrouter"],
|
|
35883
35884
|
"*-zen": ["opencode-zen"],
|
|
35884
35885
|
"*": ["openrouter"]
|
|
@@ -37964,7 +37965,7 @@ class AnthropicProviderTransport {
|
|
|
37964
37965
|
kimi: "Kimi",
|
|
37965
37966
|
"kimi-coding": "Kimi Coding",
|
|
37966
37967
|
moonshot: "Kimi",
|
|
37967
|
-
|
|
37968
|
+
"z-ai": "Z.AI"
|
|
37968
37969
|
};
|
|
37969
37970
|
return map3[name.toLowerCase()] || name.charAt(0).toUpperCase() + name.slice(1);
|
|
37970
37971
|
}
|
|
@@ -38896,13 +38897,13 @@ var init_provider_profiles = __esm(() => {
|
|
|
38896
38897
|
"gemini-codeassist": geminiCodeAssistProfile,
|
|
38897
38898
|
openai: openaiProfile,
|
|
38898
38899
|
"openai-codex": openaiCodexProfile,
|
|
38899
|
-
|
|
38900
|
+
"x-ai": openaiProfile,
|
|
38900
38901
|
qwen: openaiProfile,
|
|
38901
38902
|
minimax: anthropicCompatProfile,
|
|
38902
38903
|
"minimax-coding": anthropicCompatProfile,
|
|
38903
38904
|
kimi: anthropicCompatProfile,
|
|
38904
38905
|
"kimi-coding": anthropicCompatProfile,
|
|
38905
|
-
|
|
38906
|
+
"z-ai": anthropicCompatProfile,
|
|
38906
38907
|
glm: glmProfile,
|
|
38907
38908
|
"glm-coding": glmProfile,
|
|
38908
38909
|
"opencode-zen": openCodeZenProfile,
|
|
@@ -39316,8 +39317,17 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
39316
39317
|
return nativeHandler;
|
|
39317
39318
|
let target = requestedModel;
|
|
39318
39319
|
let wasFromModelMap = false;
|
|
39320
|
+
let slotMatched = false;
|
|
39321
|
+
const slot = options.slotMap?.get(requestedModel);
|
|
39322
|
+
if (slot) {
|
|
39323
|
+
target = slot.provider != null && slot.provider !== "" ? `${slot.provider}@${slot.model}` : slot.model;
|
|
39324
|
+
slotMatched = true;
|
|
39325
|
+
if (!options.quiet) {
|
|
39326
|
+
logStderr(`[Serve] slot ${requestedModel} \u2192 ${target}`);
|
|
39327
|
+
}
|
|
39328
|
+
}
|
|
39319
39329
|
const req = requestedModel.toLowerCase();
|
|
39320
|
-
if (modelMap) {
|
|
39330
|
+
if (slotMatched) {} else if (modelMap) {
|
|
39321
39331
|
if (req.includes("opus") && modelMap.opus) {
|
|
39322
39332
|
target = modelMap.opus;
|
|
39323
39333
|
wasFromModelMap = true;
|
|
@@ -39410,6 +39420,20 @@ ${plan.hint}` : `[Route] ${plan.reason}`;
|
|
|
39410
39420
|
config: { mode: monitorMode ? "monitor" : "hybrid", mappings: modelMap }
|
|
39411
39421
|
}));
|
|
39412
39422
|
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
39423
|
+
const servedSlotIds = options.servedSlotIds ?? [];
|
|
39424
|
+
app.get("/v1/models", (c) => {
|
|
39425
|
+
return c.json({
|
|
39426
|
+
object: "list",
|
|
39427
|
+
has_more: false,
|
|
39428
|
+
data: servedSlotIds.map((id) => ({
|
|
39429
|
+
id,
|
|
39430
|
+
object: "model",
|
|
39431
|
+
type: "model",
|
|
39432
|
+
created: 1716000000,
|
|
39433
|
+
owned_by: "claudish"
|
|
39434
|
+
}))
|
|
39435
|
+
});
|
|
39436
|
+
});
|
|
39413
39437
|
app.get("/v1/probe-discover", async (c) => {
|
|
39414
39438
|
const provider = c.req.query("provider");
|
|
39415
39439
|
if (!provider)
|
|
@@ -40585,6 +40609,201 @@ var init_mcp_server = __esm(() => {
|
|
|
40585
40609
|
]);
|
|
40586
40610
|
});
|
|
40587
40611
|
|
|
40612
|
+
// src/serve-command.ts
|
|
40613
|
+
var exports_serve_command = {};
|
|
40614
|
+
__export(exports_serve_command, {
|
|
40615
|
+
serveCommand: () => serveCommand
|
|
40616
|
+
});
|
|
40617
|
+
import { existsSync as existsSync19, readFileSync as readFileSync16 } from "fs";
|
|
40618
|
+
function parseServeArgs(args) {
|
|
40619
|
+
const out = {};
|
|
40620
|
+
for (let i = 0;i < args.length; i++) {
|
|
40621
|
+
const a = args[i];
|
|
40622
|
+
if (a === "--port" || a === "-p") {
|
|
40623
|
+
const v = args[++i];
|
|
40624
|
+
const n = Number(v);
|
|
40625
|
+
if (!Number.isInteger(n) || n <= 0 || n > 65535) {
|
|
40626
|
+
throw new Error(`--port must be an integer 1-65535 (got ${v ?? "nothing"})`);
|
|
40627
|
+
}
|
|
40628
|
+
out.port = n;
|
|
40629
|
+
} else if (a === "--models" || a === "-m") {
|
|
40630
|
+
out.modelsPath = args[++i];
|
|
40631
|
+
}
|
|
40632
|
+
}
|
|
40633
|
+
return out;
|
|
40634
|
+
}
|
|
40635
|
+
function loadModelMap(path) {
|
|
40636
|
+
if (!existsSync19(path)) {
|
|
40637
|
+
throw new Error(`--models file not found: ${path}`);
|
|
40638
|
+
}
|
|
40639
|
+
let raw2;
|
|
40640
|
+
try {
|
|
40641
|
+
raw2 = readFileSync16(path, "utf-8");
|
|
40642
|
+
} catch (e) {
|
|
40643
|
+
throw new Error(`failed to read --models file ${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
40644
|
+
}
|
|
40645
|
+
let parsed;
|
|
40646
|
+
try {
|
|
40647
|
+
parsed = JSON.parse(raw2);
|
|
40648
|
+
} catch (e) {
|
|
40649
|
+
throw new Error(`--models file is not valid JSON: ${e instanceof Error ? e.message : String(e)}`);
|
|
40650
|
+
}
|
|
40651
|
+
if (!Array.isArray(parsed)) {
|
|
40652
|
+
throw new Error(`--models file must contain a JSON array of { slot, model, provider } entries`);
|
|
40653
|
+
}
|
|
40654
|
+
const slotMap = new Map;
|
|
40655
|
+
const slotIds = [];
|
|
40656
|
+
for (const [idx, entry] of parsed.entries()) {
|
|
40657
|
+
if (!entry || typeof entry.slot !== "string" || entry.slot.length === 0) {
|
|
40658
|
+
throw new Error(`--models entry #${idx} is missing a non-empty "slot" string`);
|
|
40659
|
+
}
|
|
40660
|
+
if (typeof entry.model !== "string" || entry.model.length === 0) {
|
|
40661
|
+
throw new Error(`--models entry #${idx} (slot "${entry.slot}") is missing a non-empty "model" string`);
|
|
40662
|
+
}
|
|
40663
|
+
if (entry.provider != null && typeof entry.provider !== "string") {
|
|
40664
|
+
throw new Error(`--models entry #${idx} (slot "${entry.slot}") has a non-string "provider"`);
|
|
40665
|
+
}
|
|
40666
|
+
if (slotMap.has(entry.slot)) {
|
|
40667
|
+
throw new Error(`--models has duplicate slot "${entry.slot}"`);
|
|
40668
|
+
}
|
|
40669
|
+
slotMap.set(entry.slot, { model: entry.model, provider: entry.provider ?? null });
|
|
40670
|
+
slotIds.push(entry.slot);
|
|
40671
|
+
}
|
|
40672
|
+
return { slotMap, slotIds };
|
|
40673
|
+
}
|
|
40674
|
+
async function serveCommand(args) {
|
|
40675
|
+
let serveArgs;
|
|
40676
|
+
try {
|
|
40677
|
+
serveArgs = parseServeArgs(args);
|
|
40678
|
+
} catch (e) {
|
|
40679
|
+
console.error(`[claudish serve] ${e instanceof Error ? e.message : String(e)}`);
|
|
40680
|
+
process.exit(1);
|
|
40681
|
+
}
|
|
40682
|
+
if (serveArgs.port == null) {
|
|
40683
|
+
console.error("[claudish serve] --port <n> is required");
|
|
40684
|
+
process.exit(1);
|
|
40685
|
+
}
|
|
40686
|
+
if (!serveArgs.modelsPath) {
|
|
40687
|
+
console.error("[claudish serve] --models <path> is required");
|
|
40688
|
+
process.exit(1);
|
|
40689
|
+
}
|
|
40690
|
+
let slotMap;
|
|
40691
|
+
let slotIds;
|
|
40692
|
+
try {
|
|
40693
|
+
({ slotMap, slotIds } = loadModelMap(serveArgs.modelsPath));
|
|
40694
|
+
} catch (e) {
|
|
40695
|
+
console.error(`[claudish serve] ${e instanceof Error ? e.message : String(e)}`);
|
|
40696
|
+
process.exit(1);
|
|
40697
|
+
}
|
|
40698
|
+
const openrouterApiKey = process.env.OPENROUTER_API_KEY;
|
|
40699
|
+
const anthropicApiKey = process.env.ANTHROPIC_API_KEY;
|
|
40700
|
+
const proxy = await createProxyServer(serveArgs.port, openrouterApiKey, undefined, false, anthropicApiKey, undefined, {
|
|
40701
|
+
slotMap,
|
|
40702
|
+
servedSlotIds: slotIds
|
|
40703
|
+
});
|
|
40704
|
+
console.log(`[claudish serve] listening on ${proxy.url}`);
|
|
40705
|
+
console.log(`[claudish serve] serving ${slotIds.length} slot(s): ${slotIds.join(", ")}`);
|
|
40706
|
+
console.log(`[claudish serve] GET ${proxy.url}/v1/models \xB7 POST ${proxy.url}/v1/messages`);
|
|
40707
|
+
await new Promise(() => {});
|
|
40708
|
+
}
|
|
40709
|
+
var init_serve_command = __esm(() => {
|
|
40710
|
+
init_proxy_server();
|
|
40711
|
+
});
|
|
40712
|
+
|
|
40713
|
+
// src/tui/providers.ts
|
|
40714
|
+
function toProviderDef(def) {
|
|
40715
|
+
return {
|
|
40716
|
+
name: def.name === "google" ? "gemini" : def.name,
|
|
40717
|
+
catalogName: def.name,
|
|
40718
|
+
displayName: def.displayName,
|
|
40719
|
+
apiKeyEnvVar: def.apiKeyEnvVar,
|
|
40720
|
+
description: def.description || def.apiKeyDescription,
|
|
40721
|
+
keyUrl: def.apiKeyUrl,
|
|
40722
|
+
endpointEnvVar: def.baseUrlEnvVars?.[0],
|
|
40723
|
+
endpointEnvVars: def.baseUrlEnvVars,
|
|
40724
|
+
defaultEndpoint: def.baseUrl || undefined,
|
|
40725
|
+
aliases: def.apiKeyAliases,
|
|
40726
|
+
isLocal: def.isLocal,
|
|
40727
|
+
oauthSlug: def.oauthLoginSlug
|
|
40728
|
+
};
|
|
40729
|
+
}
|
|
40730
|
+
function providerAuthSource(p, config3) {
|
|
40731
|
+
if (p.isLocal)
|
|
40732
|
+
return isLocalProviderEnabled(p.catalogName, config3) ? "local" : null;
|
|
40733
|
+
if (p.oauthSlug && hasOAuthCredentials(p.catalogName))
|
|
40734
|
+
return "oauth";
|
|
40735
|
+
const hasCfg = !!p.apiKeyEnvVar && !!config3.apiKeys?.[p.apiKeyEnvVar];
|
|
40736
|
+
const hasEnv = !!p.apiKeyEnvVar && !!process.env[p.apiKeyEnvVar];
|
|
40737
|
+
if (hasEnv && hasCfg)
|
|
40738
|
+
return "e+c";
|
|
40739
|
+
if (hasEnv)
|
|
40740
|
+
return "env";
|
|
40741
|
+
if (hasCfg)
|
|
40742
|
+
return "cfg";
|
|
40743
|
+
return null;
|
|
40744
|
+
}
|
|
40745
|
+
function providerIsReady(p, config3) {
|
|
40746
|
+
return providerAuthSource(p, config3) !== null;
|
|
40747
|
+
}
|
|
40748
|
+
function providerAuthCapabilities(p, config3) {
|
|
40749
|
+
const apiKeySupported = !!p.apiKeyEnvVar;
|
|
40750
|
+
const apiKeySet = apiKeySupported && (!!process.env[p.apiKeyEnvVar] || !!config3.apiKeys?.[p.apiKeyEnvVar]);
|
|
40751
|
+
const oauthSupported = !!p.oauthSlug;
|
|
40752
|
+
const oauthSet = oauthSupported && hasOAuthCredentials(p.catalogName);
|
|
40753
|
+
return {
|
|
40754
|
+
apiKey: { supported: apiKeySupported, set: apiKeySet },
|
|
40755
|
+
oauth: { supported: oauthSupported, set: oauthSet }
|
|
40756
|
+
};
|
|
40757
|
+
}
|
|
40758
|
+
function maskKey2(key) {
|
|
40759
|
+
if (!key)
|
|
40760
|
+
return "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
40761
|
+
if (key.length < 8)
|
|
40762
|
+
return "**** ";
|
|
40763
|
+
return `${key.slice(0, 3)}\u2022\u2022${key.slice(-3)}`;
|
|
40764
|
+
}
|
|
40765
|
+
var SKIP, PROVIDERS;
|
|
40766
|
+
var init_providers = __esm(() => {
|
|
40767
|
+
init_oauth_registry();
|
|
40768
|
+
init_profile_config();
|
|
40769
|
+
init_provider_definitions();
|
|
40770
|
+
SKIP = new Set(["qwen", "native-anthropic"]);
|
|
40771
|
+
PROVIDERS = getAllProviders().filter((d) => !SKIP.has(d.name)).map(toProviderDef);
|
|
40772
|
+
});
|
|
40773
|
+
|
|
40774
|
+
// src/providers-command.ts
|
|
40775
|
+
var exports_providers_command = {};
|
|
40776
|
+
__export(exports_providers_command, {
|
|
40777
|
+
providersCommand: () => providersCommand,
|
|
40778
|
+
collectProviderStatuses: () => collectProviderStatuses
|
|
40779
|
+
});
|
|
40780
|
+
function collectProviderStatuses(config3 = loadConfig()) {
|
|
40781
|
+
return PROVIDERS.map((p) => {
|
|
40782
|
+
const authSource = providerAuthSource(p, config3);
|
|
40783
|
+
return {
|
|
40784
|
+
slug: p.catalogName,
|
|
40785
|
+
ready: authSource !== null,
|
|
40786
|
+
authSource
|
|
40787
|
+
};
|
|
40788
|
+
});
|
|
40789
|
+
}
|
|
40790
|
+
async function providersCommand(opts) {
|
|
40791
|
+
const providers = collectProviderStatuses();
|
|
40792
|
+
if (opts.json) {
|
|
40793
|
+
console.log(JSON.stringify({ providers }, null, 2));
|
|
40794
|
+
return;
|
|
40795
|
+
}
|
|
40796
|
+
for (const p of providers) {
|
|
40797
|
+
const mark = p.ready ? "\u2713" : "\xB7";
|
|
40798
|
+
const src = p.authSource ?? "\u2014";
|
|
40799
|
+
console.log(`${mark} ${p.slug.padEnd(20)} ${src}`);
|
|
40800
|
+
}
|
|
40801
|
+
}
|
|
40802
|
+
var init_providers_command = __esm(() => {
|
|
40803
|
+
init_profile_config();
|
|
40804
|
+
init_providers();
|
|
40805
|
+
});
|
|
40806
|
+
|
|
40588
40807
|
// ../../node_modules/.bun/@inquirer+core@11.0.1+04f2146be16c61ef/node_modules/@inquirer/core/dist/lib/key.js
|
|
40589
40808
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p", isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n", isSpaceKey = (key) => key.name === "space", isBackspaceKey = (key) => key.name === "backspace", isTabKey = (key) => key.name === "tab", isNumberKey = (key) => "1234567890".includes(key.name), isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
40590
40809
|
|
|
@@ -51856,7 +52075,7 @@ var init_RemoveFileError = __esm(() => {
|
|
|
51856
52075
|
|
|
51857
52076
|
// ../../node_modules/.bun/@inquirer+external-editor@2.0.1+04f2146be16c61ef/node_modules/@inquirer/external-editor/dist/index.js
|
|
51858
52077
|
import { spawn as spawn3, spawnSync } from "child_process";
|
|
51859
|
-
import { readFileSync as
|
|
52078
|
+
import { readFileSync as readFileSync17, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "fs";
|
|
51860
52079
|
import path from "path";
|
|
51861
52080
|
import os from "os";
|
|
51862
52081
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
@@ -51972,7 +52191,7 @@ class ExternalEditor {
|
|
|
51972
52191
|
}
|
|
51973
52192
|
readTemporaryFile() {
|
|
51974
52193
|
try {
|
|
51975
|
-
const tempFileBuffer =
|
|
52194
|
+
const tempFileBuffer = readFileSync17(this.tempFile);
|
|
51976
52195
|
if (tempFileBuffer.length === 0) {
|
|
51977
52196
|
this.text = "";
|
|
51978
52197
|
} else {
|
|
@@ -53162,15 +53381,15 @@ async function geminiQuotaHandler() {
|
|
|
53162
53381
|
}
|
|
53163
53382
|
}
|
|
53164
53383
|
async function codexQuotaHandler() {
|
|
53165
|
-
const { readFileSync:
|
|
53384
|
+
const { readFileSync: readFileSync18, existsSync: existsSync20 } = await import("fs");
|
|
53166
53385
|
const { join: join21 } = await import("path");
|
|
53167
53386
|
const { homedir: homedir20 } = await import("os");
|
|
53168
53387
|
const credPath = join21(homedir20(), ".claudish", "codex-oauth.json");
|
|
53169
|
-
if (!
|
|
53388
|
+
if (!existsSync20(credPath)) {
|
|
53170
53389
|
console.error(`${RED}No Codex credentials found.${R} Run: ${B}claudish login codex${R}`);
|
|
53171
53390
|
process.exit(1);
|
|
53172
53391
|
}
|
|
53173
|
-
const creds = JSON.parse(
|
|
53392
|
+
const creds = JSON.parse(readFileSync18(credPath, "utf-8"));
|
|
53174
53393
|
let email3 = "";
|
|
53175
53394
|
try {
|
|
53176
53395
|
const parts = creds.access_token.split(".");
|
|
@@ -53223,8 +53442,8 @@ async function codexQuotaHandler() {
|
|
|
53223
53442
|
let modelSlugs = [];
|
|
53224
53443
|
try {
|
|
53225
53444
|
const modelsPath = join21(homedir20(), ".codex", "models_cache.json");
|
|
53226
|
-
if (
|
|
53227
|
-
const cache = JSON.parse(
|
|
53445
|
+
if (existsSync20(modelsPath)) {
|
|
53446
|
+
const cache = JSON.parse(readFileSync18(modelsPath, "utf-8"));
|
|
53228
53447
|
modelSlugs = (cache.models || []).map((m) => m.slug || m.id).filter(Boolean);
|
|
53229
53448
|
}
|
|
53230
53449
|
} catch {}
|
|
@@ -54110,7 +54329,7 @@ var init_model_selector = __esm(() => {
|
|
|
54110
54329
|
"gemini-codeassist": "google",
|
|
54111
54330
|
openai: "openai",
|
|
54112
54331
|
"openai-codex": "openai",
|
|
54113
|
-
|
|
54332
|
+
"x-ai": "x-ai",
|
|
54114
54333
|
deepseek: "deepseek",
|
|
54115
54334
|
minimax: "minimax",
|
|
54116
54335
|
"minimax-coding": "minimax",
|
|
@@ -54118,7 +54337,7 @@ var init_model_selector = __esm(() => {
|
|
|
54118
54337
|
"kimi-coding": "moonshotai",
|
|
54119
54338
|
glm: "z-ai",
|
|
54120
54339
|
"glm-coding": "z-ai",
|
|
54121
|
-
|
|
54340
|
+
"z-ai": "z-ai",
|
|
54122
54341
|
zen: "opencode-zen",
|
|
54123
54342
|
"opencode-zen": "opencode-zen",
|
|
54124
54343
|
"opencode-zen-go": "opencode-zen-go",
|
|
@@ -54135,8 +54354,9 @@ var init_model_selector = __esm(() => {
|
|
|
54135
54354
|
oai: "openai",
|
|
54136
54355
|
codex: "openai-codex",
|
|
54137
54356
|
cx: "openai-codex",
|
|
54138
|
-
|
|
54139
|
-
|
|
54357
|
+
"x-ai": "x-ai",
|
|
54358
|
+
xai: "x-ai",
|
|
54359
|
+
grok: "x-ai",
|
|
54140
54360
|
minimax: "minimax",
|
|
54141
54361
|
mm: "minimax",
|
|
54142
54362
|
"minimax-coding": "minimax-coding",
|
|
@@ -54149,7 +54369,8 @@ var init_model_selector = __esm(() => {
|
|
|
54149
54369
|
glm: "glm",
|
|
54150
54370
|
"glm-coding": "glm-coding",
|
|
54151
54371
|
gc: "glm-coding",
|
|
54152
|
-
|
|
54372
|
+
"z-ai": "z-ai",
|
|
54373
|
+
zai: "z-ai",
|
|
54153
54374
|
zen: "zen",
|
|
54154
54375
|
ollamacloud: "ollamacloud",
|
|
54155
54376
|
oc: "ollamacloud",
|
|
@@ -54183,7 +54404,7 @@ var init_model_selector = __esm(() => {
|
|
|
54183
54404
|
description: "ChatGPT Plus/Pro subscription (Responses API)",
|
|
54184
54405
|
provider: "openai-codex"
|
|
54185
54406
|
},
|
|
54186
|
-
{ name: "xAI / Grok", value: "
|
|
54407
|
+
{ name: "xAI / Grok", value: "x-ai", description: "Direct API", provider: "x-ai" },
|
|
54187
54408
|
{ name: "DeepSeek", value: "deepseek", description: "Direct API", provider: "deepseek" },
|
|
54188
54409
|
{ name: "MiniMax", value: "minimax", description: "Direct API", provider: "minimax" },
|
|
54189
54410
|
{
|
|
@@ -54206,7 +54427,7 @@ var init_model_selector = __esm(() => {
|
|
|
54206
54427
|
description: "Coding subscription",
|
|
54207
54428
|
provider: "glm-coding"
|
|
54208
54429
|
},
|
|
54209
|
-
{ name: "Z.AI", value: "
|
|
54430
|
+
{ name: "Z.AI", value: "z-ai", description: "Direct API", provider: "z-ai" },
|
|
54210
54431
|
{
|
|
54211
54432
|
name: "OllamaCloud",
|
|
54212
54433
|
value: "ollamacloud",
|
|
@@ -54236,7 +54457,7 @@ var init_model_selector = __esm(() => {
|
|
|
54236
54457
|
google: "google@",
|
|
54237
54458
|
openai: "oai@",
|
|
54238
54459
|
"openai-codex": "cx@",
|
|
54239
|
-
|
|
54460
|
+
"x-ai": "x-ai@",
|
|
54240
54461
|
deepseek: "ds@",
|
|
54241
54462
|
minimax: "mm@",
|
|
54242
54463
|
kimi: "kimi@",
|
|
@@ -54244,7 +54465,7 @@ var init_model_selector = __esm(() => {
|
|
|
54244
54465
|
"kimi-coding": "kc@",
|
|
54245
54466
|
glm: "glm@",
|
|
54246
54467
|
"glm-coding": "gc@",
|
|
54247
|
-
|
|
54468
|
+
"z-ai": "z-ai@",
|
|
54248
54469
|
ollamacloud: "oc@",
|
|
54249
54470
|
ollama: "ollama@",
|
|
54250
54471
|
lmstudio: "lmstudio@",
|
|
@@ -54293,7 +54514,7 @@ var init_api_key_map = __esm(() => {
|
|
|
54293
54514
|
"kimi-coding": { envVar: "KIMI_CODING_API_KEY" },
|
|
54294
54515
|
glm: { envVar: "ZHIPU_API_KEY", aliases: ["GLM_API_KEY"] },
|
|
54295
54516
|
"glm-coding": { envVar: "GLM_CODING_API_KEY", aliases: ["ZAI_CODING_API_KEY"] },
|
|
54296
|
-
|
|
54517
|
+
"z-ai": { envVar: "ZAI_API_KEY" },
|
|
54297
54518
|
ollamacloud: { envVar: "OLLAMA_API_KEY" },
|
|
54298
54519
|
"opencode-zen": { envVar: "OPENCODE_API_KEY" },
|
|
54299
54520
|
"opencode-zen-go": { envVar: "OPENCODE_API_KEY" },
|
|
@@ -54996,47 +55217,6 @@ function Banner() {
|
|
|
54996
55217
|
]
|
|
54997
55218
|
}, undefined, true, undefined, this);
|
|
54998
55219
|
}
|
|
54999
|
-
function StepLine({ steps }) {
|
|
55000
|
-
const iconMap = {
|
|
55001
|
-
pending: "\u25CB",
|
|
55002
|
-
running: "\u25CC",
|
|
55003
|
-
done: "\u2713",
|
|
55004
|
-
error: "\u2717"
|
|
55005
|
-
};
|
|
55006
|
-
const colorMap = {
|
|
55007
|
-
pending: C.dim,
|
|
55008
|
-
running: C.cyan,
|
|
55009
|
-
done: C.green,
|
|
55010
|
-
error: C.red
|
|
55011
|
-
};
|
|
55012
|
-
if (steps.length === 0)
|
|
55013
|
-
return /* @__PURE__ */ jsxDEV("text", {
|
|
55014
|
-
children: " "
|
|
55015
|
-
}, undefined, false, undefined, this);
|
|
55016
|
-
const active = steps.find((s) => s.status === "running" || s.status === "error") ?? steps[steps.length - 1];
|
|
55017
|
-
return /* @__PURE__ */ jsxDEV("text", {
|
|
55018
|
-
children: [
|
|
55019
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55020
|
-
children: " "
|
|
55021
|
-
}, undefined, false, undefined, this),
|
|
55022
|
-
steps.map((s, i) => /* @__PURE__ */ jsxDEV("span", {
|
|
55023
|
-
fg: colorMap[s.status],
|
|
55024
|
-
children: [
|
|
55025
|
-
iconMap[s.status],
|
|
55026
|
-
i < steps.length - 1 ? " " : ""
|
|
55027
|
-
]
|
|
55028
|
-
}, `${s.name}-${i}`, true, undefined, this)),
|
|
55029
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55030
|
-
fg: C.dim,
|
|
55031
|
-
children: " "
|
|
55032
|
-
}, undefined, false, undefined, this),
|
|
55033
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55034
|
-
fg: colorMap[active.status],
|
|
55035
|
-
children: active.name
|
|
55036
|
-
}, undefined, false, undefined, this)
|
|
55037
|
-
]
|
|
55038
|
-
}, undefined, true, undefined, this);
|
|
55039
|
-
}
|
|
55040
55220
|
function ProgressBar({
|
|
55041
55221
|
link,
|
|
55042
55222
|
animFrame,
|
|
@@ -56129,7 +56309,7 @@ function ProbeApp({
|
|
|
56129
56309
|
const showDetails = isDone && state.activeTab === "details";
|
|
56130
56310
|
const showLeaderboard = isDone && state.activeTab === "leaderboard";
|
|
56131
56311
|
const showSummary = !showDetails && !showLeaderboard;
|
|
56132
|
-
const stepsRows =
|
|
56312
|
+
const stepsRows = 0;
|
|
56133
56313
|
const tabBarRows = isDone ? TAB_BAR_ROWS : 0;
|
|
56134
56314
|
const legendRows = showSummary ? LEGEND_ROWS : 0;
|
|
56135
56315
|
const listH = Math.max(MIN_LIST_H, termHeight - BANNER_ROWS - stepsRows - tabBarRows - legendRows - SCROLL_HINT_ROWS);
|
|
@@ -56147,12 +56327,7 @@ function ProbeApp({
|
|
|
56147
56327
|
}, undefined, false, undefined, this),
|
|
56148
56328
|
isDone ? /* @__PURE__ */ jsxDEV(TabBar, {
|
|
56149
56329
|
activeTab: state.activeTab
|
|
56150
|
-
}, undefined, false, undefined, this) :
|
|
56151
|
-
flexDirection: "column",
|
|
56152
|
-
children: /* @__PURE__ */ jsxDEV(StepLine, {
|
|
56153
|
-
steps: state.steps
|
|
56154
|
-
}, undefined, false, undefined, this)
|
|
56155
|
-
}, undefined, false, undefined, this),
|
|
56330
|
+
}, undefined, false, undefined, this) : null,
|
|
56156
56331
|
groups.length > 0 ? /* @__PURE__ */ jsxDEV(Fragment, {
|
|
56157
56332
|
children: [
|
|
56158
56333
|
showSummary && /* @__PURE__ */ jsxDEV("box", {
|
|
@@ -56959,8 +57134,8 @@ __export(exports_cli, {
|
|
|
56959
57134
|
getMissingKeyError: () => getMissingKeyError
|
|
56960
57135
|
});
|
|
56961
57136
|
import {
|
|
56962
|
-
readFileSync as
|
|
56963
|
-
existsSync as
|
|
57137
|
+
readFileSync as readFileSync18,
|
|
57138
|
+
existsSync as existsSync20,
|
|
56964
57139
|
mkdirSync as mkdirSync10,
|
|
56965
57140
|
copyFileSync,
|
|
56966
57141
|
readdirSync as readdirSync4,
|
|
@@ -56975,7 +57150,7 @@ function getVersion3() {
|
|
|
56975
57150
|
}
|
|
56976
57151
|
function clearAllModelCaches() {
|
|
56977
57152
|
const cacheDir = join21(homedir20(), ".claudish");
|
|
56978
|
-
if (!
|
|
57153
|
+
if (!existsSync20(cacheDir))
|
|
56979
57154
|
return;
|
|
56980
57155
|
const cachePatterns = ["pricing-cache.json", "recommended-models-cache.json"];
|
|
56981
57156
|
let cleared = 0;
|
|
@@ -57354,7 +57529,7 @@ Usage: claudish --list-models --provider <slug>`);
|
|
|
57354
57529
|
config3.resolvedDefaultProvider = resolved;
|
|
57355
57530
|
if (resolved.legacyAutoPromoted && !config3.quiet) {
|
|
57356
57531
|
const markerFile = join21(homedir20(), ".claudish", ".legacy-litellm-hint-shown");
|
|
57357
|
-
if (!
|
|
57532
|
+
if (!existsSync20(markerFile)) {
|
|
57358
57533
|
const hint = buildLegacyHint(resolved);
|
|
57359
57534
|
if (hint) {
|
|
57360
57535
|
console.error(hint);
|
|
@@ -57848,7 +58023,7 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57848
58023
|
const modelName = resolvedSpec?.modelName || parsedModel;
|
|
57849
58024
|
let formatAdapterName = "OpenAIAPIFormat";
|
|
57850
58025
|
let declaredStreamFormat = "openai-sse";
|
|
57851
|
-
const anthropicCompatProviders = ["minimax", "minimax-coding", "kimi", "kimi-coding", "
|
|
58026
|
+
const anthropicCompatProviders = ["minimax", "minimax-coding", "kimi", "kimi-coding", "z-ai"];
|
|
57852
58027
|
const isMinimaxModel = modelName.toLowerCase().includes("minimax");
|
|
57853
58028
|
if (anthropicCompatProviders.includes(providerName)) {
|
|
57854
58029
|
formatAdapterName = "AnthropicAPIFormat";
|
|
@@ -58190,7 +58365,8 @@ MODEL ROUTING:
|
|
|
58190
58365
|
mm, mmax -> MiniMax Direct mm@MiniMax-M2.1
|
|
58191
58366
|
kimi, moon -> Kimi Direct kimi@kimi-k2-thinking-turbo
|
|
58192
58367
|
glm, zhipu -> GLM Direct glm@glm-4.7
|
|
58193
|
-
zai
|
|
58368
|
+
z-ai, zai -> Z.AI Direct z-ai@glm-4.7
|
|
58369
|
+
x-ai, grok -> xAI / Grok x-ai@grok-3
|
|
58194
58370
|
oc -> OllamaCloud oc@llama-3.1
|
|
58195
58371
|
llama,lc,meta-> OllamaCloud llama@llama-3.1
|
|
58196
58372
|
zen -> OpenCode Zen zen@grok-code
|
|
@@ -58501,7 +58677,7 @@ MORE INFO:
|
|
|
58501
58677
|
function printAIAgentGuide() {
|
|
58502
58678
|
try {
|
|
58503
58679
|
const guidePath = join21(__dirname3, "../AI_AGENT_GUIDE.md");
|
|
58504
|
-
const guideContent =
|
|
58680
|
+
const guideContent = readFileSync18(guidePath, "utf-8");
|
|
58505
58681
|
console.log(guideContent);
|
|
58506
58682
|
} catch (error46) {
|
|
58507
58683
|
console.error("Error reading AI Agent Guide:");
|
|
@@ -58521,7 +58697,7 @@ async function initializeClaudishSkill() {
|
|
|
58521
58697
|
const skillsDir = join21(claudeDir, "skills");
|
|
58522
58698
|
const claudishSkillDir = join21(skillsDir, "claudish-usage");
|
|
58523
58699
|
const skillFile = join21(claudishSkillDir, "SKILL.md");
|
|
58524
|
-
if (
|
|
58700
|
+
if (existsSync20(skillFile)) {
|
|
58525
58701
|
console.log("\u2705 Claudish skill already installed at:");
|
|
58526
58702
|
console.log(` ${skillFile}
|
|
58527
58703
|
`);
|
|
@@ -58529,7 +58705,7 @@ async function initializeClaudishSkill() {
|
|
|
58529
58705
|
return;
|
|
58530
58706
|
}
|
|
58531
58707
|
const sourceSkillPath = join21(__dirname3, "../skills/claudish-usage/SKILL.md");
|
|
58532
|
-
if (!
|
|
58708
|
+
if (!existsSync20(sourceSkillPath)) {
|
|
58533
58709
|
console.error("\u274C Error: Claudish skill file not found in installation.");
|
|
58534
58710
|
console.error(` Expected at: ${sourceSkillPath}`);
|
|
58535
58711
|
console.error(`
|
|
@@ -58538,15 +58714,15 @@ async function initializeClaudishSkill() {
|
|
|
58538
58714
|
process.exit(1);
|
|
58539
58715
|
}
|
|
58540
58716
|
try {
|
|
58541
|
-
if (!
|
|
58717
|
+
if (!existsSync20(claudeDir)) {
|
|
58542
58718
|
mkdirSync10(claudeDir, { recursive: true });
|
|
58543
58719
|
console.log("\uD83D\uDCC1 Created .claude/ directory");
|
|
58544
58720
|
}
|
|
58545
|
-
if (!
|
|
58721
|
+
if (!existsSync20(skillsDir)) {
|
|
58546
58722
|
mkdirSync10(skillsDir, { recursive: true });
|
|
58547
58723
|
console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
|
|
58548
58724
|
}
|
|
58549
|
-
if (!
|
|
58725
|
+
if (!existsSync20(claudishSkillDir)) {
|
|
58550
58726
|
mkdirSync10(claudishSkillDir, { recursive: true });
|
|
58551
58727
|
console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
|
|
58552
58728
|
}
|
|
@@ -58630,7 +58806,7 @@ __export(exports_update_checker, {
|
|
|
58630
58806
|
clearCache: () => clearCache,
|
|
58631
58807
|
checkForUpdates: () => checkForUpdates
|
|
58632
58808
|
});
|
|
58633
|
-
import { existsSync as
|
|
58809
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync19, unlinkSync as unlinkSync9, writeFileSync as writeFileSync12 } from "fs";
|
|
58634
58810
|
import { homedir as homedir21, platform as platform2, tmpdir } from "os";
|
|
58635
58811
|
import { join as join22 } from "path";
|
|
58636
58812
|
function getCacheFilePath() {
|
|
@@ -58642,7 +58818,7 @@ function getCacheFilePath() {
|
|
|
58642
58818
|
cacheDir = join22(homedir21(), ".cache", "claudish");
|
|
58643
58819
|
}
|
|
58644
58820
|
try {
|
|
58645
|
-
if (!
|
|
58821
|
+
if (!existsSync21(cacheDir)) {
|
|
58646
58822
|
mkdirSync11(cacheDir, { recursive: true });
|
|
58647
58823
|
}
|
|
58648
58824
|
return join22(cacheDir, "update-check.json");
|
|
@@ -58653,10 +58829,10 @@ function getCacheFilePath() {
|
|
|
58653
58829
|
function readCache() {
|
|
58654
58830
|
try {
|
|
58655
58831
|
const cachePath = getCacheFilePath();
|
|
58656
|
-
if (!
|
|
58832
|
+
if (!existsSync21(cachePath)) {
|
|
58657
58833
|
return null;
|
|
58658
58834
|
}
|
|
58659
|
-
const data = JSON.parse(
|
|
58835
|
+
const data = JSON.parse(readFileSync19(cachePath, "utf-8"));
|
|
58660
58836
|
return data;
|
|
58661
58837
|
} catch {
|
|
58662
58838
|
return null;
|
|
@@ -58679,7 +58855,7 @@ function isCacheValid(cache) {
|
|
|
58679
58855
|
function clearCache() {
|
|
58680
58856
|
try {
|
|
58681
58857
|
const cachePath = getCacheFilePath();
|
|
58682
|
-
if (
|
|
58858
|
+
if (existsSync21(cachePath)) {
|
|
58683
58859
|
unlinkSync9(cachePath);
|
|
58684
58860
|
}
|
|
58685
58861
|
} catch {}
|
|
@@ -59463,15 +59639,15 @@ var init_profile_commands = __esm(() => {
|
|
|
59463
59639
|
});
|
|
59464
59640
|
|
|
59465
59641
|
// src/providers/probe-catalog.ts
|
|
59466
|
-
import { existsSync as
|
|
59642
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "fs";
|
|
59467
59643
|
import { homedir as homedir22 } from "os";
|
|
59468
59644
|
import { dirname as dirname5, join as join23 } from "path";
|
|
59469
59645
|
function readProbeModelsCache(path2 = PROBE_MODELS_CACHE_PATH) {
|
|
59470
|
-
if (!
|
|
59646
|
+
if (!existsSync22(path2))
|
|
59471
59647
|
return null;
|
|
59472
59648
|
let raw2;
|
|
59473
59649
|
try {
|
|
59474
|
-
raw2 = JSON.parse(
|
|
59650
|
+
raw2 = JSON.parse(readFileSync20(path2, "utf-8"));
|
|
59475
59651
|
} catch {
|
|
59476
59652
|
return null;
|
|
59477
59653
|
}
|
|
@@ -59625,67 +59801,6 @@ function invalidateProbeProxyHandlers(providerSlug) {
|
|
|
59625
59801
|
}
|
|
59626
59802
|
var probeProxy = null, probeProxyStarting = null;
|
|
59627
59803
|
|
|
59628
|
-
// src/tui/providers.ts
|
|
59629
|
-
function toProviderDef(def) {
|
|
59630
|
-
return {
|
|
59631
|
-
name: def.name === "google" ? "gemini" : def.name,
|
|
59632
|
-
catalogName: def.name,
|
|
59633
|
-
displayName: def.displayName,
|
|
59634
|
-
apiKeyEnvVar: def.apiKeyEnvVar,
|
|
59635
|
-
description: def.description || def.apiKeyDescription,
|
|
59636
|
-
keyUrl: def.apiKeyUrl,
|
|
59637
|
-
endpointEnvVar: def.baseUrlEnvVars?.[0],
|
|
59638
|
-
endpointEnvVars: def.baseUrlEnvVars,
|
|
59639
|
-
defaultEndpoint: def.baseUrl || undefined,
|
|
59640
|
-
aliases: def.apiKeyAliases,
|
|
59641
|
-
isLocal: def.isLocal,
|
|
59642
|
-
oauthSlug: def.oauthLoginSlug
|
|
59643
|
-
};
|
|
59644
|
-
}
|
|
59645
|
-
function providerAuthSource(p, config3) {
|
|
59646
|
-
if (p.isLocal)
|
|
59647
|
-
return isLocalProviderEnabled(p.catalogName, config3) ? "local" : null;
|
|
59648
|
-
if (p.oauthSlug && hasOAuthCredentials(p.catalogName))
|
|
59649
|
-
return "oauth";
|
|
59650
|
-
const hasCfg = !!p.apiKeyEnvVar && !!config3.apiKeys?.[p.apiKeyEnvVar];
|
|
59651
|
-
const hasEnv = !!p.apiKeyEnvVar && !!process.env[p.apiKeyEnvVar];
|
|
59652
|
-
if (hasEnv && hasCfg)
|
|
59653
|
-
return "e+c";
|
|
59654
|
-
if (hasEnv)
|
|
59655
|
-
return "env";
|
|
59656
|
-
if (hasCfg)
|
|
59657
|
-
return "cfg";
|
|
59658
|
-
return null;
|
|
59659
|
-
}
|
|
59660
|
-
function providerIsReady(p, config3) {
|
|
59661
|
-
return providerAuthSource(p, config3) !== null;
|
|
59662
|
-
}
|
|
59663
|
-
function providerAuthCapabilities(p, config3) {
|
|
59664
|
-
const apiKeySupported = !!p.apiKeyEnvVar;
|
|
59665
|
-
const apiKeySet = apiKeySupported && (!!process.env[p.apiKeyEnvVar] || !!config3.apiKeys?.[p.apiKeyEnvVar]);
|
|
59666
|
-
const oauthSupported = !!p.oauthSlug;
|
|
59667
|
-
const oauthSet = oauthSupported && hasOAuthCredentials(p.catalogName);
|
|
59668
|
-
return {
|
|
59669
|
-
apiKey: { supported: apiKeySupported, set: apiKeySet },
|
|
59670
|
-
oauth: { supported: oauthSupported, set: oauthSet }
|
|
59671
|
-
};
|
|
59672
|
-
}
|
|
59673
|
-
function maskKey2(key) {
|
|
59674
|
-
if (!key)
|
|
59675
|
-
return "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
59676
|
-
if (key.length < 8)
|
|
59677
|
-
return "**** ";
|
|
59678
|
-
return `${key.slice(0, 3)}\u2022\u2022${key.slice(-3)}`;
|
|
59679
|
-
}
|
|
59680
|
-
var SKIP, PROVIDERS;
|
|
59681
|
-
var init_providers = __esm(() => {
|
|
59682
|
-
init_oauth_registry();
|
|
59683
|
-
init_profile_config();
|
|
59684
|
-
init_provider_definitions();
|
|
59685
|
-
SKIP = new Set(["qwen", "native-anthropic"]);
|
|
59686
|
-
PROVIDERS = getAllProviders().filter((d) => !SKIP.has(d.name)).map(toProviderDef);
|
|
59687
|
-
});
|
|
59688
|
-
|
|
59689
59804
|
// src/tui/constants.ts
|
|
59690
59805
|
var COMMON_MODELS, PROVIDER_PREFIXES, CHAIN_PROVIDERS, HEADER_H = 2, TABS_H = 3, FOOTER_H = 1, DETAIL_H = 7;
|
|
59691
59806
|
var init_constants3 = __esm(() => {
|
|
@@ -63866,7 +63981,7 @@ __export(exports_claude_runner, {
|
|
|
63866
63981
|
checkClaudeInstalled: () => checkClaudeInstalled
|
|
63867
63982
|
});
|
|
63868
63983
|
import { spawn as spawn4 } from "child_process";
|
|
63869
|
-
import { writeFileSync as writeFileSync14, unlinkSync as unlinkSync10, mkdirSync as mkdirSync13, existsSync as
|
|
63984
|
+
import { writeFileSync as writeFileSync14, unlinkSync as unlinkSync10, mkdirSync as mkdirSync13, existsSync as existsSync23, readFileSync as readFileSync21 } from "fs";
|
|
63870
63985
|
import { tmpdir as tmpdir2, homedir as homedir23 } from "os";
|
|
63871
63986
|
import { join as join24 } from "path";
|
|
63872
63987
|
function hasNativeAnthropicMapping(config3) {
|
|
@@ -64025,7 +64140,7 @@ function mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine) {
|
|
|
64025
64140
|
if (userSettingsValue.trimStart().startsWith("{")) {
|
|
64026
64141
|
userSettings = JSON.parse(userSettingsValue);
|
|
64027
64142
|
} else {
|
|
64028
|
-
const rawUserSettings =
|
|
64143
|
+
const rawUserSettings = readFileSync21(userSettingsValue, "utf-8");
|
|
64029
64144
|
userSettings = JSON.parse(rawUserSettings);
|
|
64030
64145
|
}
|
|
64031
64146
|
userSettings.statusLine = statusLine;
|
|
@@ -64166,13 +64281,13 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
|
|
|
64166
64281
|
async function findClaudeBinary() {
|
|
64167
64282
|
const isWindows3 = process.platform === "win32";
|
|
64168
64283
|
if (process.env.CLAUDE_PATH) {
|
|
64169
|
-
if (
|
|
64284
|
+
if (existsSync23(process.env.CLAUDE_PATH)) {
|
|
64170
64285
|
return process.env.CLAUDE_PATH;
|
|
64171
64286
|
}
|
|
64172
64287
|
}
|
|
64173
64288
|
const home = homedir23();
|
|
64174
64289
|
const localPath = isWindows3 ? join24(home, ".claude", "local", "claude.exe") : join24(home, ".claude", "local", "claude");
|
|
64175
|
-
if (
|
|
64290
|
+
if (existsSync23(localPath)) {
|
|
64176
64291
|
return localPath;
|
|
64177
64292
|
}
|
|
64178
64293
|
if (isWindows3) {
|
|
@@ -64182,7 +64297,7 @@ async function findClaudeBinary() {
|
|
|
64182
64297
|
join24(home, "node_modules", ".bin", "claude.cmd")
|
|
64183
64298
|
];
|
|
64184
64299
|
for (const path2 of windowsPaths) {
|
|
64185
|
-
if (
|
|
64300
|
+
if (existsSync23(path2)) {
|
|
64186
64301
|
return path2;
|
|
64187
64302
|
}
|
|
64188
64303
|
}
|
|
@@ -64197,7 +64312,7 @@ async function findClaudeBinary() {
|
|
|
64197
64312
|
join24(home, "../usr/bin/claude")
|
|
64198
64313
|
];
|
|
64199
64314
|
for (const path2 of commonPaths) {
|
|
64200
|
-
if (
|
|
64315
|
+
if (existsSync23(path2)) {
|
|
64201
64316
|
return path2;
|
|
64202
64317
|
}
|
|
64203
64318
|
}
|
|
@@ -64469,8 +64584,8 @@ __export(exports_team_grid, {
|
|
|
64469
64584
|
});
|
|
64470
64585
|
import { spawn as spawn5 } from "child_process";
|
|
64471
64586
|
import {
|
|
64472
|
-
existsSync as
|
|
64473
|
-
readFileSync as
|
|
64587
|
+
existsSync as existsSync24,
|
|
64588
|
+
readFileSync as readFileSync22,
|
|
64474
64589
|
writeFileSync as writeFileSync16
|
|
64475
64590
|
} from "fs";
|
|
64476
64591
|
import { dirname as dirname6, join as join26 } from "path";
|
|
@@ -64573,14 +64688,14 @@ function findMagmuxBinary() {
|
|
|
64573
64688
|
const platform3 = process.platform;
|
|
64574
64689
|
const arch = process.arch;
|
|
64575
64690
|
const bundledMagmux = join26(pkgRoot, "native", `magmux-${platform3}-${arch}`);
|
|
64576
|
-
if (
|
|
64691
|
+
if (existsSync24(bundledMagmux))
|
|
64577
64692
|
return bundledMagmux;
|
|
64578
64693
|
try {
|
|
64579
64694
|
const pkgName = `@claudish/magmux-${platform3}-${arch}`;
|
|
64580
64695
|
let searchDir = pkgRoot;
|
|
64581
64696
|
for (let i = 0;i < 5; i++) {
|
|
64582
64697
|
const candidate = join26(searchDir, "node_modules", pkgName, "bin", "magmux");
|
|
64583
|
-
if (
|
|
64698
|
+
if (existsSync24(candidate))
|
|
64584
64699
|
return candidate;
|
|
64585
64700
|
const parent = dirname6(searchDir);
|
|
64586
64701
|
if (parent === searchDir)
|
|
@@ -64599,7 +64714,7 @@ function findMagmuxBinary() {
|
|
|
64599
64714
|
async function subscribeToMagmux(sockPath, onEvent) {
|
|
64600
64715
|
let client = null;
|
|
64601
64716
|
for (let attempt = 0;attempt < 40; attempt++) {
|
|
64602
|
-
if (
|
|
64717
|
+
if (existsSync24(sockPath)) {
|
|
64603
64718
|
try {
|
|
64604
64719
|
client = await new Promise((resolve3, reject) => {
|
|
64605
64720
|
const s = netConnect(sockPath);
|
|
@@ -64687,8 +64802,8 @@ async function runWithGrid(sessionPath, models, input, opts) {
|
|
|
64687
64802
|
const manifest = setupSession(sessionPath, models, input);
|
|
64688
64803
|
const startedAt = new Date().toISOString();
|
|
64689
64804
|
const gridfilePath = join26(sessionPath, "gridfile.txt");
|
|
64690
|
-
const prompt =
|
|
64691
|
-
const rawPrompt =
|
|
64805
|
+
const prompt = readFileSync22(join26(sessionPath, "input.md"), "utf-8").replace(/'/g, "'\\''").replace(/\n/g, " ");
|
|
64806
|
+
const rawPrompt = readFileSync22(join26(sessionPath, "input.md"), "utf-8");
|
|
64692
64807
|
const usedBannerColors = new Set;
|
|
64693
64808
|
const gridLines = Object.entries(manifest.models).map(([anonId]) => {
|
|
64694
64809
|
const model = manifest.models[anonId].model;
|
|
@@ -64741,16 +64856,16 @@ var init_team_grid = __esm(() => {
|
|
|
64741
64856
|
|
|
64742
64857
|
// src/index.ts
|
|
64743
64858
|
var import_dotenv3 = __toESM(require_main(), 1);
|
|
64744
|
-
import { existsSync as
|
|
64859
|
+
import { existsSync as existsSync25, readFileSync as readFileSync23 } from "fs";
|
|
64745
64860
|
import { homedir as homedir25 } from "os";
|
|
64746
64861
|
import { join as join27 } from "path";
|
|
64747
64862
|
import_dotenv3.config({ quiet: true });
|
|
64748
64863
|
function loadStoredApiKeys() {
|
|
64749
64864
|
try {
|
|
64750
64865
|
const configPath = join27(homedir25(), ".claudish", "config.json");
|
|
64751
|
-
if (!
|
|
64866
|
+
if (!existsSync25(configPath))
|
|
64752
64867
|
return;
|
|
64753
|
-
const raw2 =
|
|
64868
|
+
const raw2 = readFileSync23(configPath, "utf-8");
|
|
64754
64869
|
const cfg = JSON.parse(raw2);
|
|
64755
64870
|
if (cfg.apiKeys) {
|
|
64756
64871
|
for (const [envVar, value] of Object.entries(cfg.apiKeys)) {
|
|
@@ -64785,6 +64900,8 @@ var firstPositional = args.find((a) => !a.startsWith("-"));
|
|
|
64785
64900
|
var isTelemetryCommand = firstPositional === "telemetry";
|
|
64786
64901
|
var isStatsCommand = firstPositional === "stats";
|
|
64787
64902
|
var isConfigCommand = firstPositional === "config";
|
|
64903
|
+
var isServeCommand = firstPositional === "serve";
|
|
64904
|
+
var isProvidersCommand = firstPositional === "providers";
|
|
64788
64905
|
var isLoginCommand = firstPositional === "login";
|
|
64789
64906
|
var isLogoutCommand = firstPositional === "logout";
|
|
64790
64907
|
var isQuotaCommand = firstPositional === "quota" || firstPositional === "usage";
|
|
@@ -64794,6 +64911,18 @@ var isLegacyKimiLogin = args.includes("--kimi-login");
|
|
|
64794
64911
|
var isLegacyKimiLogout = args.includes("--kimi-logout");
|
|
64795
64912
|
if (isMcpMode) {
|
|
64796
64913
|
Promise.resolve().then(() => (init_mcp_server(), exports_mcp_server)).then((mcp) => mcp.startMcpServer());
|
|
64914
|
+
} else if (isServeCommand) {
|
|
64915
|
+
const serveArgIndex = args.indexOf("serve");
|
|
64916
|
+
Promise.resolve().then(() => (init_serve_command(), exports_serve_command)).then((m) => m.serveCommand(args.slice(serveArgIndex + 1)).catch((e) => {
|
|
64917
|
+
console.error(`[claudish serve] ${e instanceof Error ? e.message : String(e)}`);
|
|
64918
|
+
process.exit(1);
|
|
64919
|
+
}));
|
|
64920
|
+
} else if (isProvidersCommand) {
|
|
64921
|
+
const json2 = args.includes("--json");
|
|
64922
|
+
Promise.resolve().then(() => (init_providers_command(), exports_providers_command)).then((m) => m.providersCommand({ json: json2 }).catch((e) => {
|
|
64923
|
+
console.error(`[claudish providers] ${e instanceof Error ? e.message : String(e)}`);
|
|
64924
|
+
process.exit(1);
|
|
64925
|
+
}));
|
|
64797
64926
|
} else if (isLoginCommand) {
|
|
64798
64927
|
const loginProviderArg = args.find((a, i) => i > args.indexOf("login") && !a.startsWith("-"));
|
|
64799
64928
|
Promise.resolve().then(() => (init_auth_commands(), exports_auth_commands)).then((m) => m.loginCommand(loginProviderArg).catch(handlePromptExit));
|
|
@@ -64865,7 +64994,7 @@ async function runCli() {
|
|
|
64865
64994
|
if (cliConfig.team && cliConfig.team.length > 0) {
|
|
64866
64995
|
let prompt = cliConfig.claudeArgs.join(" ");
|
|
64867
64996
|
if (cliConfig.inputFile) {
|
|
64868
|
-
prompt =
|
|
64997
|
+
prompt = readFileSync23(cliConfig.inputFile, "utf-8");
|
|
64869
64998
|
}
|
|
64870
64999
|
if (!prompt.trim()) {
|
|
64871
65000
|
console.error("Error: --team requires a prompt (positional args or -f <file>)");
|
|
@@ -64884,7 +65013,7 @@ async function runCli() {
|
|
|
64884
65013
|
for (const anonId of Object.keys(status2.models)) {
|
|
64885
65014
|
const responsePath = join27(sessionPath, `response-${anonId}.md`);
|
|
64886
65015
|
try {
|
|
64887
|
-
const raw2 =
|
|
65016
|
+
const raw2 = readFileSync23(responsePath, "utf-8").trim();
|
|
64888
65017
|
try {
|
|
64889
65018
|
result.responses[anonId] = JSON.parse(raw2);
|
|
64890
65019
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudish",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"ai"
|
|
60
60
|
],
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@claudish/magmux-darwin-arm64": "7.
|
|
63
|
-
"@claudish/magmux-darwin-x64": "7.
|
|
64
|
-
"@claudish/magmux-linux-arm64": "7.
|
|
65
|
-
"@claudish/magmux-linux-x64": "7.
|
|
62
|
+
"@claudish/magmux-darwin-arm64": "7.5.0",
|
|
63
|
+
"@claudish/magmux-darwin-x64": "7.5.0",
|
|
64
|
+
"@claudish/magmux-linux-arm64": "7.5.0",
|
|
65
|
+
"@claudish/magmux-linux-x64": "7.5.0"
|
|
66
66
|
},
|
|
67
67
|
"author": "Jack Rudenko <i@madappgang.com>",
|
|
68
68
|
"license": "MIT",
|