claudish 7.57.0 → 7.58.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 +59 -6
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -729,7 +729,7 @@ var init_onepassword_config = __esm(() => {
|
|
|
729
729
|
});
|
|
730
730
|
|
|
731
731
|
// src/version.ts
|
|
732
|
-
var VERSION = "7.
|
|
732
|
+
var VERSION = "7.58.0";
|
|
733
733
|
|
|
734
734
|
// src/logger.ts
|
|
735
735
|
var exports_logger = {};
|
|
@@ -41714,6 +41714,33 @@ var init_token_tracker = __esm(() => {
|
|
|
41714
41714
|
init_remote_provider_types();
|
|
41715
41715
|
});
|
|
41716
41716
|
|
|
41717
|
+
// src/handlers/shared/upstream-error-capture.ts
|
|
41718
|
+
import { appendFileSync as appendFileSync4 } from "fs";
|
|
41719
|
+
function captureUpstreamError(record4) {
|
|
41720
|
+
const path = process.env[UPSTREAM_ERROR_LOG_ENV];
|
|
41721
|
+
if (!path)
|
|
41722
|
+
return false;
|
|
41723
|
+
try {
|
|
41724
|
+
const raw = record4.body ?? "";
|
|
41725
|
+
const truncated = raw.length > MAX_CAPTURED_BODY_BYTES;
|
|
41726
|
+
const line = JSON.stringify({
|
|
41727
|
+
at: record4.at ?? new Date().toISOString(),
|
|
41728
|
+
provider: record4.provider,
|
|
41729
|
+
model: record4.model,
|
|
41730
|
+
status: record4.status,
|
|
41731
|
+
body: truncated ? raw.slice(0, MAX_CAPTURED_BODY_BYTES) : raw,
|
|
41732
|
+
...truncated ? { truncated: true, original_bytes: raw.length } : {}
|
|
41733
|
+
});
|
|
41734
|
+
appendFileSync4(path, `${line}
|
|
41735
|
+
`);
|
|
41736
|
+
return true;
|
|
41737
|
+
} catch {
|
|
41738
|
+
return false;
|
|
41739
|
+
}
|
|
41740
|
+
}
|
|
41741
|
+
var UPSTREAM_ERROR_LOG_ENV = "CLAUDISH_UPSTREAM_ERROR_LOG", MAX_CAPTURED_BODY_BYTES = 2048;
|
|
41742
|
+
var init_upstream_error_capture = () => {};
|
|
41743
|
+
|
|
41717
41744
|
// src/handlers/composed-handler.ts
|
|
41718
41745
|
function extractAuthHeaders(c) {
|
|
41719
41746
|
const headers = c.req.header();
|
|
@@ -42113,6 +42140,12 @@ class ComposedHandler {
|
|
|
42113
42140
|
} else {
|
|
42114
42141
|
const errorText = await response.text();
|
|
42115
42142
|
log(`[${this.provider.displayName}] Error: ${errorText}`);
|
|
42143
|
+
captureUpstreamError({
|
|
42144
|
+
provider: this.provider.displayName,
|
|
42145
|
+
model: this.bareModelName,
|
|
42146
|
+
status: response.status,
|
|
42147
|
+
body: errorText
|
|
42148
|
+
});
|
|
42116
42149
|
const transportTerminal = this.provider.classifyTerminalError?.(response.status, errorText);
|
|
42117
42150
|
const hint = getRecoveryHint(response.status, errorText, this.provider.displayName, transportTerminal);
|
|
42118
42151
|
let parsedErrorBody;
|
|
@@ -42615,6 +42648,7 @@ var init_composed_handler = __esm(() => {
|
|
|
42615
42648
|
init_openai_responses_sse();
|
|
42616
42649
|
init_openai_sse();
|
|
42617
42650
|
init_token_tracker();
|
|
42651
|
+
init_upstream_error_capture();
|
|
42618
42652
|
STREAM_RETRY_DELAYS_MS = [3000, 15000, 30000];
|
|
42619
42653
|
});
|
|
42620
42654
|
|
|
@@ -45611,7 +45645,7 @@ var init_prehydrate = __esm(() => {
|
|
|
45611
45645
|
});
|
|
45612
45646
|
|
|
45613
45647
|
// src/channel/diagnostics.ts
|
|
45614
|
-
import { appendFileSync as
|
|
45648
|
+
import { appendFileSync as appendFileSync5 } from "fs";
|
|
45615
45649
|
function traceEnabled() {
|
|
45616
45650
|
return process.env[TRACE_ENV] === "1";
|
|
45617
45651
|
}
|
|
@@ -45622,7 +45656,7 @@ function emit(line) {
|
|
|
45622
45656
|
const filePath = process.env[TRACE_FILE_ENV];
|
|
45623
45657
|
if (filePath) {
|
|
45624
45658
|
try {
|
|
45625
|
-
|
|
45659
|
+
appendFileSync5(filePath, formatted);
|
|
45626
45660
|
} catch {}
|
|
45627
45661
|
}
|
|
45628
45662
|
}
|
|
@@ -49175,7 +49209,7 @@ var init_fallback_handler = __esm(() => {
|
|
|
49175
49209
|
});
|
|
49176
49210
|
|
|
49177
49211
|
// src/handlers/native-handler-advisor.ts
|
|
49178
|
-
import { appendFileSync as
|
|
49212
|
+
import { appendFileSync as appendFileSync6 } from "fs";
|
|
49179
49213
|
function loadAdvisorSwapConfig(cliModels, cliCollector) {
|
|
49180
49214
|
return {
|
|
49181
49215
|
enabled: process.env.CLAUDISH_SWAP_ADVISOR === "1" || (cliModels?.length ?? 0) > 0,
|
|
@@ -49230,7 +49264,7 @@ function logAdvisorEvent(cfg, event) {
|
|
|
49230
49264
|
const line = `${JSON.stringify({ ts: new Date().toISOString(), ...event })}
|
|
49231
49265
|
`;
|
|
49232
49266
|
try {
|
|
49233
|
-
|
|
49267
|
+
appendFileSync6(cfg.logPath, line);
|
|
49234
49268
|
} catch {}
|
|
49235
49269
|
}
|
|
49236
49270
|
function recordAdvisorEventsFromChunk(cfg, chunkText) {
|
|
@@ -52031,11 +52065,30 @@ ${plan.hint}` : `[Route] ${plan.reason}`;
|
|
|
52031
52065
|
}));
|
|
52032
52066
|
app.get("/health", (c) => c.json({ status: "ok" }));
|
|
52033
52067
|
const servedSlotIds = options.servedSlotIds ?? [];
|
|
52068
|
+
const discoverableModelIds = (() => {
|
|
52069
|
+
const seen = new Set;
|
|
52070
|
+
try {
|
|
52071
|
+
const cfg = loadConfig();
|
|
52072
|
+
for (const name of Object.keys(cfg.routing ?? {})) {
|
|
52073
|
+
if (name === "*")
|
|
52074
|
+
continue;
|
|
52075
|
+
seen.add(name);
|
|
52076
|
+
}
|
|
52077
|
+
for (const ep of Object.values(cfg.customEndpoints ?? {})) {
|
|
52078
|
+
for (const m of ep.models ?? [])
|
|
52079
|
+
seen.add(m);
|
|
52080
|
+
}
|
|
52081
|
+
} catch (err) {
|
|
52082
|
+
log(`[Proxy] /v1/models discovery skipped: ${err instanceof Error ? err.message : err}`);
|
|
52083
|
+
}
|
|
52084
|
+
return [...seen];
|
|
52085
|
+
})();
|
|
52034
52086
|
app.get("/v1/models", (c) => {
|
|
52087
|
+
const ids = servedSlotIds.length > 0 ? servedSlotIds : discoverableModelIds;
|
|
52035
52088
|
return c.json({
|
|
52036
52089
|
object: "list",
|
|
52037
52090
|
has_more: false,
|
|
52038
|
-
data:
|
|
52091
|
+
data: ids.map((id) => ({
|
|
52039
52092
|
id,
|
|
52040
52093
|
object: "model",
|
|
52041
52094
|
type: "model",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudish",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.58.0",
|
|
4
4
|
"description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"ai"
|
|
61
61
|
],
|
|
62
62
|
"optionalDependencies": {
|
|
63
|
-
"@claudish/magmux-darwin-arm64": "7.
|
|
64
|
-
"@claudish/magmux-darwin-x64": "7.
|
|
65
|
-
"@claudish/magmux-linux-arm64": "7.
|
|
66
|
-
"@claudish/magmux-linux-x64": "7.
|
|
63
|
+
"@claudish/magmux-darwin-arm64": "7.58.0",
|
|
64
|
+
"@claudish/magmux-darwin-x64": "7.58.0",
|
|
65
|
+
"@claudish/magmux-linux-arm64": "7.58.0",
|
|
66
|
+
"@claudish/magmux-linux-x64": "7.58.0"
|
|
67
67
|
},
|
|
68
68
|
"author": "Jack Rudenko <i@madappgang.com>",
|
|
69
69
|
"license": "MIT",
|