omnius 1.0.511 → 1.0.512
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 +44 -7
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31906,7 +31906,7 @@ async function _collectSysMetrics() {
|
|
|
31906
31906
|
} catch {}
|
|
31907
31907
|
try {
|
|
31908
31908
|
var cp = await import('node:child_process');
|
|
31909
|
-
var smiOut = cp.execSync('nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null', { encoding: 'utf8', timeout:
|
|
31909
|
+
var smiOut = cp.execSync('nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null', { encoding: 'utf8', timeout: 8000 });
|
|
31910
31910
|
var smiLine = smiOut.trim().split('\\n')[0];
|
|
31911
31911
|
if (smiLine) {
|
|
31912
31912
|
var sp = smiLine.split(',').map(function(s) { return s.trim(); });
|
|
@@ -31917,7 +31917,21 @@ async function _collectSysMetrics() {
|
|
|
31917
31917
|
gpuInfo.name = sp[3] || '';
|
|
31918
31918
|
gpuInfo.vramUtilization = gpuInfo.vramTotalMB > 0 ? Math.round((gpuInfo.vramUsedMB / gpuInfo.vramTotalMB) * 100) : 0;
|
|
31919
31919
|
}
|
|
31920
|
-
} catch {
|
|
31920
|
+
} catch {
|
|
31921
|
+
// nvidia-smi can be killed or time out under tight memory pressure even
|
|
31922
|
+
// when a GPU is present (e.g. Ollama actively holding VRAM). Fall back to a
|
|
31923
|
+
// cheap /dev/nvidia* node probe so we don't falsely report the GPU as
|
|
31924
|
+
// unavailable on systems that clearly have an NVIDIA device.
|
|
31925
|
+
try {
|
|
31926
|
+
var fsProbe = await import('node:fs');
|
|
31927
|
+
var devEntries = fsProbe.readdirSync('/dev');
|
|
31928
|
+
var nvidiaPresent = devEntries.some(function(d) { return /^nvidiad+$/.test(d); });
|
|
31929
|
+
if (nvidiaPresent) {
|
|
31930
|
+
gpuInfo.available = true;
|
|
31931
|
+
if (!gpuInfo.name) gpuInfo.name = 'NVIDIA GPU (nvidia-smi probe failed)';
|
|
31932
|
+
}
|
|
31933
|
+
} catch {}
|
|
31934
|
+
}
|
|
31921
31935
|
_sysMetricsCache = {
|
|
31922
31936
|
cpu: { utilization: Math.min(100, Math.round((loads[0] / cores) * 100)), cores: cores, model: cpuModel },
|
|
31923
31937
|
memory: { utilization: Math.round((usedMem / totalMem) * 100), totalGB: Math.round((totalMem / (1024*1024*1024)) * 10) / 10, usedGB: Math.round((usedMem / (1024*1024*1024)) * 10) / 10 },
|
|
@@ -34279,7 +34293,7 @@ async function handleCmd(cmd) {
|
|
|
34279
34293
|
} catch {}
|
|
34280
34294
|
try {
|
|
34281
34295
|
var cp = await import('node:child_process');
|
|
34282
|
-
var smiOut = cp.execSync('nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null', { encoding: 'utf8', timeout:
|
|
34296
|
+
var smiOut = cp.execSync('nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total,name --format=csv,noheader,nounits 2>/dev/null', { encoding: 'utf8', timeout: 8000 });
|
|
34283
34297
|
var smiLine = smiOut.trim().split('\\n')[0];
|
|
34284
34298
|
if (smiLine) {
|
|
34285
34299
|
var sp = smiLine.split(',').map(function(s) { return s.trim(); });
|
|
@@ -34290,7 +34304,27 @@ async function handleCmd(cmd) {
|
|
|
34290
34304
|
gpuInfo.name = sp[3] || '';
|
|
34291
34305
|
gpuInfo.vramUtilization = gpuInfo.vramTotalMB > 0 ? Math.round((gpuInfo.vramUsedMB / gpuInfo.vramTotalMB) * 100) : 0;
|
|
34292
34306
|
}
|
|
34293
|
-
} catch
|
|
34307
|
+
} catch {
|
|
34308
|
+
// nvidia-smi can be killed or time out under tight memory pressure
|
|
34309
|
+
// even when a GPU is present (e.g. Ollama holding VRAM). Fall back to
|
|
34310
|
+
// a cheap /dev/nvidia* node probe so we don't falsely report the GPU
|
|
34311
|
+
// as unavailable on systems that clearly have an NVIDIA device.
|
|
34312
|
+
try {
|
|
34313
|
+
var fsProbe = await import('node:fs');
|
|
34314
|
+
var devEntries = fsProbe.readdirSync('/dev');
|
|
34315
|
+
var nvidiaPresent = devEntries.some(function(d) { return /^nvidiad+$/.test(d); });
|
|
34316
|
+
// Also accept the nvidia-smi binary existing on PATH as a
|
|
34317
|
+
// permissive signal — on tight-memory systems the driver is
|
|
34318
|
+
// loaded (so the binary is present) even when a live query is
|
|
34319
|
+
// killed. Either signal means a GPU is genuinely available.
|
|
34320
|
+
var smiBin = '';
|
|
34321
|
+
try { smiBin = cp.execSync('command -v nvidia-smi 2>/dev/null', { encoding: 'utf8', timeout: 3000 }).trim(); } catch {}
|
|
34322
|
+
if (nvidiaPresent || !!smiBin) {
|
|
34323
|
+
gpuInfo.available = true;
|
|
34324
|
+
if (!gpuInfo.name) gpuInfo.name = 'NVIDIA GPU (nvidia-smi probe failed)';
|
|
34325
|
+
}
|
|
34326
|
+
} catch {}
|
|
34327
|
+
}
|
|
34294
34328
|
var cpuModel = '';
|
|
34295
34329
|
try { var cpuInfoArr = os.cpus(); if (cpuInfoArr.length > 0) cpuModel = cpuInfoArr[0].model || ''; } catch {}
|
|
34296
34330
|
var metricsPayload = {
|
|
@@ -602900,19 +602934,22 @@ ${description}`
|
|
|
602900
602934
|
}
|
|
602901
602935
|
const requestMessages = effectiveThink ? cleanedMessages : injectNoThinkDirective(cleanedMessages);
|
|
602902
602936
|
const responseFormat = request.responseFormat ?? request.response_format;
|
|
602937
|
+
const isOllama = shouldUseOllamaPoolForBaseUrl(this.baseUrl);
|
|
602903
602938
|
const body = {
|
|
602904
602939
|
model: this.model,
|
|
602905
602940
|
messages: requestMessages,
|
|
602906
602941
|
tools: request.tools,
|
|
602907
602942
|
temperature: request.temperature,
|
|
602908
|
-
max_tokens: effectiveMaxTokens
|
|
602909
|
-
think: effectiveThink
|
|
602943
|
+
max_tokens: effectiveMaxTokens
|
|
602910
602944
|
};
|
|
602945
|
+
if (isOllama) {
|
|
602946
|
+
body["think"] = effectiveThink;
|
|
602947
|
+
}
|
|
602911
602948
|
if (responseFormat !== void 0) {
|
|
602912
602949
|
body["response_format"] = responseFormat;
|
|
602913
602950
|
}
|
|
602914
602951
|
const reqNumCtx = request.numCtx ?? request.num_ctx;
|
|
602915
|
-
if (Number.isFinite(reqNumCtx) && (reqNumCtx ?? 0) > 0) {
|
|
602952
|
+
if (isOllama && Number.isFinite(reqNumCtx) && (reqNumCtx ?? 0) > 0) {
|
|
602916
602953
|
const opts = body["options"] ?? {};
|
|
602917
602954
|
opts["num_ctx"] = reqNumCtx;
|
|
602918
602955
|
body["options"] = opts;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.512",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.512",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
|
@@ -2579,9 +2579,9 @@
|
|
|
2579
2579
|
}
|
|
2580
2580
|
},
|
|
2581
2581
|
"node_modules/bare-path": {
|
|
2582
|
-
"version": "3.1.
|
|
2583
|
-
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.
|
|
2584
|
-
"integrity": "sha512-
|
|
2582
|
+
"version": "3.1.1",
|
|
2583
|
+
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.1.1.tgz",
|
|
2584
|
+
"integrity": "sha512-JprUlveX3QjApC1cTpsUOiscADftCGVWkzitbHsRqv84hzYwYHw2mbluddsq5TvI8mH/8Ov1f4BiMAdcB0oYnQ==",
|
|
2585
2585
|
"license": "Apache-2.0",
|
|
2586
2586
|
"optional": true
|
|
2587
2587
|
},
|
package/package.json
CHANGED