claudish 7.3.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 +653 -205
- 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",
|
|
@@ -27840,6 +27840,9 @@ class NativeHandler {
|
|
|
27840
27840
|
if (originalHeaders["x-api-key"]) {
|
|
27841
27841
|
headers["x-api-key"] = originalHeaders["x-api-key"];
|
|
27842
27842
|
}
|
|
27843
|
+
if (!originalHeaders["authorization"] && !originalHeaders["x-api-key"] && this.apiKey) {
|
|
27844
|
+
headers["x-api-key"] = this.apiKey;
|
|
27845
|
+
}
|
|
27843
27846
|
if (originalHeaders["anthropic-beta"]) {
|
|
27844
27847
|
const incomingBeta = originalHeaders["anthropic-beta"];
|
|
27845
27848
|
if (advisorSwapped) {
|
|
@@ -33157,7 +33160,7 @@ var init_vision_proxy = __esm(() => {
|
|
|
33157
33160
|
});
|
|
33158
33161
|
|
|
33159
33162
|
// src/version.ts
|
|
33160
|
-
var VERSION = "7.
|
|
33163
|
+
var VERSION = "7.5.0";
|
|
33161
33164
|
|
|
33162
33165
|
// src/telemetry.ts
|
|
33163
33166
|
var exports_telemetry = {};
|
|
@@ -33579,7 +33582,8 @@ var init_telemetry = __esm(() => {
|
|
|
33579
33582
|
"minimax",
|
|
33580
33583
|
"kimi",
|
|
33581
33584
|
"glm",
|
|
33582
|
-
"
|
|
33585
|
+
"z-ai",
|
|
33586
|
+
"x-ai",
|
|
33583
33587
|
"minimax-coding",
|
|
33584
33588
|
"kimi-coding",
|
|
33585
33589
|
"glm-coding"
|
|
@@ -34965,8 +34969,8 @@ var init_routing_hints = __esm(() => {
|
|
|
34965
34969
|
ollamacloud: { apiKeyEnvVar: "OLLAMA_API_KEY" },
|
|
34966
34970
|
"native-anthropic": { apiKeyEnvVar: "ANTHROPIC_API_KEY" },
|
|
34967
34971
|
openrouter: { apiKeyEnvVar: "OPENROUTER_API_KEY" },
|
|
34968
|
-
|
|
34969
|
-
|
|
34972
|
+
"x-ai": { apiKeyEnvVar: "XAI_API_KEY" },
|
|
34973
|
+
"z-ai": { apiKeyEnvVar: "ZAI_API_KEY" },
|
|
34970
34974
|
"opencode-zen": { apiKeyEnvVar: "OPENCODE_API_KEY" }
|
|
34971
34975
|
};
|
|
34972
34976
|
});
|
|
@@ -35615,8 +35619,8 @@ var init_model_loader = __esm(() => {
|
|
|
35615
35619
|
FIREBASE_SLUG_TO_PROVIDER_NAME = {
|
|
35616
35620
|
openai: "openai",
|
|
35617
35621
|
google: "google",
|
|
35618
|
-
"x-ai": "
|
|
35619
|
-
"z-ai": "
|
|
35622
|
+
"x-ai": "x-ai",
|
|
35623
|
+
"z-ai": "z-ai",
|
|
35620
35624
|
moonshotai: "kimi",
|
|
35621
35625
|
minimax: "minimax",
|
|
35622
35626
|
qwen: "qwen"
|
|
@@ -35871,11 +35875,11 @@ var init_default_routing_rules = __esm(() => {
|
|
|
35871
35875
|
"o1-*": ["openai-codex", "openai", "openrouter"],
|
|
35872
35876
|
"o3-*": ["openai-codex", "openai", "openrouter"],
|
|
35873
35877
|
"gemini-*": ["gemini-codeassist", "google", "openrouter"],
|
|
35874
|
-
"grok-*": ["
|
|
35878
|
+
"grok-*": ["x-ai", "openrouter"],
|
|
35875
35879
|
"kimi-*": ["kimi-coding@kimi-for-coding", "kimi", "openrouter"],
|
|
35876
35880
|
"minimax-*": ["minimax-coding", "minimax", "openrouter"],
|
|
35877
35881
|
"glm-*": ["glm-coding", "glm", "openrouter"],
|
|
35878
|
-
"z-ai-*": ["
|
|
35882
|
+
"z-ai-*": ["z-ai", "openrouter"],
|
|
35879
35883
|
"deepseek-*": ["deepseek", "openrouter"],
|
|
35880
35884
|
"*-zen": ["opencode-zen"],
|
|
35881
35885
|
"*": ["openrouter"]
|
|
@@ -37961,7 +37965,7 @@ class AnthropicProviderTransport {
|
|
|
37961
37965
|
kimi: "Kimi",
|
|
37962
37966
|
"kimi-coding": "Kimi Coding",
|
|
37963
37967
|
moonshot: "Kimi",
|
|
37964
|
-
|
|
37968
|
+
"z-ai": "Z.AI"
|
|
37965
37969
|
};
|
|
37966
37970
|
return map3[name.toLowerCase()] || name.charAt(0).toUpperCase() + name.slice(1);
|
|
37967
37971
|
}
|
|
@@ -38893,13 +38897,13 @@ var init_provider_profiles = __esm(() => {
|
|
|
38893
38897
|
"gemini-codeassist": geminiCodeAssistProfile,
|
|
38894
38898
|
openai: openaiProfile,
|
|
38895
38899
|
"openai-codex": openaiCodexProfile,
|
|
38896
|
-
|
|
38900
|
+
"x-ai": openaiProfile,
|
|
38897
38901
|
qwen: openaiProfile,
|
|
38898
38902
|
minimax: anthropicCompatProfile,
|
|
38899
38903
|
"minimax-coding": anthropicCompatProfile,
|
|
38900
38904
|
kimi: anthropicCompatProfile,
|
|
38901
38905
|
"kimi-coding": anthropicCompatProfile,
|
|
38902
|
-
|
|
38906
|
+
"z-ai": anthropicCompatProfile,
|
|
38903
38907
|
glm: glmProfile,
|
|
38904
38908
|
"glm-coding": glmProfile,
|
|
38905
38909
|
"opencode-zen": openCodeZenProfile,
|
|
@@ -39313,8 +39317,17 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
39313
39317
|
return nativeHandler;
|
|
39314
39318
|
let target = requestedModel;
|
|
39315
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
|
+
}
|
|
39316
39329
|
const req = requestedModel.toLowerCase();
|
|
39317
|
-
if (modelMap) {
|
|
39330
|
+
if (slotMatched) {} else if (modelMap) {
|
|
39318
39331
|
if (req.includes("opus") && modelMap.opus) {
|
|
39319
39332
|
target = modelMap.opus;
|
|
39320
39333
|
wasFromModelMap = true;
|
|
@@ -39407,6 +39420,20 @@ ${plan.hint}` : `[Route] ${plan.reason}`;
|
|
|
39407
39420
|
config: { mode: monitorMode ? "monitor" : "hybrid", mappings: modelMap }
|
|
39408
39421
|
}));
|
|
39409
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
|
+
});
|
|
39410
39437
|
app.get("/v1/probe-discover", async (c) => {
|
|
39411
39438
|
const provider = c.req.query("provider");
|
|
39412
39439
|
if (!provider)
|
|
@@ -40582,6 +40609,201 @@ var init_mcp_server = __esm(() => {
|
|
|
40582
40609
|
]);
|
|
40583
40610
|
});
|
|
40584
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
|
+
|
|
40585
40807
|
// ../../node_modules/.bun/@inquirer+core@11.0.1+04f2146be16c61ef/node_modules/@inquirer/core/dist/lib/key.js
|
|
40586
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";
|
|
40587
40809
|
|
|
@@ -51853,7 +52075,7 @@ var init_RemoveFileError = __esm(() => {
|
|
|
51853
52075
|
|
|
51854
52076
|
// ../../node_modules/.bun/@inquirer+external-editor@2.0.1+04f2146be16c61ef/node_modules/@inquirer/external-editor/dist/index.js
|
|
51855
52077
|
import { spawn as spawn3, spawnSync } from "child_process";
|
|
51856
|
-
import { readFileSync as
|
|
52078
|
+
import { readFileSync as readFileSync17, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "fs";
|
|
51857
52079
|
import path from "path";
|
|
51858
52080
|
import os from "os";
|
|
51859
52081
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
@@ -51969,7 +52191,7 @@ class ExternalEditor {
|
|
|
51969
52191
|
}
|
|
51970
52192
|
readTemporaryFile() {
|
|
51971
52193
|
try {
|
|
51972
|
-
const tempFileBuffer =
|
|
52194
|
+
const tempFileBuffer = readFileSync17(this.tempFile);
|
|
51973
52195
|
if (tempFileBuffer.length === 0) {
|
|
51974
52196
|
this.text = "";
|
|
51975
52197
|
} else {
|
|
@@ -53159,15 +53381,15 @@ async function geminiQuotaHandler() {
|
|
|
53159
53381
|
}
|
|
53160
53382
|
}
|
|
53161
53383
|
async function codexQuotaHandler() {
|
|
53162
|
-
const { readFileSync:
|
|
53384
|
+
const { readFileSync: readFileSync18, existsSync: existsSync20 } = await import("fs");
|
|
53163
53385
|
const { join: join21 } = await import("path");
|
|
53164
53386
|
const { homedir: homedir20 } = await import("os");
|
|
53165
53387
|
const credPath = join21(homedir20(), ".claudish", "codex-oauth.json");
|
|
53166
|
-
if (!
|
|
53388
|
+
if (!existsSync20(credPath)) {
|
|
53167
53389
|
console.error(`${RED}No Codex credentials found.${R} Run: ${B}claudish login codex${R}`);
|
|
53168
53390
|
process.exit(1);
|
|
53169
53391
|
}
|
|
53170
|
-
const creds = JSON.parse(
|
|
53392
|
+
const creds = JSON.parse(readFileSync18(credPath, "utf-8"));
|
|
53171
53393
|
let email3 = "";
|
|
53172
53394
|
try {
|
|
53173
53395
|
const parts = creds.access_token.split(".");
|
|
@@ -53220,8 +53442,8 @@ async function codexQuotaHandler() {
|
|
|
53220
53442
|
let modelSlugs = [];
|
|
53221
53443
|
try {
|
|
53222
53444
|
const modelsPath = join21(homedir20(), ".codex", "models_cache.json");
|
|
53223
|
-
if (
|
|
53224
|
-
const cache = JSON.parse(
|
|
53445
|
+
if (existsSync20(modelsPath)) {
|
|
53446
|
+
const cache = JSON.parse(readFileSync18(modelsPath, "utf-8"));
|
|
53225
53447
|
modelSlugs = (cache.models || []).map((m) => m.slug || m.id).filter(Boolean);
|
|
53226
53448
|
}
|
|
53227
53449
|
} catch {}
|
|
@@ -54107,7 +54329,7 @@ var init_model_selector = __esm(() => {
|
|
|
54107
54329
|
"gemini-codeassist": "google",
|
|
54108
54330
|
openai: "openai",
|
|
54109
54331
|
"openai-codex": "openai",
|
|
54110
|
-
|
|
54332
|
+
"x-ai": "x-ai",
|
|
54111
54333
|
deepseek: "deepseek",
|
|
54112
54334
|
minimax: "minimax",
|
|
54113
54335
|
"minimax-coding": "minimax",
|
|
@@ -54115,7 +54337,7 @@ var init_model_selector = __esm(() => {
|
|
|
54115
54337
|
"kimi-coding": "moonshotai",
|
|
54116
54338
|
glm: "z-ai",
|
|
54117
54339
|
"glm-coding": "z-ai",
|
|
54118
|
-
|
|
54340
|
+
"z-ai": "z-ai",
|
|
54119
54341
|
zen: "opencode-zen",
|
|
54120
54342
|
"opencode-zen": "opencode-zen",
|
|
54121
54343
|
"opencode-zen-go": "opencode-zen-go",
|
|
@@ -54132,8 +54354,9 @@ var init_model_selector = __esm(() => {
|
|
|
54132
54354
|
oai: "openai",
|
|
54133
54355
|
codex: "openai-codex",
|
|
54134
54356
|
cx: "openai-codex",
|
|
54135
|
-
|
|
54136
|
-
|
|
54357
|
+
"x-ai": "x-ai",
|
|
54358
|
+
xai: "x-ai",
|
|
54359
|
+
grok: "x-ai",
|
|
54137
54360
|
minimax: "minimax",
|
|
54138
54361
|
mm: "minimax",
|
|
54139
54362
|
"minimax-coding": "minimax-coding",
|
|
@@ -54146,7 +54369,8 @@ var init_model_selector = __esm(() => {
|
|
|
54146
54369
|
glm: "glm",
|
|
54147
54370
|
"glm-coding": "glm-coding",
|
|
54148
54371
|
gc: "glm-coding",
|
|
54149
|
-
|
|
54372
|
+
"z-ai": "z-ai",
|
|
54373
|
+
zai: "z-ai",
|
|
54150
54374
|
zen: "zen",
|
|
54151
54375
|
ollamacloud: "ollamacloud",
|
|
54152
54376
|
oc: "ollamacloud",
|
|
@@ -54180,7 +54404,7 @@ var init_model_selector = __esm(() => {
|
|
|
54180
54404
|
description: "ChatGPT Plus/Pro subscription (Responses API)",
|
|
54181
54405
|
provider: "openai-codex"
|
|
54182
54406
|
},
|
|
54183
|
-
{ name: "xAI / Grok", value: "
|
|
54407
|
+
{ name: "xAI / Grok", value: "x-ai", description: "Direct API", provider: "x-ai" },
|
|
54184
54408
|
{ name: "DeepSeek", value: "deepseek", description: "Direct API", provider: "deepseek" },
|
|
54185
54409
|
{ name: "MiniMax", value: "minimax", description: "Direct API", provider: "minimax" },
|
|
54186
54410
|
{
|
|
@@ -54203,7 +54427,7 @@ var init_model_selector = __esm(() => {
|
|
|
54203
54427
|
description: "Coding subscription",
|
|
54204
54428
|
provider: "glm-coding"
|
|
54205
54429
|
},
|
|
54206
|
-
{ name: "Z.AI", value: "
|
|
54430
|
+
{ name: "Z.AI", value: "z-ai", description: "Direct API", provider: "z-ai" },
|
|
54207
54431
|
{
|
|
54208
54432
|
name: "OllamaCloud",
|
|
54209
54433
|
value: "ollamacloud",
|
|
@@ -54233,7 +54457,7 @@ var init_model_selector = __esm(() => {
|
|
|
54233
54457
|
google: "google@",
|
|
54234
54458
|
openai: "oai@",
|
|
54235
54459
|
"openai-codex": "cx@",
|
|
54236
|
-
|
|
54460
|
+
"x-ai": "x-ai@",
|
|
54237
54461
|
deepseek: "ds@",
|
|
54238
54462
|
minimax: "mm@",
|
|
54239
54463
|
kimi: "kimi@",
|
|
@@ -54241,7 +54465,7 @@ var init_model_selector = __esm(() => {
|
|
|
54241
54465
|
"kimi-coding": "kc@",
|
|
54242
54466
|
glm: "glm@",
|
|
54243
54467
|
"glm-coding": "gc@",
|
|
54244
|
-
|
|
54468
|
+
"z-ai": "z-ai@",
|
|
54245
54469
|
ollamacloud: "oc@",
|
|
54246
54470
|
ollama: "ollama@",
|
|
54247
54471
|
lmstudio: "lmstudio@",
|
|
@@ -54290,7 +54514,7 @@ var init_api_key_map = __esm(() => {
|
|
|
54290
54514
|
"kimi-coding": { envVar: "KIMI_CODING_API_KEY" },
|
|
54291
54515
|
glm: { envVar: "ZHIPU_API_KEY", aliases: ["GLM_API_KEY"] },
|
|
54292
54516
|
"glm-coding": { envVar: "GLM_CODING_API_KEY", aliases: ["ZAI_CODING_API_KEY"] },
|
|
54293
|
-
|
|
54517
|
+
"z-ai": { envVar: "ZAI_API_KEY" },
|
|
54294
54518
|
ollamacloud: { envVar: "OLLAMA_API_KEY" },
|
|
54295
54519
|
"opencode-zen": { envVar: "OPENCODE_API_KEY" },
|
|
54296
54520
|
"opencode-zen-go": { envVar: "OPENCODE_API_KEY" },
|
|
@@ -54630,6 +54854,8 @@ var init_probe_live = __esm(() => {
|
|
|
54630
54854
|
|
|
54631
54855
|
// src/providers/probe-runner.ts
|
|
54632
54856
|
function pinProbeModelSpec(link) {
|
|
54857
|
+
if (link.provider === "native-anthropic")
|
|
54858
|
+
return link.modelSpec;
|
|
54633
54859
|
return link.modelSpec.includes("@") ? link.modelSpec : `${link.provider}@${link.modelSpec}`;
|
|
54634
54860
|
}
|
|
54635
54861
|
function probeProviderRoute(proxyUrl, link, timeoutMs) {
|
|
@@ -54991,47 +55217,6 @@ function Banner() {
|
|
|
54991
55217
|
]
|
|
54992
55218
|
}, undefined, true, undefined, this);
|
|
54993
55219
|
}
|
|
54994
|
-
function StepLine({ steps }) {
|
|
54995
|
-
const iconMap = {
|
|
54996
|
-
pending: "\u25CB",
|
|
54997
|
-
running: "\u25CC",
|
|
54998
|
-
done: "\u2713",
|
|
54999
|
-
error: "\u2717"
|
|
55000
|
-
};
|
|
55001
|
-
const colorMap = {
|
|
55002
|
-
pending: C.dim,
|
|
55003
|
-
running: C.cyan,
|
|
55004
|
-
done: C.green,
|
|
55005
|
-
error: C.red
|
|
55006
|
-
};
|
|
55007
|
-
if (steps.length === 0)
|
|
55008
|
-
return /* @__PURE__ */ jsxDEV("text", {
|
|
55009
|
-
children: " "
|
|
55010
|
-
}, undefined, false, undefined, this);
|
|
55011
|
-
const active = steps.find((s) => s.status === "running" || s.status === "error") ?? steps[steps.length - 1];
|
|
55012
|
-
return /* @__PURE__ */ jsxDEV("text", {
|
|
55013
|
-
children: [
|
|
55014
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55015
|
-
children: " "
|
|
55016
|
-
}, undefined, false, undefined, this),
|
|
55017
|
-
steps.map((s, i) => /* @__PURE__ */ jsxDEV("span", {
|
|
55018
|
-
fg: colorMap[s.status],
|
|
55019
|
-
children: [
|
|
55020
|
-
iconMap[s.status],
|
|
55021
|
-
i < steps.length - 1 ? " " : ""
|
|
55022
|
-
]
|
|
55023
|
-
}, `${s.name}-${i}`, true, undefined, this)),
|
|
55024
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55025
|
-
fg: C.dim,
|
|
55026
|
-
children: " "
|
|
55027
|
-
}, undefined, false, undefined, this),
|
|
55028
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
55029
|
-
fg: colorMap[active.status],
|
|
55030
|
-
children: active.name
|
|
55031
|
-
}, undefined, false, undefined, this)
|
|
55032
|
-
]
|
|
55033
|
-
}, undefined, true, undefined, this);
|
|
55034
|
-
}
|
|
55035
55220
|
function ProgressBar({
|
|
55036
55221
|
link,
|
|
55037
55222
|
animFrame,
|
|
@@ -55322,11 +55507,15 @@ function TabBar({ activeTab }) {
|
|
|
55322
55507
|
fg: C.dim,
|
|
55323
55508
|
children: " "
|
|
55324
55509
|
}, undefined, false, undefined, this),
|
|
55325
|
-
tab("1
|
|
55510
|
+
tab("1 Summary", activeTab === "summary"),
|
|
55511
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55512
|
+
children: " "
|
|
55513
|
+
}, undefined, false, undefined, this),
|
|
55514
|
+
tab("2 Leaderboard", activeTab === "leaderboard"),
|
|
55326
55515
|
/* @__PURE__ */ jsxDEV("span", {
|
|
55327
55516
|
children: " "
|
|
55328
55517
|
}, undefined, false, undefined, this),
|
|
55329
|
-
tab("
|
|
55518
|
+
tab("3 Details", activeTab === "details")
|
|
55330
55519
|
]
|
|
55331
55520
|
}, undefined, true, undefined, this)
|
|
55332
55521
|
}, undefined, false, undefined, this);
|
|
@@ -55731,6 +55920,293 @@ function DetailsView({
|
|
|
55731
55920
|
}, r.model, false, undefined, this))
|
|
55732
55921
|
}, undefined, false, undefined, this);
|
|
55733
55922
|
}
|
|
55923
|
+
function pickRepresentativeLink(result) {
|
|
55924
|
+
for (const link of result.links) {
|
|
55925
|
+
if (link.probe?.state === "live" && link.probe.timing) {
|
|
55926
|
+
return { model: result.model, provider: link.displayName, timing: link.probe.timing };
|
|
55927
|
+
}
|
|
55928
|
+
}
|
|
55929
|
+
return { model: result.model, provider: result.nativeProvider };
|
|
55930
|
+
}
|
|
55931
|
+
function LeaderLiveRow({
|
|
55932
|
+
row,
|
|
55933
|
+
rank,
|
|
55934
|
+
isFastest,
|
|
55935
|
+
rankW,
|
|
55936
|
+
nameW,
|
|
55937
|
+
provW,
|
|
55938
|
+
layout,
|
|
55939
|
+
maxTotalMs,
|
|
55940
|
+
maxTokPerSec
|
|
55941
|
+
}) {
|
|
55942
|
+
const t = row.timing;
|
|
55943
|
+
const barCells = timelineBarCells(t.totalMs, maxTotalMs, layout.barWidth);
|
|
55944
|
+
const stages = splitStageCells(t.ttfbMs, t.ttftMs, t.totalMs, barCells);
|
|
55945
|
+
const trackCells = Math.max(0, layout.barWidth - barCells);
|
|
55946
|
+
const netMs = Math.max(0, t.ttfbMs);
|
|
55947
|
+
const srvMs = Math.max(0, t.ttftMs - t.ttfbMs);
|
|
55948
|
+
const strMs = Math.max(0, t.totalMs - t.ttftMs);
|
|
55949
|
+
const netStr = padStartSafe(breakdownNum(netMs), STAGE_NUM_W);
|
|
55950
|
+
const srvStr = padStartSafe(breakdownNum(srvMs), STAGE_NUM_W);
|
|
55951
|
+
const strStr = padStartSafe(breakdownNum(strMs), STAGE_NUM_W);
|
|
55952
|
+
const tokColor = throughputFg(t.tokensPerSec);
|
|
55953
|
+
const tokCells = layout.tokWidth > 0 ? tokBarCells(t.tokensPerSec, maxTokPerSec, layout.tokWidth) : 0;
|
|
55954
|
+
const tokTrack = Math.max(0, layout.tokWidth - tokCells);
|
|
55955
|
+
const tokValue = padStartSafe(`${Math.round(t.tokensPerSec)} t/s`, TOK_VALUE_COL);
|
|
55956
|
+
const lead = /* @__PURE__ */ jsxDEV(Fragment, {
|
|
55957
|
+
children: [
|
|
55958
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55959
|
+
fg: C.dim,
|
|
55960
|
+
children: " "
|
|
55961
|
+
}, undefined, false, undefined, this),
|
|
55962
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55963
|
+
fg: C.dim,
|
|
55964
|
+
children: padStartSafe(String(rank), rankW)
|
|
55965
|
+
}, undefined, false, undefined, this),
|
|
55966
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55967
|
+
children: " "
|
|
55968
|
+
}, undefined, false, undefined, this),
|
|
55969
|
+
isFastest ? /* @__PURE__ */ jsxDEV("span", {
|
|
55970
|
+
fg: C.brightGreen,
|
|
55971
|
+
children: "\u25CF"
|
|
55972
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV("span", {
|
|
55973
|
+
children: " "
|
|
55974
|
+
}, undefined, false, undefined, this),
|
|
55975
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55976
|
+
children: " "
|
|
55977
|
+
}, undefined, false, undefined, this),
|
|
55978
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55979
|
+
fg: C.fg,
|
|
55980
|
+
attributes: A.bold,
|
|
55981
|
+
children: padEndSafe(row.model, nameW)
|
|
55982
|
+
}, undefined, false, undefined, this),
|
|
55983
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55984
|
+
children: " "
|
|
55985
|
+
}, undefined, false, undefined, this),
|
|
55986
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55987
|
+
fg: C.dim,
|
|
55988
|
+
children: padEndSafe(row.provider, provW)
|
|
55989
|
+
}, undefined, false, undefined, this),
|
|
55990
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
55991
|
+
children: " "
|
|
55992
|
+
}, undefined, false, undefined, this)
|
|
55993
|
+
]
|
|
55994
|
+
}, undefined, true, undefined, this);
|
|
55995
|
+
if (layout.barWidth <= 0) {
|
|
55996
|
+
return /* @__PURE__ */ jsxDEV("text", {
|
|
55997
|
+
children: [
|
|
55998
|
+
lead,
|
|
55999
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56000
|
+
fg: C.white,
|
|
56001
|
+
children: padStartSafe(formatLatency(t.totalMs), TOTAL_COL)
|
|
56002
|
+
}, undefined, false, undefined, this)
|
|
56003
|
+
]
|
|
56004
|
+
}, undefined, true, undefined, this);
|
|
56005
|
+
}
|
|
56006
|
+
return /* @__PURE__ */ jsxDEV("text", {
|
|
56007
|
+
children: [
|
|
56008
|
+
lead,
|
|
56009
|
+
stages.network > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56010
|
+
bg: STAGE_BG.network,
|
|
56011
|
+
children: " ".repeat(stages.network)
|
|
56012
|
+
}, undefined, false, undefined, this),
|
|
56013
|
+
stages.server > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56014
|
+
bg: STAGE_BG.server,
|
|
56015
|
+
children: " ".repeat(stages.server)
|
|
56016
|
+
}, undefined, false, undefined, this),
|
|
56017
|
+
stages.streaming > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56018
|
+
bg: STAGE_BG.streaming,
|
|
56019
|
+
children: " ".repeat(stages.streaming)
|
|
56020
|
+
}, undefined, false, undefined, this),
|
|
56021
|
+
trackCells > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56022
|
+
fg: C.dim,
|
|
56023
|
+
children: TRACK_CHAR.repeat(trackCells)
|
|
56024
|
+
}, undefined, false, undefined, this),
|
|
56025
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56026
|
+
fg: C.dim,
|
|
56027
|
+
children: " "
|
|
56028
|
+
}, undefined, false, undefined, this),
|
|
56029
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56030
|
+
fg: C.white,
|
|
56031
|
+
children: padStartSafe(formatLatency(t.totalMs), TOTAL_COL)
|
|
56032
|
+
}, undefined, false, undefined, this),
|
|
56033
|
+
layout.showBreakdown && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
56034
|
+
children: [
|
|
56035
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56036
|
+
fg: C.dim,
|
|
56037
|
+
children: " "
|
|
56038
|
+
}, undefined, false, undefined, this),
|
|
56039
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56040
|
+
fg: STAGE_FG.network,
|
|
56041
|
+
children: netStr
|
|
56042
|
+
}, undefined, false, undefined, this),
|
|
56043
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56044
|
+
fg: C.dim,
|
|
56045
|
+
children: " "
|
|
56046
|
+
}, undefined, false, undefined, this),
|
|
56047
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56048
|
+
fg: STAGE_FG.server,
|
|
56049
|
+
children: srvStr
|
|
56050
|
+
}, undefined, false, undefined, this),
|
|
56051
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56052
|
+
fg: C.dim,
|
|
56053
|
+
children: " "
|
|
56054
|
+
}, undefined, false, undefined, this),
|
|
56055
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56056
|
+
fg: STAGE_FG.streaming,
|
|
56057
|
+
children: strStr
|
|
56058
|
+
}, undefined, false, undefined, this)
|
|
56059
|
+
]
|
|
56060
|
+
}, undefined, true, undefined, this),
|
|
56061
|
+
layout.tokWidth > 0 && /* @__PURE__ */ jsxDEV(Fragment, {
|
|
56062
|
+
children: [
|
|
56063
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56064
|
+
fg: C.dim,
|
|
56065
|
+
children: " "
|
|
56066
|
+
}, undefined, false, undefined, this),
|
|
56067
|
+
tokCells > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56068
|
+
fg: tokColor,
|
|
56069
|
+
children: BAR_FILL.repeat(tokCells)
|
|
56070
|
+
}, undefined, false, undefined, this),
|
|
56071
|
+
tokTrack > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56072
|
+
fg: C.dim,
|
|
56073
|
+
children: TRACK_CHAR.repeat(tokTrack)
|
|
56074
|
+
}, undefined, false, undefined, this),
|
|
56075
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56076
|
+
fg: C.dim,
|
|
56077
|
+
children: " "
|
|
56078
|
+
}, undefined, false, undefined, this)
|
|
56079
|
+
]
|
|
56080
|
+
}, undefined, true, undefined, this),
|
|
56081
|
+
layout.tokWidth === 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56082
|
+
fg: C.dim,
|
|
56083
|
+
children: " "
|
|
56084
|
+
}, undefined, false, undefined, this),
|
|
56085
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56086
|
+
fg: tokColor,
|
|
56087
|
+
children: tokValue
|
|
56088
|
+
}, undefined, false, undefined, this)
|
|
56089
|
+
]
|
|
56090
|
+
}, undefined, true, undefined, this);
|
|
56091
|
+
}
|
|
56092
|
+
function LeaderboardView({
|
|
56093
|
+
results,
|
|
56094
|
+
layout,
|
|
56095
|
+
maxTotalMs,
|
|
56096
|
+
maxTokPerSec
|
|
56097
|
+
}) {
|
|
56098
|
+
const reps = results.map(pickRepresentativeLink);
|
|
56099
|
+
const live = reps.filter((r) => r.timing).sort((a, b) => a.timing.totalMs - b.timing.totalMs);
|
|
56100
|
+
const unavailable = reps.filter((r) => !r.timing);
|
|
56101
|
+
const nameW = Math.min(28, Math.max(5, ...reps.map((r) => r.model.length)));
|
|
56102
|
+
const provW = Math.min(18, Math.max(8, ...reps.map((r) => r.provider.length)));
|
|
56103
|
+
const rankW = Math.max(1, String(Math.max(1, live.length)).length);
|
|
56104
|
+
const rankHdr = " ".repeat(rankW) + " ";
|
|
56105
|
+
return /* @__PURE__ */ jsxDEV("box", {
|
|
56106
|
+
flexDirection: "column",
|
|
56107
|
+
children: [
|
|
56108
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
56109
|
+
children: [
|
|
56110
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56111
|
+
fg: C.dim,
|
|
56112
|
+
children: " "
|
|
56113
|
+
}, undefined, false, undefined, this),
|
|
56114
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56115
|
+
fg: C.cyan,
|
|
56116
|
+
attributes: A.bold,
|
|
56117
|
+
children: "Leaderboard"
|
|
56118
|
+
}, undefined, false, undefined, this),
|
|
56119
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56120
|
+
fg: C.dim,
|
|
56121
|
+
children: " \u2014 fastest first"
|
|
56122
|
+
}, undefined, false, undefined, this)
|
|
56123
|
+
]
|
|
56124
|
+
}, undefined, true, undefined, this),
|
|
56125
|
+
/* @__PURE__ */ jsxDEV("text", {
|
|
56126
|
+
children: [
|
|
56127
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56128
|
+
fg: C.dim,
|
|
56129
|
+
children: " " + rankHdr
|
|
56130
|
+
}, undefined, false, undefined, this),
|
|
56131
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56132
|
+
fg: C.dim,
|
|
56133
|
+
children: padEndSafe("MODEL", nameW)
|
|
56134
|
+
}, undefined, false, undefined, this),
|
|
56135
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56136
|
+
fg: C.dim,
|
|
56137
|
+
children: " "
|
|
56138
|
+
}, undefined, false, undefined, this),
|
|
56139
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56140
|
+
fg: C.dim,
|
|
56141
|
+
children: padEndSafe("PROVIDER", provW)
|
|
56142
|
+
}, undefined, false, undefined, this),
|
|
56143
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56144
|
+
fg: C.dim,
|
|
56145
|
+
children: " "
|
|
56146
|
+
}, undefined, false, undefined, this),
|
|
56147
|
+
layout.barWidth > 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
56148
|
+
fg: C.dim,
|
|
56149
|
+
children: padEndSafe("TIMELINE", layout.barWidth)
|
|
56150
|
+
}, undefined, false, undefined, this),
|
|
56151
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56152
|
+
fg: C.dim,
|
|
56153
|
+
children: " "
|
|
56154
|
+
}, undefined, false, undefined, this),
|
|
56155
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56156
|
+
fg: C.dim,
|
|
56157
|
+
children: padStartSafe("TOTAL", TOTAL_COL)
|
|
56158
|
+
}, undefined, false, undefined, this),
|
|
56159
|
+
layout.showBreakdown && /* @__PURE__ */ jsxDEV("span", {
|
|
56160
|
+
fg: C.dim,
|
|
56161
|
+
children: " " + padEndSafe("net", STAGE_NUM_W) + " " + padEndSafe("srv", STAGE_NUM_W) + " " + padEndSafe("str", STAGE_NUM_W)
|
|
56162
|
+
}, undefined, false, undefined, this),
|
|
56163
|
+
layout.tokWidth > 0 ? /* @__PURE__ */ jsxDEV("span", {
|
|
56164
|
+
fg: C.dim,
|
|
56165
|
+
children: " " + " ".repeat(layout.tokWidth + 1) + padStartSafe("tok/s", TOK_VALUE_COL)
|
|
56166
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV("span", {
|
|
56167
|
+
fg: C.dim,
|
|
56168
|
+
children: " " + padStartSafe("tok/s", TOK_VALUE_COL)
|
|
56169
|
+
}, undefined, false, undefined, this)
|
|
56170
|
+
]
|
|
56171
|
+
}, undefined, true, undefined, this),
|
|
56172
|
+
live.map((row, idx) => /* @__PURE__ */ jsxDEV(LeaderLiveRow, {
|
|
56173
|
+
row,
|
|
56174
|
+
rank: idx + 1,
|
|
56175
|
+
isFastest: idx === 0,
|
|
56176
|
+
rankW,
|
|
56177
|
+
nameW,
|
|
56178
|
+
provW,
|
|
56179
|
+
layout,
|
|
56180
|
+
maxTotalMs,
|
|
56181
|
+
maxTokPerSec
|
|
56182
|
+
}, `lb:${row.model}`, false, undefined, this)),
|
|
56183
|
+
unavailable.map((row) => /* @__PURE__ */ jsxDEV("text", {
|
|
56184
|
+
children: [
|
|
56185
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56186
|
+
fg: C.dim,
|
|
56187
|
+
children: " " + " ".repeat(rankW) + " "
|
|
56188
|
+
}, undefined, false, undefined, this),
|
|
56189
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56190
|
+
fg: C.dim,
|
|
56191
|
+
children: padEndSafe(row.model, nameW)
|
|
56192
|
+
}, undefined, false, undefined, this),
|
|
56193
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56194
|
+
fg: C.dim,
|
|
56195
|
+
children: " "
|
|
56196
|
+
}, undefined, false, undefined, this),
|
|
56197
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56198
|
+
fg: C.dim,
|
|
56199
|
+
children: padEndSafe(row.provider, provW)
|
|
56200
|
+
}, undefined, false, undefined, this),
|
|
56201
|
+
/* @__PURE__ */ jsxDEV("span", {
|
|
56202
|
+
fg: C.dim,
|
|
56203
|
+
children: " \u2014 no live route"
|
|
56204
|
+
}, undefined, false, undefined, this)
|
|
56205
|
+
]
|
|
56206
|
+
}, `lb-na:${row.model}`, true, undefined, this))
|
|
56207
|
+
]
|
|
56208
|
+
}, undefined, true, undefined, this);
|
|
56209
|
+
}
|
|
55734
56210
|
function ProbeApp({
|
|
55735
56211
|
store,
|
|
55736
56212
|
onQuit
|
|
@@ -55747,14 +56223,21 @@ function ProbeApp({
|
|
|
55747
56223
|
return;
|
|
55748
56224
|
}
|
|
55749
56225
|
if (key.name === "tab") {
|
|
55750
|
-
|
|
56226
|
+
const order = ["summary", "leaderboard", "details"];
|
|
56227
|
+
const cur = order.indexOf(store.getState().activeTab);
|
|
56228
|
+
const next = key.shift ? (cur - 1 + order.length) % order.length : (cur + 1) % order.length;
|
|
56229
|
+
store.setActiveTab(order[next]);
|
|
55751
56230
|
return;
|
|
55752
56231
|
}
|
|
55753
56232
|
if (key.name === "1") {
|
|
55754
|
-
store.setActiveTab("
|
|
56233
|
+
store.setActiveTab("summary");
|
|
55755
56234
|
return;
|
|
55756
56235
|
}
|
|
55757
56236
|
if (key.name === "2") {
|
|
56237
|
+
store.setActiveTab("leaderboard");
|
|
56238
|
+
return;
|
|
56239
|
+
}
|
|
56240
|
+
if (key.name === "3") {
|
|
55758
56241
|
store.setActiveTab("details");
|
|
55759
56242
|
return;
|
|
55760
56243
|
}
|
|
@@ -55824,14 +56307,16 @@ function ProbeApp({
|
|
|
55824
56307
|
if (fastestTokPerSec <= 0)
|
|
55825
56308
|
fastestLinkId = null;
|
|
55826
56309
|
const showDetails = isDone && state.activeTab === "details";
|
|
55827
|
-
const
|
|
56310
|
+
const showLeaderboard = isDone && state.activeTab === "leaderboard";
|
|
56311
|
+
const showSummary = !showDetails && !showLeaderboard;
|
|
56312
|
+
const stepsRows = 0;
|
|
55828
56313
|
const tabBarRows = isDone ? TAB_BAR_ROWS : 0;
|
|
55829
|
-
const legendRows =
|
|
56314
|
+
const legendRows = showSummary ? LEGEND_ROWS : 0;
|
|
55830
56315
|
const listH = Math.max(MIN_LIST_H, termHeight - BANNER_ROWS - stepsRows - tabBarRows - legendRows - SCROLL_HINT_ROWS);
|
|
55831
56316
|
const sbForHint = listScrollRef.current;
|
|
55832
56317
|
const overflow = sbForHint ? sbForHint.content.height > sbForHint.viewport.height : true;
|
|
55833
56318
|
const scrollKeys = "\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 g/G top/bottom";
|
|
55834
|
-
const footerHint = isDone ? " " + (overflow ? scrollKeys + " \xB7 " : "") + "Tab/1/2 switch \xB7 q quit" : " " + (overflow ? scrollKeys : "");
|
|
56319
|
+
const footerHint = isDone ? " " + (overflow ? scrollKeys + " \xB7 " : "") + "Tab/1/2/3 switch \xB7 q quit" : " " + (overflow ? scrollKeys : "");
|
|
55835
56320
|
return /* @__PURE__ */ jsxDEV("box", {
|
|
55836
56321
|
flexDirection: "column",
|
|
55837
56322
|
children: [
|
|
@@ -55842,15 +56327,10 @@ function ProbeApp({
|
|
|
55842
56327
|
}, undefined, false, undefined, this),
|
|
55843
56328
|
isDone ? /* @__PURE__ */ jsxDEV(TabBar, {
|
|
55844
56329
|
activeTab: state.activeTab
|
|
55845
|
-
}, undefined, false, undefined, this) :
|
|
55846
|
-
flexDirection: "column",
|
|
55847
|
-
children: /* @__PURE__ */ jsxDEV(StepLine, {
|
|
55848
|
-
steps: state.steps
|
|
55849
|
-
}, undefined, false, undefined, this)
|
|
55850
|
-
}, undefined, false, undefined, this),
|
|
56330
|
+
}, undefined, false, undefined, this) : null,
|
|
55851
56331
|
groups.length > 0 ? /* @__PURE__ */ jsxDEV(Fragment, {
|
|
55852
56332
|
children: [
|
|
55853
|
-
|
|
56333
|
+
showSummary && /* @__PURE__ */ jsxDEV("box", {
|
|
55854
56334
|
flexDirection: "column",
|
|
55855
56335
|
height: LEGEND_ROWS,
|
|
55856
56336
|
children: /* @__PURE__ */ jsxDEV(Legend, {
|
|
@@ -55869,6 +56349,11 @@ function ProbeApp({
|
|
|
55869
56349
|
termWidth,
|
|
55870
56350
|
maxTotalMs,
|
|
55871
56351
|
maxTokPerSec
|
|
56352
|
+
}, undefined, false, undefined, this) : showLeaderboard ? /* @__PURE__ */ jsxDEV(LeaderboardView, {
|
|
56353
|
+
results: state.results,
|
|
56354
|
+
layout,
|
|
56355
|
+
maxTotalMs,
|
|
56356
|
+
maxTokPerSec
|
|
55872
56357
|
}, undefined, false, undefined, this) : groups.map((g, idx) => /* @__PURE__ */ jsxDEV(ModelGroup, {
|
|
55873
56358
|
model: g.model,
|
|
55874
56359
|
links: g.links,
|
|
@@ -56577,18 +57062,6 @@ function renderLeaderboard(results, scales, maxWidth, w) {
|
|
|
56577
57062
|
w(`
|
|
56578
57063
|
`);
|
|
56579
57064
|
}
|
|
56580
|
-
function printLeaderboardScrollback(results, isLiveProbe) {
|
|
56581
|
-
const w = process.stderr.write.bind(process.stderr);
|
|
56582
|
-
const anyTimedLive = results.some((r) => r.directProbe?.state === "live" && r.directProbe.timing !== undefined) || results.some((r) => (r.chain ?? []).some((c) => c.probe?.state === "live" && c.probe.timing !== undefined));
|
|
56583
|
-
if (!isLiveProbe || !anyTimedLive)
|
|
56584
|
-
return;
|
|
56585
|
-
const scales = computeBarScales(results);
|
|
56586
|
-
const termCols = process.stderr.columns ?? process.stdout.columns ?? 100;
|
|
56587
|
-
const maxAllowed = Math.max(MIN_CARD_WIDTH, termCols - 4);
|
|
56588
|
-
w(`
|
|
56589
|
-
`);
|
|
56590
|
-
renderLeaderboard(results, scales, maxAllowed, w);
|
|
56591
|
-
}
|
|
56592
57065
|
function printProbeResults(results, isLiveProbe) {
|
|
56593
57066
|
const w = process.stderr.write.bind(process.stderr);
|
|
56594
57067
|
w(`
|
|
@@ -56661,8 +57134,8 @@ __export(exports_cli, {
|
|
|
56661
57134
|
getMissingKeyError: () => getMissingKeyError
|
|
56662
57135
|
});
|
|
56663
57136
|
import {
|
|
56664
|
-
readFileSync as
|
|
56665
|
-
existsSync as
|
|
57137
|
+
readFileSync as readFileSync18,
|
|
57138
|
+
existsSync as existsSync20,
|
|
56666
57139
|
mkdirSync as mkdirSync10,
|
|
56667
57140
|
copyFileSync,
|
|
56668
57141
|
readdirSync as readdirSync4,
|
|
@@ -56677,7 +57150,7 @@ function getVersion3() {
|
|
|
56677
57150
|
}
|
|
56678
57151
|
function clearAllModelCaches() {
|
|
56679
57152
|
const cacheDir = join21(homedir20(), ".claudish");
|
|
56680
|
-
if (!
|
|
57153
|
+
if (!existsSync20(cacheDir))
|
|
56681
57154
|
return;
|
|
56682
57155
|
const cachePatterns = ["pricing-cache.json", "recommended-models-cache.json"];
|
|
56683
57156
|
let cleared = 0;
|
|
@@ -57056,7 +57529,7 @@ Usage: claudish --list-models --provider <slug>`);
|
|
|
57056
57529
|
config3.resolvedDefaultProvider = resolved;
|
|
57057
57530
|
if (resolved.legacyAutoPromoted && !config3.quiet) {
|
|
57058
57531
|
const markerFile = join21(homedir20(), ".claudish", ".legacy-litellm-hint-shown");
|
|
57059
|
-
if (!
|
|
57532
|
+
if (!existsSync20(markerFile)) {
|
|
57060
57533
|
const hint = buildLegacyHint(resolved);
|
|
57061
57534
|
if (hint) {
|
|
57062
57535
|
console.error(hint);
|
|
@@ -57414,6 +57887,20 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57414
57887
|
matchedPattern: undefined
|
|
57415
57888
|
};
|
|
57416
57889
|
}
|
|
57890
|
+
if (parsed.provider === "native-anthropic") {
|
|
57891
|
+
const opusModel = process.env[ENV.CLAUDISH_MODEL_OPUS] || process.env[ENV.ANTHROPIC_DEFAULT_OPUS_MODEL] || "claude-opus-4-1";
|
|
57892
|
+
return {
|
|
57893
|
+
routes: [
|
|
57894
|
+
{
|
|
57895
|
+
provider: "native-anthropic",
|
|
57896
|
+
modelSpec: opusModel,
|
|
57897
|
+
displayName: "Claude Code (Opus)"
|
|
57898
|
+
}
|
|
57899
|
+
],
|
|
57900
|
+
source: "auto-chain",
|
|
57901
|
+
matchedPattern: undefined
|
|
57902
|
+
};
|
|
57903
|
+
}
|
|
57417
57904
|
const routingRules = loadRoutingRules();
|
|
57418
57905
|
const matched = matchRoutingRule(parsed.model, routingRules);
|
|
57419
57906
|
if (matched) {
|
|
@@ -57447,7 +57934,12 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57447
57934
|
let hasCredentials = false;
|
|
57448
57935
|
let credentialHint;
|
|
57449
57936
|
let provenance;
|
|
57450
|
-
if (
|
|
57937
|
+
if (route2.provider === "native-anthropic") {
|
|
57938
|
+
hasCredentials = !!process.env.ANTHROPIC_API_KEY;
|
|
57939
|
+
if (!hasCredentials) {
|
|
57940
|
+
credentialHint = "ANTHROPIC_API_KEY (required to probe Claude Code)";
|
|
57941
|
+
}
|
|
57942
|
+
} else if (providerDef?.isLocal) {
|
|
57451
57943
|
hasCredentials = isLocalProviderEnabled(route2.provider);
|
|
57452
57944
|
if (!hasCredentials) {
|
|
57453
57945
|
credentialHint = "enable local provider in global config";
|
|
@@ -57479,6 +57971,9 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57479
57971
|
return { parsed, chain, chainDetails };
|
|
57480
57972
|
}
|
|
57481
57973
|
function buildRoutingExplanation(parsed, chain) {
|
|
57974
|
+
if (parsed.provider === "native-anthropic") {
|
|
57975
|
+
return "native passthrough \xB7 default Claude Code (Opus)";
|
|
57976
|
+
}
|
|
57482
57977
|
if (chain.source === "direct") {
|
|
57483
57978
|
return `explicit \xB7 ${parsed.provider} (direct)`;
|
|
57484
57979
|
}
|
|
@@ -57528,7 +58023,7 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57528
58023
|
const modelName = resolvedSpec?.modelName || parsedModel;
|
|
57529
58024
|
let formatAdapterName = "OpenAIAPIFormat";
|
|
57530
58025
|
let declaredStreamFormat = "openai-sse";
|
|
57531
|
-
const anthropicCompatProviders = ["minimax", "minimax-coding", "kimi", "kimi-coding", "
|
|
58026
|
+
const anthropicCompatProviders = ["minimax", "minimax-coding", "kimi", "kimi-coding", "z-ai"];
|
|
57532
58027
|
const isMinimaxModel = modelName.toLowerCase().includes("minimax");
|
|
57533
58028
|
if (anthropicCompatProviders.includes(providerName)) {
|
|
57534
58029
|
formatAdapterName = "AnthropicAPIFormat";
|
|
@@ -57653,7 +58148,7 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57653
58148
|
links: [],
|
|
57654
58149
|
phase: "live",
|
|
57655
58150
|
results: [],
|
|
57656
|
-
activeTab: "
|
|
58151
|
+
activeTab: "summary"
|
|
57657
58152
|
};
|
|
57658
58153
|
const tui = await startProbeTui(initialState);
|
|
57659
58154
|
const addStep = (name, status) => {
|
|
@@ -57826,7 +58321,6 @@ async function probeModelRouting(models, jsonOutput, options = { live: true, tim
|
|
|
57826
58321
|
tui.store.setResults(results);
|
|
57827
58322
|
await tui.waitForQuit();
|
|
57828
58323
|
await tui.shutdown();
|
|
57829
|
-
printLeaderboardScrollback(printable, isLiveProbe);
|
|
57830
58324
|
} else {
|
|
57831
58325
|
if (liveProxy) {
|
|
57832
58326
|
try {
|
|
@@ -57871,7 +58365,8 @@ MODEL ROUTING:
|
|
|
57871
58365
|
mm, mmax -> MiniMax Direct mm@MiniMax-M2.1
|
|
57872
58366
|
kimi, moon -> Kimi Direct kimi@kimi-k2-thinking-turbo
|
|
57873
58367
|
glm, zhipu -> GLM Direct glm@glm-4.7
|
|
57874
|
-
zai
|
|
58368
|
+
z-ai, zai -> Z.AI Direct z-ai@glm-4.7
|
|
58369
|
+
x-ai, grok -> xAI / Grok x-ai@grok-3
|
|
57875
58370
|
oc -> OllamaCloud oc@llama-3.1
|
|
57876
58371
|
llama,lc,meta-> OllamaCloud llama@llama-3.1
|
|
57877
58372
|
zen -> OpenCode Zen zen@grok-code
|
|
@@ -58182,7 +58677,7 @@ MORE INFO:
|
|
|
58182
58677
|
function printAIAgentGuide() {
|
|
58183
58678
|
try {
|
|
58184
58679
|
const guidePath = join21(__dirname3, "../AI_AGENT_GUIDE.md");
|
|
58185
|
-
const guideContent =
|
|
58680
|
+
const guideContent = readFileSync18(guidePath, "utf-8");
|
|
58186
58681
|
console.log(guideContent);
|
|
58187
58682
|
} catch (error46) {
|
|
58188
58683
|
console.error("Error reading AI Agent Guide:");
|
|
@@ -58202,7 +58697,7 @@ async function initializeClaudishSkill() {
|
|
|
58202
58697
|
const skillsDir = join21(claudeDir, "skills");
|
|
58203
58698
|
const claudishSkillDir = join21(skillsDir, "claudish-usage");
|
|
58204
58699
|
const skillFile = join21(claudishSkillDir, "SKILL.md");
|
|
58205
|
-
if (
|
|
58700
|
+
if (existsSync20(skillFile)) {
|
|
58206
58701
|
console.log("\u2705 Claudish skill already installed at:");
|
|
58207
58702
|
console.log(` ${skillFile}
|
|
58208
58703
|
`);
|
|
@@ -58210,7 +58705,7 @@ async function initializeClaudishSkill() {
|
|
|
58210
58705
|
return;
|
|
58211
58706
|
}
|
|
58212
58707
|
const sourceSkillPath = join21(__dirname3, "../skills/claudish-usage/SKILL.md");
|
|
58213
|
-
if (!
|
|
58708
|
+
if (!existsSync20(sourceSkillPath)) {
|
|
58214
58709
|
console.error("\u274C Error: Claudish skill file not found in installation.");
|
|
58215
58710
|
console.error(` Expected at: ${sourceSkillPath}`);
|
|
58216
58711
|
console.error(`
|
|
@@ -58219,15 +58714,15 @@ async function initializeClaudishSkill() {
|
|
|
58219
58714
|
process.exit(1);
|
|
58220
58715
|
}
|
|
58221
58716
|
try {
|
|
58222
|
-
if (!
|
|
58717
|
+
if (!existsSync20(claudeDir)) {
|
|
58223
58718
|
mkdirSync10(claudeDir, { recursive: true });
|
|
58224
58719
|
console.log("\uD83D\uDCC1 Created .claude/ directory");
|
|
58225
58720
|
}
|
|
58226
|
-
if (!
|
|
58721
|
+
if (!existsSync20(skillsDir)) {
|
|
58227
58722
|
mkdirSync10(skillsDir, { recursive: true });
|
|
58228
58723
|
console.log("\uD83D\uDCC1 Created .claude/skills/ directory");
|
|
58229
58724
|
}
|
|
58230
|
-
if (!
|
|
58725
|
+
if (!existsSync20(claudishSkillDir)) {
|
|
58231
58726
|
mkdirSync10(claudishSkillDir, { recursive: true });
|
|
58232
58727
|
console.log("\uD83D\uDCC1 Created .claude/skills/claudish-usage/ directory");
|
|
58233
58728
|
}
|
|
@@ -58311,7 +58806,7 @@ __export(exports_update_checker, {
|
|
|
58311
58806
|
clearCache: () => clearCache,
|
|
58312
58807
|
checkForUpdates: () => checkForUpdates
|
|
58313
58808
|
});
|
|
58314
|
-
import { existsSync as
|
|
58809
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync11, readFileSync as readFileSync19, unlinkSync as unlinkSync9, writeFileSync as writeFileSync12 } from "fs";
|
|
58315
58810
|
import { homedir as homedir21, platform as platform2, tmpdir } from "os";
|
|
58316
58811
|
import { join as join22 } from "path";
|
|
58317
58812
|
function getCacheFilePath() {
|
|
@@ -58323,7 +58818,7 @@ function getCacheFilePath() {
|
|
|
58323
58818
|
cacheDir = join22(homedir21(), ".cache", "claudish");
|
|
58324
58819
|
}
|
|
58325
58820
|
try {
|
|
58326
|
-
if (!
|
|
58821
|
+
if (!existsSync21(cacheDir)) {
|
|
58327
58822
|
mkdirSync11(cacheDir, { recursive: true });
|
|
58328
58823
|
}
|
|
58329
58824
|
return join22(cacheDir, "update-check.json");
|
|
@@ -58334,10 +58829,10 @@ function getCacheFilePath() {
|
|
|
58334
58829
|
function readCache() {
|
|
58335
58830
|
try {
|
|
58336
58831
|
const cachePath = getCacheFilePath();
|
|
58337
|
-
if (!
|
|
58832
|
+
if (!existsSync21(cachePath)) {
|
|
58338
58833
|
return null;
|
|
58339
58834
|
}
|
|
58340
|
-
const data = JSON.parse(
|
|
58835
|
+
const data = JSON.parse(readFileSync19(cachePath, "utf-8"));
|
|
58341
58836
|
return data;
|
|
58342
58837
|
} catch {
|
|
58343
58838
|
return null;
|
|
@@ -58360,7 +58855,7 @@ function isCacheValid(cache) {
|
|
|
58360
58855
|
function clearCache() {
|
|
58361
58856
|
try {
|
|
58362
58857
|
const cachePath = getCacheFilePath();
|
|
58363
|
-
if (
|
|
58858
|
+
if (existsSync21(cachePath)) {
|
|
58364
58859
|
unlinkSync9(cachePath);
|
|
58365
58860
|
}
|
|
58366
58861
|
} catch {}
|
|
@@ -59144,15 +59639,15 @@ var init_profile_commands = __esm(() => {
|
|
|
59144
59639
|
});
|
|
59145
59640
|
|
|
59146
59641
|
// src/providers/probe-catalog.ts
|
|
59147
|
-
import { existsSync as
|
|
59642
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "fs";
|
|
59148
59643
|
import { homedir as homedir22 } from "os";
|
|
59149
59644
|
import { dirname as dirname5, join as join23 } from "path";
|
|
59150
59645
|
function readProbeModelsCache(path2 = PROBE_MODELS_CACHE_PATH) {
|
|
59151
|
-
if (!
|
|
59646
|
+
if (!existsSync22(path2))
|
|
59152
59647
|
return null;
|
|
59153
59648
|
let raw2;
|
|
59154
59649
|
try {
|
|
59155
|
-
raw2 = JSON.parse(
|
|
59650
|
+
raw2 = JSON.parse(readFileSync20(path2, "utf-8"));
|
|
59156
59651
|
} catch {
|
|
59157
59652
|
return null;
|
|
59158
59653
|
}
|
|
@@ -59306,67 +59801,6 @@ function invalidateProbeProxyHandlers(providerSlug) {
|
|
|
59306
59801
|
}
|
|
59307
59802
|
var probeProxy = null, probeProxyStarting = null;
|
|
59308
59803
|
|
|
59309
|
-
// src/tui/providers.ts
|
|
59310
|
-
function toProviderDef(def) {
|
|
59311
|
-
return {
|
|
59312
|
-
name: def.name === "google" ? "gemini" : def.name,
|
|
59313
|
-
catalogName: def.name,
|
|
59314
|
-
displayName: def.displayName,
|
|
59315
|
-
apiKeyEnvVar: def.apiKeyEnvVar,
|
|
59316
|
-
description: def.description || def.apiKeyDescription,
|
|
59317
|
-
keyUrl: def.apiKeyUrl,
|
|
59318
|
-
endpointEnvVar: def.baseUrlEnvVars?.[0],
|
|
59319
|
-
endpointEnvVars: def.baseUrlEnvVars,
|
|
59320
|
-
defaultEndpoint: def.baseUrl || undefined,
|
|
59321
|
-
aliases: def.apiKeyAliases,
|
|
59322
|
-
isLocal: def.isLocal,
|
|
59323
|
-
oauthSlug: def.oauthLoginSlug
|
|
59324
|
-
};
|
|
59325
|
-
}
|
|
59326
|
-
function providerAuthSource(p, config3) {
|
|
59327
|
-
if (p.isLocal)
|
|
59328
|
-
return isLocalProviderEnabled(p.catalogName, config3) ? "local" : null;
|
|
59329
|
-
if (p.oauthSlug && hasOAuthCredentials(p.catalogName))
|
|
59330
|
-
return "oauth";
|
|
59331
|
-
const hasCfg = !!p.apiKeyEnvVar && !!config3.apiKeys?.[p.apiKeyEnvVar];
|
|
59332
|
-
const hasEnv = !!p.apiKeyEnvVar && !!process.env[p.apiKeyEnvVar];
|
|
59333
|
-
if (hasEnv && hasCfg)
|
|
59334
|
-
return "e+c";
|
|
59335
|
-
if (hasEnv)
|
|
59336
|
-
return "env";
|
|
59337
|
-
if (hasCfg)
|
|
59338
|
-
return "cfg";
|
|
59339
|
-
return null;
|
|
59340
|
-
}
|
|
59341
|
-
function providerIsReady(p, config3) {
|
|
59342
|
-
return providerAuthSource(p, config3) !== null;
|
|
59343
|
-
}
|
|
59344
|
-
function providerAuthCapabilities(p, config3) {
|
|
59345
|
-
const apiKeySupported = !!p.apiKeyEnvVar;
|
|
59346
|
-
const apiKeySet = apiKeySupported && (!!process.env[p.apiKeyEnvVar] || !!config3.apiKeys?.[p.apiKeyEnvVar]);
|
|
59347
|
-
const oauthSupported = !!p.oauthSlug;
|
|
59348
|
-
const oauthSet = oauthSupported && hasOAuthCredentials(p.catalogName);
|
|
59349
|
-
return {
|
|
59350
|
-
apiKey: { supported: apiKeySupported, set: apiKeySet },
|
|
59351
|
-
oauth: { supported: oauthSupported, set: oauthSet }
|
|
59352
|
-
};
|
|
59353
|
-
}
|
|
59354
|
-
function maskKey2(key) {
|
|
59355
|
-
if (!key)
|
|
59356
|
-
return "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
59357
|
-
if (key.length < 8)
|
|
59358
|
-
return "**** ";
|
|
59359
|
-
return `${key.slice(0, 3)}\u2022\u2022${key.slice(-3)}`;
|
|
59360
|
-
}
|
|
59361
|
-
var SKIP, PROVIDERS;
|
|
59362
|
-
var init_providers = __esm(() => {
|
|
59363
|
-
init_oauth_registry();
|
|
59364
|
-
init_profile_config();
|
|
59365
|
-
init_provider_definitions();
|
|
59366
|
-
SKIP = new Set(["qwen", "native-anthropic"]);
|
|
59367
|
-
PROVIDERS = getAllProviders().filter((d) => !SKIP.has(d.name)).map(toProviderDef);
|
|
59368
|
-
});
|
|
59369
|
-
|
|
59370
59804
|
// src/tui/constants.ts
|
|
59371
59805
|
var COMMON_MODELS, PROVIDER_PREFIXES, CHAIN_PROVIDERS, HEADER_H = 2, TABS_H = 3, FOOTER_H = 1, DETAIL_H = 7;
|
|
59372
59806
|
var init_constants3 = __esm(() => {
|
|
@@ -63547,7 +63981,7 @@ __export(exports_claude_runner, {
|
|
|
63547
63981
|
checkClaudeInstalled: () => checkClaudeInstalled
|
|
63548
63982
|
});
|
|
63549
63983
|
import { spawn as spawn4 } from "child_process";
|
|
63550
|
-
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";
|
|
63551
63985
|
import { tmpdir as tmpdir2, homedir as homedir23 } from "os";
|
|
63552
63986
|
import { join as join24 } from "path";
|
|
63553
63987
|
function hasNativeAnthropicMapping(config3) {
|
|
@@ -63706,7 +64140,7 @@ function mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine) {
|
|
|
63706
64140
|
if (userSettingsValue.trimStart().startsWith("{")) {
|
|
63707
64141
|
userSettings = JSON.parse(userSettingsValue);
|
|
63708
64142
|
} else {
|
|
63709
|
-
const rawUserSettings =
|
|
64143
|
+
const rawUserSettings = readFileSync21(userSettingsValue, "utf-8");
|
|
63710
64144
|
userSettings = JSON.parse(rawUserSettings);
|
|
63711
64145
|
}
|
|
63712
64146
|
userSettings.statusLine = statusLine;
|
|
@@ -63847,13 +64281,13 @@ function setupSignalHandlers(proc, tempSettingsPath, quiet, onCleanup) {
|
|
|
63847
64281
|
async function findClaudeBinary() {
|
|
63848
64282
|
const isWindows3 = process.platform === "win32";
|
|
63849
64283
|
if (process.env.CLAUDE_PATH) {
|
|
63850
|
-
if (
|
|
64284
|
+
if (existsSync23(process.env.CLAUDE_PATH)) {
|
|
63851
64285
|
return process.env.CLAUDE_PATH;
|
|
63852
64286
|
}
|
|
63853
64287
|
}
|
|
63854
64288
|
const home = homedir23();
|
|
63855
64289
|
const localPath = isWindows3 ? join24(home, ".claude", "local", "claude.exe") : join24(home, ".claude", "local", "claude");
|
|
63856
|
-
if (
|
|
64290
|
+
if (existsSync23(localPath)) {
|
|
63857
64291
|
return localPath;
|
|
63858
64292
|
}
|
|
63859
64293
|
if (isWindows3) {
|
|
@@ -63863,7 +64297,7 @@ async function findClaudeBinary() {
|
|
|
63863
64297
|
join24(home, "node_modules", ".bin", "claude.cmd")
|
|
63864
64298
|
];
|
|
63865
64299
|
for (const path2 of windowsPaths) {
|
|
63866
|
-
if (
|
|
64300
|
+
if (existsSync23(path2)) {
|
|
63867
64301
|
return path2;
|
|
63868
64302
|
}
|
|
63869
64303
|
}
|
|
@@ -63878,7 +64312,7 @@ async function findClaudeBinary() {
|
|
|
63878
64312
|
join24(home, "../usr/bin/claude")
|
|
63879
64313
|
];
|
|
63880
64314
|
for (const path2 of commonPaths) {
|
|
63881
|
-
if (
|
|
64315
|
+
if (existsSync23(path2)) {
|
|
63882
64316
|
return path2;
|
|
63883
64317
|
}
|
|
63884
64318
|
}
|
|
@@ -64150,8 +64584,8 @@ __export(exports_team_grid, {
|
|
|
64150
64584
|
});
|
|
64151
64585
|
import { spawn as spawn5 } from "child_process";
|
|
64152
64586
|
import {
|
|
64153
|
-
existsSync as
|
|
64154
|
-
readFileSync as
|
|
64587
|
+
existsSync as existsSync24,
|
|
64588
|
+
readFileSync as readFileSync22,
|
|
64155
64589
|
writeFileSync as writeFileSync16
|
|
64156
64590
|
} from "fs";
|
|
64157
64591
|
import { dirname as dirname6, join as join26 } from "path";
|
|
@@ -64254,14 +64688,14 @@ function findMagmuxBinary() {
|
|
|
64254
64688
|
const platform3 = process.platform;
|
|
64255
64689
|
const arch = process.arch;
|
|
64256
64690
|
const bundledMagmux = join26(pkgRoot, "native", `magmux-${platform3}-${arch}`);
|
|
64257
|
-
if (
|
|
64691
|
+
if (existsSync24(bundledMagmux))
|
|
64258
64692
|
return bundledMagmux;
|
|
64259
64693
|
try {
|
|
64260
64694
|
const pkgName = `@claudish/magmux-${platform3}-${arch}`;
|
|
64261
64695
|
let searchDir = pkgRoot;
|
|
64262
64696
|
for (let i = 0;i < 5; i++) {
|
|
64263
64697
|
const candidate = join26(searchDir, "node_modules", pkgName, "bin", "magmux");
|
|
64264
|
-
if (
|
|
64698
|
+
if (existsSync24(candidate))
|
|
64265
64699
|
return candidate;
|
|
64266
64700
|
const parent = dirname6(searchDir);
|
|
64267
64701
|
if (parent === searchDir)
|
|
@@ -64280,7 +64714,7 @@ function findMagmuxBinary() {
|
|
|
64280
64714
|
async function subscribeToMagmux(sockPath, onEvent) {
|
|
64281
64715
|
let client = null;
|
|
64282
64716
|
for (let attempt = 0;attempt < 40; attempt++) {
|
|
64283
|
-
if (
|
|
64717
|
+
if (existsSync24(sockPath)) {
|
|
64284
64718
|
try {
|
|
64285
64719
|
client = await new Promise((resolve3, reject) => {
|
|
64286
64720
|
const s = netConnect(sockPath);
|
|
@@ -64368,8 +64802,8 @@ async function runWithGrid(sessionPath, models, input, opts) {
|
|
|
64368
64802
|
const manifest = setupSession(sessionPath, models, input);
|
|
64369
64803
|
const startedAt = new Date().toISOString();
|
|
64370
64804
|
const gridfilePath = join26(sessionPath, "gridfile.txt");
|
|
64371
|
-
const prompt =
|
|
64372
|
-
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");
|
|
64373
64807
|
const usedBannerColors = new Set;
|
|
64374
64808
|
const gridLines = Object.entries(manifest.models).map(([anonId]) => {
|
|
64375
64809
|
const model = manifest.models[anonId].model;
|
|
@@ -64422,16 +64856,16 @@ var init_team_grid = __esm(() => {
|
|
|
64422
64856
|
|
|
64423
64857
|
// src/index.ts
|
|
64424
64858
|
var import_dotenv3 = __toESM(require_main(), 1);
|
|
64425
|
-
import { existsSync as
|
|
64859
|
+
import { existsSync as existsSync25, readFileSync as readFileSync23 } from "fs";
|
|
64426
64860
|
import { homedir as homedir25 } from "os";
|
|
64427
64861
|
import { join as join27 } from "path";
|
|
64428
64862
|
import_dotenv3.config({ quiet: true });
|
|
64429
64863
|
function loadStoredApiKeys() {
|
|
64430
64864
|
try {
|
|
64431
64865
|
const configPath = join27(homedir25(), ".claudish", "config.json");
|
|
64432
|
-
if (!
|
|
64866
|
+
if (!existsSync25(configPath))
|
|
64433
64867
|
return;
|
|
64434
|
-
const raw2 =
|
|
64868
|
+
const raw2 = readFileSync23(configPath, "utf-8");
|
|
64435
64869
|
const cfg = JSON.parse(raw2);
|
|
64436
64870
|
if (cfg.apiKeys) {
|
|
64437
64871
|
for (const [envVar, value] of Object.entries(cfg.apiKeys)) {
|
|
@@ -64466,6 +64900,8 @@ var firstPositional = args.find((a) => !a.startsWith("-"));
|
|
|
64466
64900
|
var isTelemetryCommand = firstPositional === "telemetry";
|
|
64467
64901
|
var isStatsCommand = firstPositional === "stats";
|
|
64468
64902
|
var isConfigCommand = firstPositional === "config";
|
|
64903
|
+
var isServeCommand = firstPositional === "serve";
|
|
64904
|
+
var isProvidersCommand = firstPositional === "providers";
|
|
64469
64905
|
var isLoginCommand = firstPositional === "login";
|
|
64470
64906
|
var isLogoutCommand = firstPositional === "logout";
|
|
64471
64907
|
var isQuotaCommand = firstPositional === "quota" || firstPositional === "usage";
|
|
@@ -64475,6 +64911,18 @@ var isLegacyKimiLogin = args.includes("--kimi-login");
|
|
|
64475
64911
|
var isLegacyKimiLogout = args.includes("--kimi-logout");
|
|
64476
64912
|
if (isMcpMode) {
|
|
64477
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
|
+
}));
|
|
64478
64926
|
} else if (isLoginCommand) {
|
|
64479
64927
|
const loginProviderArg = args.find((a, i) => i > args.indexOf("login") && !a.startsWith("-"));
|
|
64480
64928
|
Promise.resolve().then(() => (init_auth_commands(), exports_auth_commands)).then((m) => m.loginCommand(loginProviderArg).catch(handlePromptExit));
|
|
@@ -64546,7 +64994,7 @@ async function runCli() {
|
|
|
64546
64994
|
if (cliConfig.team && cliConfig.team.length > 0) {
|
|
64547
64995
|
let prompt = cliConfig.claudeArgs.join(" ");
|
|
64548
64996
|
if (cliConfig.inputFile) {
|
|
64549
|
-
prompt =
|
|
64997
|
+
prompt = readFileSync23(cliConfig.inputFile, "utf-8");
|
|
64550
64998
|
}
|
|
64551
64999
|
if (!prompt.trim()) {
|
|
64552
65000
|
console.error("Error: --team requires a prompt (positional args or -f <file>)");
|
|
@@ -64565,7 +65013,7 @@ async function runCli() {
|
|
|
64565
65013
|
for (const anonId of Object.keys(status2.models)) {
|
|
64566
65014
|
const responsePath = join27(sessionPath, `response-${anonId}.md`);
|
|
64567
65015
|
try {
|
|
64568
|
-
const raw2 =
|
|
65016
|
+
const raw2 = readFileSync23(responsePath, "utf-8").trim();
|
|
64569
65017
|
try {
|
|
64570
65018
|
result.responses[anonId] = JSON.parse(raw2);
|
|
64571
65019
|
} catch {
|