lynkr 9.1.3 → 9.1.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lynkr",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.5",
|
|
4
4
|
"description": "Self-hosted Claude Code & Cursor proxy with Databricks,AWS BedRock,Azure adapters, openrouter, Ollama,llamacpp,LM Studio, workspace tooling, and MCP integration.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -44,11 +44,18 @@ class LoadShedder {
|
|
|
44
44
|
const memUsage = process.memoryUsage();
|
|
45
45
|
const heapUsedPercent = memUsage.heapUsed / memUsage.heapTotal;
|
|
46
46
|
|
|
47
|
-
if
|
|
47
|
+
// FIX: Only trigger if BOTH percentage is high AND actual usage is significant
|
|
48
|
+
// This prevents false positives on startup when heapTotal is small but will grow
|
|
49
|
+
const heapUsedMB = memUsage.heapUsed / (1024 * 1024);
|
|
50
|
+
const minHeapThresholdMB = 500; // Only shed load if using more than 500MB
|
|
51
|
+
|
|
52
|
+
if (heapUsedPercent > this.heapThreshold && heapUsedMB > minHeapThresholdMB) {
|
|
48
53
|
logger.warn(
|
|
49
54
|
{
|
|
50
55
|
heapUsedPercent: (heapUsedPercent * 100).toFixed(2),
|
|
56
|
+
heapUsedMB: heapUsedMB.toFixed(2),
|
|
51
57
|
threshold: (this.heapThreshold * 100).toFixed(2),
|
|
58
|
+
minThresholdMB: minHeapThresholdMB,
|
|
52
59
|
},
|
|
53
60
|
"Load shedding: Heap usage exceeded threshold"
|
|
54
61
|
);
|
|
@@ -96,6 +103,9 @@ class LoadShedder {
|
|
|
96
103
|
activeRequests: this.activeRequests,
|
|
97
104
|
totalShed: this.totalShed,
|
|
98
105
|
heapUsedPercent: ((memUsage.heapUsed / memUsage.heapTotal) * 100).toFixed(2),
|
|
106
|
+
heapUsedMB: (memUsage.heapUsed / (1024 * 1024)).toFixed(2),
|
|
107
|
+
heapTotalMB: (memUsage.heapTotal / (1024 * 1024)).toFixed(2),
|
|
108
|
+
rssMB: (memUsage.rss / (1024 * 1024)).toFixed(2),
|
|
99
109
|
rssPercent: ((memUsage.rss / os.totalmem()) * 100).toFixed(2),
|
|
100
110
|
thresholds: {
|
|
101
111
|
heapThreshold: (this.heapThreshold * 100).toFixed(2),
|
package/src/config/index.js
CHANGED
|
@@ -394,6 +394,18 @@ const finalModelProvider = (process.env.MODEL_PROVIDER ?? "databricks").toLowerC
|
|
|
394
394
|
const finalFallbackProvider = (process.env.FALLBACK_PROVIDER ?? "databricks").toLowerCase();
|
|
395
395
|
const finalFallbackEnabled = process.env.FALLBACK_ENABLED === "true";
|
|
396
396
|
|
|
397
|
+
// Safety check: prevent self-loop when tier routing is active and provider is not databricks
|
|
398
|
+
// If using tier routing with ollama/llamacpp/lmstudio, clear databricks URL to prevent agents from calling back to self
|
|
399
|
+
if (tierRoutingMode && finalModelProvider !== "databricks" && rawBaseUrl) {
|
|
400
|
+
const isLocalhost = rawBaseUrl.includes('localhost') || rawBaseUrl.includes('127.0.0.1');
|
|
401
|
+
const matchesServerPort = rawBaseUrl.includes(`:${port}`);
|
|
402
|
+
if (isLocalhost && matchesServerPort) {
|
|
403
|
+
console.warn(`[WARN] DATABRICKS_API_BASE points to this server (${rawBaseUrl}). Clearing to prevent self-loop.`);
|
|
404
|
+
rawBaseUrl = null;
|
|
405
|
+
apiKey = null;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
397
409
|
// Warn about misconfigured fallback provider (only when tier routing is active,
|
|
398
410
|
// since that's the only path that triggers provider fallback)
|
|
399
411
|
if (finalFallbackEnabled && tiersConfigured) {
|