claudish 5.2.0 → 5.3.1
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/AI_AGENT_GUIDE.md +20 -0
- package/dist/index.js +144 -42
- package/package.json +1 -1
- package/recommended-models.json +2 -2
package/AI_AGENT_GUIDE.md
CHANGED
|
@@ -256,6 +256,26 @@ for (const model of models) {
|
|
|
256
256
|
| `--debug` / `-d` | Debug logging to file | Disabled |
|
|
257
257
|
| `--no-auto-approve` | Require prompts | Auto-approve enabled |
|
|
258
258
|
|
|
259
|
+
### Claude Code Flag Passthrough
|
|
260
|
+
|
|
261
|
+
Any Claude Code flag that claudish doesn't recognize is automatically forwarded. This means you can use:
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Agent selection
|
|
265
|
+
claudish --model grok --agent code-review --stdin --quiet < prompt.md
|
|
266
|
+
|
|
267
|
+
# Effort and budget control
|
|
268
|
+
claudish --model grok --effort high --max-budget-usd 0.50 --stdin --quiet < prompt.md
|
|
269
|
+
|
|
270
|
+
# Permission mode
|
|
271
|
+
claudish --model grok --permission-mode plan --stdin --quiet < prompt.md
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Use `--` separator when flag values start with `-`:
|
|
275
|
+
```bash
|
|
276
|
+
claudish --model grok -- --system-prompt "-v mode" --stdin --quiet < prompt.md
|
|
277
|
+
```
|
|
278
|
+
|
|
259
279
|
## Common Workflows
|
|
260
280
|
|
|
261
281
|
### Workflow 1: Quick Code Fix (Grok)
|
package/dist/index.js
CHANGED
|
@@ -6,39 +6,60 @@ var __defProp = Object.defineProperty;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
function __accessProp(key) {
|
|
10
|
+
return this[key];
|
|
11
|
+
}
|
|
12
|
+
var __toESMCache_node;
|
|
13
|
+
var __toESMCache_esm;
|
|
9
14
|
var __toESM = (mod, isNodeMode, target) => {
|
|
15
|
+
var canCache = mod != null && typeof mod === "object";
|
|
16
|
+
if (canCache) {
|
|
17
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
18
|
+
var cached = cache.get(mod);
|
|
19
|
+
if (cached)
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
10
22
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
11
23
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
12
24
|
for (let key of __getOwnPropNames(mod))
|
|
13
25
|
if (!__hasOwnProp.call(to, key))
|
|
14
26
|
__defProp(to, key, {
|
|
15
|
-
get: (
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
16
28
|
enumerable: true
|
|
17
29
|
});
|
|
30
|
+
if (canCache)
|
|
31
|
+
cache.set(mod, to);
|
|
18
32
|
return to;
|
|
19
33
|
};
|
|
20
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
21
34
|
var __toCommonJS = (from) => {
|
|
22
|
-
var entry = __moduleCache.get(from), desc;
|
|
35
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
23
36
|
if (entry)
|
|
24
37
|
return entry;
|
|
25
38
|
entry = __defProp({}, "__esModule", { value: true });
|
|
26
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
40
|
+
for (var key of __getOwnPropNames(from))
|
|
41
|
+
if (!__hasOwnProp.call(entry, key))
|
|
42
|
+
__defProp(entry, key, {
|
|
43
|
+
get: __accessProp.bind(from, key),
|
|
44
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
45
|
+
});
|
|
46
|
+
}
|
|
31
47
|
__moduleCache.set(from, entry);
|
|
32
48
|
return entry;
|
|
33
49
|
};
|
|
50
|
+
var __moduleCache;
|
|
34
51
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
52
|
+
var __returnValue = (v) => v;
|
|
53
|
+
function __exportSetter(name, newValue) {
|
|
54
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
55
|
+
}
|
|
35
56
|
var __export = (target, all) => {
|
|
36
57
|
for (var name in all)
|
|
37
58
|
__defProp(target, name, {
|
|
38
59
|
get: all[name],
|
|
39
60
|
enumerable: true,
|
|
40
61
|
configurable: true,
|
|
41
|
-
set: (
|
|
62
|
+
set: __exportSetter.bind(all, name)
|
|
42
63
|
});
|
|
43
64
|
};
|
|
44
65
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
@@ -27463,6 +27484,7 @@ __export(exports_logger, {
|
|
|
27463
27484
|
setLogLevel: () => setLogLevel,
|
|
27464
27485
|
maskCredential: () => maskCredential,
|
|
27465
27486
|
logStructured: () => logStructured,
|
|
27487
|
+
logStderr: () => logStderr,
|
|
27466
27488
|
log: () => log,
|
|
27467
27489
|
isLoggingEnabled: () => isLoggingEnabled,
|
|
27468
27490
|
initLogger: () => initLogger,
|
|
@@ -27536,6 +27558,11 @@ function log(message, forceConsole = false) {
|
|
|
27536
27558
|
console.log(message);
|
|
27537
27559
|
}
|
|
27538
27560
|
}
|
|
27561
|
+
function logStderr(message) {
|
|
27562
|
+
process.stderr.write(`[claudish] ${message}
|
|
27563
|
+
`);
|
|
27564
|
+
log(message);
|
|
27565
|
+
}
|
|
27539
27566
|
function getLogFilePath() {
|
|
27540
27567
|
return logFilePath;
|
|
27541
27568
|
}
|
|
@@ -34209,9 +34236,16 @@ async function parseArgs(args) {
|
|
|
34209
34236
|
process.exit(0);
|
|
34210
34237
|
} else if (arg === "--summarize-tools") {
|
|
34211
34238
|
config3.summarizeTools = true;
|
|
34212
|
-
} else {
|
|
34213
|
-
config3.claudeArgs
|
|
34239
|
+
} else if (arg === "--") {
|
|
34240
|
+
config3.claudeArgs.push(...args.slice(i + 1));
|
|
34214
34241
|
break;
|
|
34242
|
+
} else if (arg.startsWith("-")) {
|
|
34243
|
+
config3.claudeArgs.push(arg);
|
|
34244
|
+
if (i + 1 < args.length && !args[i + 1].startsWith("-")) {
|
|
34245
|
+
config3.claudeArgs.push(args[++i]);
|
|
34246
|
+
}
|
|
34247
|
+
} else {
|
|
34248
|
+
config3.claudeArgs.push(arg);
|
|
34215
34249
|
}
|
|
34216
34250
|
i++;
|
|
34217
34251
|
}
|
|
@@ -34895,6 +34929,19 @@ OPTIONS:
|
|
|
34895
34929
|
-h, --help Show this help message
|
|
34896
34930
|
--help-ai Show AI agent usage guide (file-based patterns, sub-agents)
|
|
34897
34931
|
--init Install Claudish skill in current project (.claude/skills/)
|
|
34932
|
+
-- Separator: everything after passes directly to Claude Code
|
|
34933
|
+
|
|
34934
|
+
CLAUDE CODE FLAG PASSTHROUGH:
|
|
34935
|
+
Any unrecognized flag is automatically forwarded to Claude Code.
|
|
34936
|
+
Claudish flags (--model, --stdin, --quiet, etc.) can appear in any order.
|
|
34937
|
+
|
|
34938
|
+
Examples:
|
|
34939
|
+
claudish --model grok --agent test "task" # --agent passes to Claude Code
|
|
34940
|
+
claudish --model grok --effort high --stdin "task" # --effort passes, --stdin stays
|
|
34941
|
+
claudish --model grok --permission-mode plan -i # Works in interactive mode too
|
|
34942
|
+
|
|
34943
|
+
Use -- when a Claude Code flag value starts with '-':
|
|
34944
|
+
claudish --model grok -- --system-prompt "-verbose mode" "task"
|
|
34898
34945
|
|
|
34899
34946
|
PROFILE MANAGEMENT:
|
|
34900
34947
|
claudish init [--local|--global] Setup wizard - create config and first profile
|
|
@@ -35346,7 +35393,7 @@ async function fetchGLMCodingModels2() {
|
|
|
35346
35393
|
return [];
|
|
35347
35394
|
}
|
|
35348
35395
|
}
|
|
35349
|
-
var __filename5, __dirname5, VERSION = "5.
|
|
35396
|
+
var __filename5, __dirname5, VERSION = "5.3.1", CACHE_MAX_AGE_DAYS3 = 2, MODELS_JSON_PATH, CLAUDISH_CACHE_DIR3, ALL_MODELS_JSON_PATH2;
|
|
35350
35397
|
var init_cli = __esm(() => {
|
|
35351
35398
|
init_config();
|
|
35352
35399
|
init_model_loader();
|
|
@@ -35370,7 +35417,7 @@ __export(exports_claude_runner, {
|
|
|
35370
35417
|
checkClaudeInstalled: () => checkClaudeInstalled
|
|
35371
35418
|
});
|
|
35372
35419
|
import { spawn } from "node:child_process";
|
|
35373
|
-
import { writeFileSync as writeFileSync7, unlinkSync as unlinkSync4, mkdirSync as mkdirSync7, existsSync as existsSync12 } from "node:fs";
|
|
35420
|
+
import { writeFileSync as writeFileSync7, unlinkSync as unlinkSync4, mkdirSync as mkdirSync7, existsSync as existsSync12, readFileSync as readFileSync10 } from "node:fs";
|
|
35374
35421
|
import { tmpdir, homedir as homedir11 } from "node:os";
|
|
35375
35422
|
import { join as join12 } from "node:path";
|
|
35376
35423
|
function isWindows() {
|
|
@@ -35487,22 +35534,45 @@ function createTempSettingsFile(modelDisplay, port) {
|
|
|
35487
35534
|
const formatTokensBash = `fmt_tok() { local n=\${1:-0}; if [ "$n" -ge 1000000 ]; then echo "$((n/1000000))M"; elif [ "$n" -ge 1000 ]; then echo "$((n/1000))k"; else echo "$n"; fi; }`;
|
|
35488
35535
|
statusCommand = `JSON=$(cat) && DIR=$(basename "$(pwd)") && [ \${#DIR} -gt 15 ] && DIR="\${DIR:0:12}..." || true && CTX=100 && COST="0" && IS_FREE="false" && IS_EST="false" && PROVIDER="" && TOKEN_MODEL="" && IN_TOK=0 && CTX_WIN=0 && ${formatTokensBash} && if [ -f "${tokenFilePath}" ]; then TOKENS=$(cat "${tokenFilePath}" 2>/dev/null | tr -d ' \\n') && REAL_CTX=$(echo "$TOKENS" | grep -o '"context_left_percent":[0-9]*' | grep -o '[0-9]*') && if [ ! -z "$REAL_CTX" ]; then CTX="$REAL_CTX"; fi && REAL_COST=$(echo "$TOKENS" | grep -o '"total_cost":[0-9.]*' | cut -d: -f2) && if [ ! -z "$REAL_COST" ]; then COST="$REAL_COST"; fi && IN_TOK=$(echo "$TOKENS" | grep -o '"input_tokens":[0-9]*' | grep -o '[0-9]*') && CTX_WIN=$(echo "$TOKENS" | grep -o '"context_window":[0-9]*' | grep -o '[0-9]*') && IS_FREE=$(echo "$TOKENS" | grep -o '"is_free":[a-z]*' | cut -d: -f2) && IS_EST=$(echo "$TOKENS" | grep -o '"is_estimated":[a-z]*' | cut -d: -f2) && PROVIDER=$(echo "$TOKENS" | grep -o '"provider_name":"[^"]*"' | cut -d'"' -f4) && TOKEN_MODEL=$(echo "$TOKENS" | grep -o '"model_name":"[^"]*"' | cut -d'"' -f4); fi && if [ "$CLAUDISH_IS_LOCAL" = "true" ]; then COST_DISPLAY="LOCAL"; elif [ "$IS_FREE" = "true" ]; then COST_DISPLAY="FREE"; elif [ "$IS_EST" = "true" ]; then COST_DISPLAY=$(printf "~\\$%.3f" "$COST"); else COST_DISPLAY=$(printf "\\$%.3f" "$COST"); fi && MODEL_DISPLAY="\${TOKEN_MODEL:-$CLAUDISH_ACTIVE_MODEL_NAME}" && if [ ! -z "$PROVIDER" ]; then MODEL_DISPLAY="$PROVIDER $MODEL_DISPLAY"; fi && if [ "$IN_TOK" -gt 0 ] 2>/dev/null && [ "$CTX_WIN" -gt 0 ] 2>/dev/null; then CTX_DISPLAY="$CTX% ($(fmt_tok $IN_TOK)/$(fmt_tok $CTX_WIN))"; else CTX_DISPLAY="$CTX%"; fi && printf "${CYAN2}${BOLD2}%s${RESET2} ${DIM2}•${RESET2} ${YELLOW2}%s${RESET2} ${DIM2}•${RESET2} ${GREEN2}%s${RESET2} ${DIM2}•${RESET2} ${MAGENTA2}%s${RESET2}\\n" "$DIR" "$MODEL_DISPLAY" "$COST_DISPLAY" "$CTX_DISPLAY"`;
|
|
35489
35536
|
}
|
|
35490
|
-
const
|
|
35491
|
-
|
|
35492
|
-
|
|
35493
|
-
|
|
35494
|
-
padding: 0
|
|
35495
|
-
}
|
|
35537
|
+
const statusLine = {
|
|
35538
|
+
type: "command",
|
|
35539
|
+
command: statusCommand,
|
|
35540
|
+
padding: 0
|
|
35496
35541
|
};
|
|
35542
|
+
const settings = { statusLine };
|
|
35497
35543
|
writeFileSync7(tempPath, JSON.stringify(settings, null, 2), "utf-8");
|
|
35498
|
-
return tempPath;
|
|
35544
|
+
return { path: tempPath, statusLine };
|
|
35545
|
+
}
|
|
35546
|
+
function mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine) {
|
|
35547
|
+
const idx = config3.claudeArgs.indexOf("--settings");
|
|
35548
|
+
if (idx === -1 || !config3.claudeArgs[idx + 1]) {
|
|
35549
|
+
return;
|
|
35550
|
+
}
|
|
35551
|
+
const userSettingsValue = config3.claudeArgs[idx + 1];
|
|
35552
|
+
try {
|
|
35553
|
+
let userSettings;
|
|
35554
|
+
if (userSettingsValue.trimStart().startsWith("{")) {
|
|
35555
|
+
userSettings = JSON.parse(userSettingsValue);
|
|
35556
|
+
} else {
|
|
35557
|
+
const rawUserSettings = readFileSync10(userSettingsValue, "utf-8");
|
|
35558
|
+
userSettings = JSON.parse(rawUserSettings);
|
|
35559
|
+
}
|
|
35560
|
+
userSettings.statusLine = statusLine;
|
|
35561
|
+
writeFileSync7(tempSettingsPath, JSON.stringify(userSettings, null, 2), "utf-8");
|
|
35562
|
+
} catch {
|
|
35563
|
+
if (!config3.quiet) {
|
|
35564
|
+
console.warn(`[claudish] Warning: could not merge user settings: ${userSettingsValue}`);
|
|
35565
|
+
}
|
|
35566
|
+
}
|
|
35567
|
+
config3.claudeArgs.splice(idx, 2);
|
|
35499
35568
|
}
|
|
35500
35569
|
async function runClaudeWithProxy(config3, proxyUrl) {
|
|
35501
35570
|
const hasProfileMappings = config3.modelOpus || config3.modelSonnet || config3.modelHaiku || config3.modelSubagent;
|
|
35502
35571
|
const modelId = config3.model || (hasProfileMappings ? undefined : "unknown");
|
|
35503
35572
|
const portMatch = proxyUrl.match(/:(\d+)/);
|
|
35504
35573
|
const port = portMatch ? portMatch[1] : "unknown";
|
|
35505
|
-
const tempSettingsPath = createTempSettingsFile(modelId, port);
|
|
35574
|
+
const { path: tempSettingsPath, statusLine } = createTempSettingsFile(modelId, port);
|
|
35575
|
+
mergeUserSettingsIfPresent(config3, tempSettingsPath, statusLine);
|
|
35506
35576
|
const claudeArgs = [];
|
|
35507
35577
|
claudeArgs.push("--settings", tempSettingsPath);
|
|
35508
35578
|
if (config3.interactive) {
|
|
@@ -35512,6 +35582,7 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
35512
35582
|
if (config3.dangerous) {
|
|
35513
35583
|
claudeArgs.push("--dangerouslyDisableSandbox");
|
|
35514
35584
|
}
|
|
35585
|
+
claudeArgs.push(...config3.claudeArgs);
|
|
35515
35586
|
} else {
|
|
35516
35587
|
claudeArgs.push("-p");
|
|
35517
35588
|
if (config3.autoApprove) {
|
|
@@ -35523,14 +35594,7 @@ async function runClaudeWithProxy(config3, proxyUrl) {
|
|
|
35523
35594
|
if (config3.jsonOutput) {
|
|
35524
35595
|
claudeArgs.push("--output-format", "json");
|
|
35525
35596
|
}
|
|
35526
|
-
|
|
35527
|
-
const modifiedArgs = [...config3.claudeArgs];
|
|
35528
|
-
const agentId = config3.agent.startsWith("@agent-") ? config3.agent : `@agent-${config3.agent}`;
|
|
35529
|
-
modifiedArgs[0] = `Use the ${agentId} agent to: ${modifiedArgs[0]}`;
|
|
35530
|
-
claudeArgs.push(...modifiedArgs);
|
|
35531
|
-
} else {
|
|
35532
|
-
claudeArgs.push(...config3.claudeArgs);
|
|
35533
|
-
}
|
|
35597
|
+
claudeArgs.push(...config3.claudeArgs);
|
|
35534
35598
|
}
|
|
35535
35599
|
const isLocalModel2 = modelId ? modelId.startsWith("ollama/") || modelId.startsWith("ollama:") || modelId.startsWith("lmstudio/") || modelId.startsWith("lmstudio:") || modelId.startsWith("vllm/") || modelId.startsWith("vllm:") || modelId.startsWith("mlx/") || modelId.startsWith("mlx:") || modelId.startsWith("http://") || modelId.startsWith("https://") : false;
|
|
35536
35600
|
const modelDisplayName = modelId || config3.profile || "default";
|
|
@@ -63162,6 +63226,7 @@ class ComposedHandler {
|
|
|
63162
63226
|
await this.provider.refreshAuth();
|
|
63163
63227
|
} catch (err) {
|
|
63164
63228
|
log(`[${this.provider.displayName}] Auth/health check failed: ${err.message}`);
|
|
63229
|
+
logStderr(`Error [${this.provider.displayName}]: Auth/health check failed — ${err.message}. Check credentials and server.`);
|
|
63165
63230
|
return c.json({ error: { type: "connection_error", message: err.message } }, 503);
|
|
63166
63231
|
}
|
|
63167
63232
|
if (this.provider.getContextWindow) {
|
|
@@ -63195,6 +63260,7 @@ class ComposedHandler {
|
|
|
63195
63260
|
if (error46.code === "ECONNREFUSED" || error46.cause?.code === "ECONNREFUSED") {
|
|
63196
63261
|
const msg = `Cannot connect to ${this.provider.displayName} at ${endpoint}. Make sure the server is running.`;
|
|
63197
63262
|
log(`[${this.provider.displayName}] ${msg}`);
|
|
63263
|
+
logStderr(`Error: ${msg} Check the server is running.`);
|
|
63198
63264
|
return c.json({ error: { type: "connection_error", message: msg } }, 503);
|
|
63199
63265
|
}
|
|
63200
63266
|
throw error46;
|
|
@@ -63219,15 +63285,19 @@ class ComposedHandler {
|
|
|
63219
63285
|
} else {
|
|
63220
63286
|
const errorText = await retryResp.text();
|
|
63221
63287
|
log(`[${this.provider.displayName}] Retry failed: ${errorText}`);
|
|
63288
|
+
logStderr(`Error [${this.provider.displayName}]: HTTP ${retryResp.status} after auth retry. Check API key.`);
|
|
63222
63289
|
return c.json({ error: errorText }, retryResp.status);
|
|
63223
63290
|
}
|
|
63224
63291
|
} catch (err) {
|
|
63225
63292
|
log(`[${this.provider.displayName}] Auth refresh failed: ${err.message}`);
|
|
63293
|
+
logStderr(`Error [${this.provider.displayName}]: Authentication failed — ${err.message}. Check API key.`);
|
|
63226
63294
|
return c.json({ error: { type: "authentication_error", message: err.message } }, 401);
|
|
63227
63295
|
}
|
|
63228
63296
|
} else {
|
|
63229
63297
|
const errorText = await response.text();
|
|
63230
63298
|
log(`[${this.provider.displayName}] Error: ${errorText}`);
|
|
63299
|
+
const hint = getRecoveryHint(response.status, errorText, this.provider.displayName);
|
|
63300
|
+
logStderr(`Error [${this.provider.displayName}]: HTTP ${response.status}. ${hint}`);
|
|
63231
63301
|
return c.json({ error: errorText }, response.status);
|
|
63232
63302
|
}
|
|
63233
63303
|
}
|
|
@@ -63302,6 +63372,34 @@ class ComposedHandler {
|
|
|
63302
63372
|
}
|
|
63303
63373
|
}
|
|
63304
63374
|
}
|
|
63375
|
+
function getRecoveryHint(status, errorText, providerName) {
|
|
63376
|
+
const lower = errorText.toLowerCase();
|
|
63377
|
+
if (status === 503 || lower.includes("overloaded")) {
|
|
63378
|
+
return "Provider overloaded. Retry or use a different model.";
|
|
63379
|
+
}
|
|
63380
|
+
if (status === 429 || lower.includes("rate limit")) {
|
|
63381
|
+
return "Rate limited. Wait, reduce concurrency, or check plan limits.";
|
|
63382
|
+
}
|
|
63383
|
+
if (status === 401 || status === 403) {
|
|
63384
|
+
return "Check API key / OAuth credentials.";
|
|
63385
|
+
}
|
|
63386
|
+
if (status === 404) {
|
|
63387
|
+
return "Verify model name is correct.";
|
|
63388
|
+
}
|
|
63389
|
+
if (status === 400) {
|
|
63390
|
+
if (lower.includes("unsupported content type") || lower.includes("unsupported_content_type")) {
|
|
63391
|
+
return "Model doesn't support this content format. Try a different model.";
|
|
63392
|
+
}
|
|
63393
|
+
if (lower.includes("context") || lower.includes("too long") || lower.includes("token")) {
|
|
63394
|
+
return "Input too large. Reduce message history or use a larger-context model.";
|
|
63395
|
+
}
|
|
63396
|
+
return "Request format may be incompatible with provider.";
|
|
63397
|
+
}
|
|
63398
|
+
if (status >= 500) {
|
|
63399
|
+
return "Server error — retry after a brief wait.";
|
|
63400
|
+
}
|
|
63401
|
+
return `Unexpected HTTP ${status} from ${providerName}.`;
|
|
63402
|
+
}
|
|
63305
63403
|
var init_composed_handler = __esm(() => {
|
|
63306
63404
|
init_adapter_manager();
|
|
63307
63405
|
init_middleware();
|
|
@@ -63368,7 +63466,7 @@ var init_litellm = __esm(() => {
|
|
|
63368
63466
|
});
|
|
63369
63467
|
|
|
63370
63468
|
// src/adapters/litellm-adapter.ts
|
|
63371
|
-
import { existsSync as existsSync14, readFileSync as
|
|
63469
|
+
import { existsSync as existsSync14, readFileSync as readFileSync12 } from "node:fs";
|
|
63372
63470
|
import { createHash as createHash4 } from "node:crypto";
|
|
63373
63471
|
import { homedir as homedir14 } from "node:os";
|
|
63374
63472
|
import { join as join15 } from "node:path";
|
|
@@ -63470,7 +63568,7 @@ var init_litellm_adapter = __esm(() => {
|
|
|
63470
63568
|
const cachePath = join15(homedir14(), ".claudish", `litellm-models-${hash2}.json`);
|
|
63471
63569
|
if (!existsSync14(cachePath))
|
|
63472
63570
|
return true;
|
|
63473
|
-
const cacheData = JSON.parse(
|
|
63571
|
+
const cacheData = JSON.parse(readFileSync12(cachePath, "utf-8"));
|
|
63474
63572
|
const model = cacheData.models?.find((m) => m.name === this.modelId);
|
|
63475
63573
|
if (model && model.supportsVision === false) {
|
|
63476
63574
|
log(`[LiteLLMAdapter] Model ${this.modelId} does not support vision`);
|
|
@@ -63588,12 +63686,12 @@ class AnthropicCompatProvider {
|
|
|
63588
63686
|
}
|
|
63589
63687
|
if (this.provider.name === "kimi-coding" && !this.apiKey) {
|
|
63590
63688
|
try {
|
|
63591
|
-
const { existsSync: existsSync15, readFileSync:
|
|
63689
|
+
const { existsSync: existsSync15, readFileSync: readFileSync13 } = await import("node:fs");
|
|
63592
63690
|
const { join: join16 } = await import("node:path");
|
|
63593
63691
|
const { homedir: homedir15 } = await import("node:os");
|
|
63594
63692
|
const credPath = join16(homedir15(), ".claudish", "kimi-oauth.json");
|
|
63595
63693
|
if (existsSync15(credPath)) {
|
|
63596
|
-
const data = JSON.parse(
|
|
63694
|
+
const data = JSON.parse(readFileSync13(credPath, "utf-8"));
|
|
63597
63695
|
if (data.access_token && data.refresh_token) {
|
|
63598
63696
|
const { KimiOAuth: KimiOAuth2 } = await Promise.resolve().then(() => (init_kimi_oauth(), exports_kimi_oauth));
|
|
63599
63697
|
const oauth = KimiOAuth2.getInstance();
|
|
@@ -63815,7 +63913,7 @@ var init_ollamacloud_adapter = __esm(() => {
|
|
|
63815
63913
|
});
|
|
63816
63914
|
|
|
63817
63915
|
// src/services/pricing-cache.ts
|
|
63818
|
-
import { readFileSync as
|
|
63916
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, existsSync as existsSync15, mkdirSync as mkdirSync9, statSync } from "node:fs";
|
|
63819
63917
|
import { homedir as homedir15 } from "node:os";
|
|
63820
63918
|
import { join as join16 } from "node:path";
|
|
63821
63919
|
function getDynamicPricingSync(provider, modelName) {
|
|
@@ -63887,7 +63985,7 @@ function loadDiskCache() {
|
|
|
63887
63985
|
const stat = statSync(CACHE_FILE);
|
|
63888
63986
|
const age = Date.now() - stat.mtimeMs;
|
|
63889
63987
|
const isFresh = age < CACHE_TTL_MS;
|
|
63890
|
-
const raw2 =
|
|
63988
|
+
const raw2 = readFileSync13(CACHE_FILE, "utf-8");
|
|
63891
63989
|
const data = JSON.parse(raw2);
|
|
63892
63990
|
for (const [key, pricing] of Object.entries(data)) {
|
|
63893
63991
|
pricingMap.set(key, pricing);
|
|
@@ -64031,7 +64129,10 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
64031
64129
|
}
|
|
64032
64130
|
const resolution = resolveModelProvider(targetModel);
|
|
64033
64131
|
if (resolution.wasAutoRouted && resolution.autoRouteMessage) {
|
|
64034
|
-
|
|
64132
|
+
if (!options.quiet) {
|
|
64133
|
+
console.error(`[Auto-route] ${resolution.autoRouteMessage}`);
|
|
64134
|
+
}
|
|
64135
|
+
log(`[Auto-route] ${resolution.autoRouteMessage}`);
|
|
64035
64136
|
}
|
|
64036
64137
|
if (resolution.category === "openrouter") {
|
|
64037
64138
|
if (resolution.wasAutoRouted && resolution.fullModelId) {
|
|
@@ -64114,9 +64215,9 @@ async function createProxyServer(port, openrouterApiKey, model, monitorMode = fa
|
|
|
64114
64215
|
log(`[Proxy] Created OllamaCloud handler (composed): ${resolved.modelName}`);
|
|
64115
64216
|
} else if (resolved.provider.name === "litellm") {
|
|
64116
64217
|
if (!resolved.provider.baseUrl) {
|
|
64117
|
-
|
|
64118
|
-
|
|
64119
|
-
|
|
64218
|
+
logStderr("Error: LITELLM_BASE_URL or --litellm-url is required for LiteLLM provider.");
|
|
64219
|
+
logStderr("Set it with: export LITELLM_BASE_URL='https://your-litellm-instance.com'");
|
|
64220
|
+
logStderr("Or use: claudish --litellm-url https://your-instance.com --model litellm@model 'task'");
|
|
64120
64221
|
return null;
|
|
64121
64222
|
}
|
|
64122
64223
|
const provider = new LiteLLMProvider(resolved.provider.baseUrl, apiKey, resolved.modelName);
|
|
@@ -64312,7 +64413,7 @@ __export(exports_update_checker, {
|
|
|
64312
64413
|
checkForUpdates: () => checkForUpdates
|
|
64313
64414
|
});
|
|
64314
64415
|
import { execSync } from "node:child_process";
|
|
64315
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync10, readFileSync as
|
|
64416
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync10, readFileSync as readFileSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "node:fs";
|
|
64316
64417
|
import { homedir as homedir16, platform as platform2, tmpdir as tmpdir2 } from "node:os";
|
|
64317
64418
|
import { join as join17 } from "node:path";
|
|
64318
64419
|
import { createInterface as createInterface2 } from "node:readline";
|
|
@@ -64346,7 +64447,7 @@ function readCache() {
|
|
|
64346
64447
|
if (!existsSync16(cachePath)) {
|
|
64347
64448
|
return null;
|
|
64348
64449
|
}
|
|
64349
|
-
const data = JSON.parse(
|
|
64450
|
+
const data = JSON.parse(readFileSync14(cachePath, "utf-8"));
|
|
64350
64451
|
return data;
|
|
64351
64452
|
} catch {
|
|
64352
64453
|
return null;
|
|
@@ -64787,7 +64888,8 @@ async function runCli() {
|
|
|
64787
64888
|
subagent: cliConfig.modelSubagent
|
|
64788
64889
|
};
|
|
64789
64890
|
const proxy = await createProxyServer2(port, cliConfig.monitor ? undefined : cliConfig.openrouterApiKey, cliConfig.monitor ? undefined : explicitModel, cliConfig.monitor, cliConfig.anthropicApiKey, modelMap, {
|
|
64790
|
-
summarizeTools: cliConfig.summarizeTools
|
|
64891
|
+
summarizeTools: cliConfig.summarizeTools,
|
|
64892
|
+
quiet: cliConfig.quiet
|
|
64791
64893
|
});
|
|
64792
64894
|
let exitCode = 0;
|
|
64793
64895
|
try {
|
package/package.json
CHANGED
package/recommended-models.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.2.0",
|
|
3
|
-
"lastUpdated": "2026-02
|
|
3
|
+
"lastUpdated": "2026-03-02",
|
|
4
4
|
"source": "https://openrouter.ai/models?categories=programming&fmt=cards&order=top-weekly",
|
|
5
5
|
"models": [
|
|
6
6
|
{
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"average": "$0.32/1M"
|
|
122
122
|
},
|
|
123
123
|
"context": "163K",
|
|
124
|
-
"maxOutputTokens":
|
|
124
|
+
"maxOutputTokens": 65536,
|
|
125
125
|
"modality": "text->text",
|
|
126
126
|
"supportsTools": true,
|
|
127
127
|
"supportsReasoning": true,
|