claudish 7.29.0 → 7.29.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/dist/index.js +43 -36
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -651,7 +651,7 @@ var init_onepassword_config = __esm(() => {
|
|
|
651
651
|
});
|
|
652
652
|
|
|
653
653
|
// src/version.ts
|
|
654
|
-
var VERSION = "7.29.
|
|
654
|
+
var VERSION = "7.29.1";
|
|
655
655
|
|
|
656
656
|
// src/logger.ts
|
|
657
657
|
var exports_logger = {};
|
|
@@ -43033,38 +43033,32 @@ function extractModelIds(body) {
|
|
|
43033
43033
|
}
|
|
43034
43034
|
return [];
|
|
43035
43035
|
}
|
|
43036
|
+
function orderByCost(models) {
|
|
43037
|
+
const sized = models.filter((m) => typeof m.size === "number");
|
|
43038
|
+
const unsized = models.filter((m) => typeof m.size !== "number");
|
|
43039
|
+
const bySize = [...sized].sort((a, b) => (a.size ?? Number.POSITIVE_INFINITY) - (b.size ?? Number.POSITIVE_INFINITY)).map((m) => m.name);
|
|
43040
|
+
return [...bySize, ...rankProbeCandidates(unsized.map((m) => m.name))];
|
|
43041
|
+
}
|
|
43036
43042
|
async function discoverViaOllama(baseUrl, cacheKey) {
|
|
43037
43043
|
const cached2 = cacheGet(cacheKey.key, cacheKey.exclude);
|
|
43038
43044
|
if (cached2 !== undefined)
|
|
43039
43045
|
return cached2;
|
|
43040
|
-
|
|
43041
|
-
|
|
43042
|
-
|
|
43043
|
-
|
|
43044
|
-
|
|
43045
|
-
|
|
43046
|
-
}
|
|
43047
|
-
|
|
43048
|
-
|
|
43049
|
-
|
|
43050
|
-
|
|
43051
|
-
}
|
|
43052
|
-
connectionError ??= classifyFetchError(e, `${baseUrl}/api/tags`);
|
|
43053
|
-
}
|
|
43054
|
-
}
|
|
43055
|
-
const candidates = allRaw.filter((m) => isChatCapable(m.name));
|
|
43056
|
-
if (candidates.length === 0) {
|
|
43057
|
-
const reason = connectionError ?? (allRaw.length === 0 ? `no models on ${baseUrl} (pull one: ollama pull llama3.2)` : `only embedding/non-chat models on ${baseUrl}`);
|
|
43046
|
+
const [psResult, tagsResult] = await Promise.allSettled([
|
|
43047
|
+
fetchOllamaModels2(`${baseUrl}/api/ps`),
|
|
43048
|
+
fetchOllamaModels2(`${baseUrl}/api/tags`)
|
|
43049
|
+
]);
|
|
43050
|
+
const loadedRaw = psResult.status === "fulfilled" ? psResult.value : [];
|
|
43051
|
+
const tagsRaw = tagsResult.status === "fulfilled" ? tagsResult.value : [];
|
|
43052
|
+
const connectionError = psResult.status === "rejected" ? classifyFetchError(psResult.reason, `${baseUrl}/api/ps`) : tagsResult.status === "rejected" ? classifyFetchError(tagsResult.reason, `${baseUrl}/api/tags`) : undefined;
|
|
43053
|
+
const loaded = loadedRaw.filter((m) => isChatCapable(m.name));
|
|
43054
|
+
const loadedNames = new Set(loaded.map((m) => m.name));
|
|
43055
|
+
const rest = tagsRaw.filter((m) => isChatCapable(m.name) && !loadedNames.has(m.name));
|
|
43056
|
+
if (loaded.length === 0 && rest.length === 0) {
|
|
43057
|
+
const reason = connectionError ?? (loadedRaw.length === 0 && tagsRaw.length === 0 ? `no models on ${baseUrl} (pull one: ollama pull llama3.2)` : `only embedding/non-chat models on ${baseUrl}`);
|
|
43058
43058
|
cacheSetFailure(cacheKey.key, reason);
|
|
43059
43059
|
return { model: null, reason };
|
|
43060
43060
|
}
|
|
43061
|
-
const
|
|
43062
|
-
let ranked;
|
|
43063
|
-
if (sized.length > 0) {
|
|
43064
|
-
ranked = [...sized].sort((a, b) => (a.size ?? Number.POSITIVE_INFINITY) - (b.size ?? Number.POSITIVE_INFINITY)).map((m) => m.name);
|
|
43065
|
-
} else {
|
|
43066
|
-
ranked = rankProbeCandidates(candidates.map((m) => m.name));
|
|
43067
|
-
}
|
|
43061
|
+
const ranked = [...orderByCost(loaded), ...orderByCost(rest)];
|
|
43068
43062
|
if (ranked.length === 0) {
|
|
43069
43063
|
const reason = "no chat-capable model on Ollama endpoint";
|
|
43070
43064
|
cacheSetFailure(cacheKey.key, reason);
|
|
@@ -61892,6 +61886,8 @@ function annotateOAuthHint(result, provider, isOAuth) {
|
|
|
61892
61886
|
const loginCommand2 = provider === "gemini-codeassist" ? "claudish login gemini" : provider === "vertex" ? "gcloud auth application-default login" : undefined;
|
|
61893
61887
|
if (!loginCommand2)
|
|
61894
61888
|
return result;
|
|
61889
|
+
if (result.httpStatus === 403)
|
|
61890
|
+
return result;
|
|
61895
61891
|
const looksLikeAuthFailure = result.state === "auth-failed" || /auth|token|login|credential|unauthor/i.test(result.errorMessage || "");
|
|
61896
61892
|
if (!looksLikeAuthFailure)
|
|
61897
61893
|
return result;
|
|
@@ -62174,29 +62170,34 @@ function isContentEvent(parsed, eventType) {
|
|
|
62174
62170
|
return true;
|
|
62175
62171
|
return false;
|
|
62176
62172
|
}
|
|
62173
|
+
function withDetail(base, message) {
|
|
62174
|
+
return message ? `${base} \u2014 ${message}` : base;
|
|
62175
|
+
}
|
|
62177
62176
|
function describeProbeState(result) {
|
|
62177
|
+
const status = result.httpStatus ?? "";
|
|
62178
|
+
const latency = result.latencyMs ? ` \xB7 ${result.latencyMs}ms` : "";
|
|
62178
62179
|
switch (result.state) {
|
|
62179
62180
|
case "live":
|
|
62180
62181
|
return `live \xB7 ${result.latencyMs}ms`;
|
|
62181
62182
|
case "key-missing":
|
|
62182
62183
|
return result.errorMessage ? `missing (${result.errorMessage})` : "missing";
|
|
62183
62184
|
case "auth-failed":
|
|
62184
|
-
return `auth failed \xB7 ${
|
|
62185
|
+
return withDetail(`auth failed \xB7 ${status}${latency}`.trim(), result.errorMessage);
|
|
62185
62186
|
case "model-not-found":
|
|
62186
|
-
return `model not found \xB7 ${
|
|
62187
|
+
return withDetail(`model not found \xB7 ${status}${latency}`.trim(), result.errorMessage);
|
|
62187
62188
|
case "rate-limited":
|
|
62188
|
-
return `rate limited \xB7 ${result.latencyMs}ms
|
|
62189
|
+
return withDetail(`rate limited \xB7 ${result.latencyMs}ms`, result.errorMessage);
|
|
62189
62190
|
case "out-of-credit":
|
|
62190
|
-
return `out of credit \xB7 ${
|
|
62191
|
+
return withDetail(`out of credit \xB7 ${status}${latency}`.trim(), result.errorMessage);
|
|
62191
62192
|
case "server-error":
|
|
62192
|
-
return `server error \xB7 ${
|
|
62193
|
+
return withDetail(`server error \xB7 ${status} \xB7 ${result.latencyMs}ms`, result.errorMessage);
|
|
62193
62194
|
case "timeout":
|
|
62194
|
-
return `timeout \xB7 ${result.latencyMs}ms
|
|
62195
|
+
return withDetail(`timeout \xB7 ${result.latencyMs}ms`, result.errorMessage);
|
|
62195
62196
|
case "network-error":
|
|
62196
|
-
return `network error \xB7 ${result.latencyMs}ms
|
|
62197
|
+
return withDetail(`network error \xB7 ${result.latencyMs}ms`, result.errorMessage);
|
|
62197
62198
|
case "error": {
|
|
62198
|
-
const base = `error${result.httpStatus ? ` \xB7 ${result.httpStatus}` : ""}${
|
|
62199
|
-
return
|
|
62199
|
+
const base = `error${result.httpStatus ? ` \xB7 ${result.httpStatus}` : ""}${latency}`;
|
|
62200
|
+
return withDetail(base, result.errorMessage);
|
|
62200
62201
|
}
|
|
62201
62202
|
}
|
|
62202
62203
|
}
|
|
@@ -67013,16 +67014,22 @@ function localBaseUrl(catalogName) {
|
|
|
67013
67014
|
}
|
|
67014
67015
|
return (def.baseUrl || "").replace(/\/+$/, "") || null;
|
|
67015
67016
|
}
|
|
67017
|
+
function isHtmlResponse(res) {
|
|
67018
|
+
const contentType = res.headers.get("content-type") ?? "";
|
|
67019
|
+
return /\btext\/html\b|\bapplication\/xhtml\+xml\b/i.test(contentType);
|
|
67020
|
+
}
|
|
67016
67021
|
async function pingLocalProvider(catalogName, timeoutMs = PING_TIMEOUT_MS) {
|
|
67017
67022
|
const base = localBaseUrl(catalogName);
|
|
67018
67023
|
const path2 = HEALTH_PATH[catalogName];
|
|
67019
67024
|
if (!base || !path2)
|
|
67020
67025
|
return "unknown";
|
|
67021
67026
|
try {
|
|
67022
|
-
await fetch(`${base}${path2}`, {
|
|
67027
|
+
const res = await fetch(`${base}${path2}`, {
|
|
67023
67028
|
method: "GET",
|
|
67024
67029
|
signal: AbortSignal.timeout(timeoutMs)
|
|
67025
67030
|
});
|
|
67031
|
+
if (res.ok && isHtmlResponse(res))
|
|
67032
|
+
return "down";
|
|
67026
67033
|
return "running";
|
|
67027
67034
|
} catch {
|
|
67028
67035
|
return "down";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudish",
|
|
3
|
-
"version": "7.29.
|
|
3
|
+
"version": "7.29.1",
|
|
4
4
|
"description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"ai"
|
|
61
61
|
],
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@claudish/magmux-darwin-arm64": "7.29.
|
|
64
|
-
"@claudish/magmux-darwin-x64": "7.29.
|
|
65
|
-
"@claudish/magmux-linux-arm64": "7.29.
|
|
66
|
-
"@claudish/magmux-linux-x64": "7.29.
|
|
63
|
+
"@claudish/magmux-darwin-arm64": "7.29.1",
|
|
64
|
+
"@claudish/magmux-darwin-x64": "7.29.1",
|
|
65
|
+
"@claudish/magmux-linux-arm64": "7.29.1",
|
|
66
|
+
"@claudish/magmux-linux-x64": "7.29.1"
|
|
67
67
|
},
|
|
68
68
|
"author": "Jack Rudenko <i@madappgang.com>",
|
|
69
69
|
"license": "MIT",
|