omnius 1.0.511 → 1.0.513
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 +92 -9
- 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;
|
|
@@ -637200,6 +637237,39 @@ async function collectNetworkMetrics() {
|
|
|
637200
637237
|
}
|
|
637201
637238
|
return { rxBytesPerSec: 0, txBytesPerSec: 0 };
|
|
637202
637239
|
}
|
|
637240
|
+
async function hasNvidiaDevice() {
|
|
637241
|
+
try {
|
|
637242
|
+
const { readdirSync: readdirSync62 } = await import("node:fs");
|
|
637243
|
+
const dev = readdirSync62("/dev");
|
|
637244
|
+
if (dev.some((f2) => f2 === "nvidia0" || /^nvidia\d+$/.test(f2) || f2.startsWith("nvidia"))) {
|
|
637245
|
+
return true;
|
|
637246
|
+
}
|
|
637247
|
+
} catch {
|
|
637248
|
+
}
|
|
637249
|
+
return new Promise((resolve78) => {
|
|
637250
|
+
exec4("command -v nvidia-smi", { encoding: "utf8", timeout: 2e3 }, (err) => resolve78(!err));
|
|
637251
|
+
});
|
|
637252
|
+
}
|
|
637253
|
+
function nvidiaPresentFallback() {
|
|
637254
|
+
return {
|
|
637255
|
+
available: true,
|
|
637256
|
+
count: 1,
|
|
637257
|
+
name: "NVIDIA GPU",
|
|
637258
|
+
utilization: 0,
|
|
637259
|
+
vramUsedMB: 0,
|
|
637260
|
+
vramTotalMB: 0,
|
|
637261
|
+
vramUtilization: 0,
|
|
637262
|
+
devices: [{
|
|
637263
|
+
index: 0,
|
|
637264
|
+
uuid: "nvidia-fallback",
|
|
637265
|
+
name: "NVIDIA GPU",
|
|
637266
|
+
utilization: 0,
|
|
637267
|
+
vramUsedMB: 0,
|
|
637268
|
+
vramTotalMB: 0,
|
|
637269
|
+
vramUtilization: 0
|
|
637270
|
+
}]
|
|
637271
|
+
};
|
|
637272
|
+
}
|
|
637203
637273
|
async function collectGpuMetrics() {
|
|
637204
637274
|
const noGpu = {
|
|
637205
637275
|
available: false,
|
|
@@ -637232,7 +637302,10 @@ async function collectGpuMetrics() {
|
|
|
637232
637302
|
}]
|
|
637233
637303
|
};
|
|
637234
637304
|
}
|
|
637235
|
-
if (_nvidiaSmiAvailable2 === false)
|
|
637305
|
+
if (_nvidiaSmiAvailable2 === false) {
|
|
637306
|
+
if (await hasNvidiaDevice()) return nvidiaPresentFallback();
|
|
637307
|
+
return noGpu;
|
|
637308
|
+
}
|
|
637236
637309
|
try {
|
|
637237
637310
|
const smi = await new Promise((resolve78, reject) => {
|
|
637238
637311
|
exec4(
|
|
@@ -637261,7 +637334,10 @@ async function collectGpuMetrics() {
|
|
|
637261
637334
|
vramUtilization: vramTotal2 > 0 ? Math.round(vramUsed2 / vramTotal2 * 100) : 0
|
|
637262
637335
|
});
|
|
637263
637336
|
}
|
|
637264
|
-
if (devices.length === 0)
|
|
637337
|
+
if (devices.length === 0) {
|
|
637338
|
+
if (await hasNvidiaDevice()) return nvidiaPresentFallback();
|
|
637339
|
+
return noGpu;
|
|
637340
|
+
}
|
|
637265
637341
|
const vramUsed = devices.reduce((sum2, gpu) => sum2 + gpu.vramUsedMB, 0);
|
|
637266
637342
|
const vramTotal = devices.reduce((sum2, gpu) => sum2 + gpu.vramTotalMB, 0);
|
|
637267
637343
|
const avgUtil = Math.round(devices.reduce((sum2, gpu) => sum2 + gpu.utilization, 0) / devices.length);
|
|
@@ -637279,6 +637355,7 @@ async function collectGpuMetrics() {
|
|
|
637279
637355
|
};
|
|
637280
637356
|
} catch {
|
|
637281
637357
|
_nvidiaSmiAvailable2 = false;
|
|
637358
|
+
if (await hasNvidiaDevice()) return nvidiaPresentFallback();
|
|
637282
637359
|
return noGpu;
|
|
637283
637360
|
}
|
|
637284
637361
|
}
|
|
@@ -639963,6 +640040,12 @@ var init_status_bar = __esm({
|
|
|
639963
640040
|
this._metricsCollector.startLocal((m2) => {
|
|
639964
640041
|
this._localUnifiedMetrics = m2;
|
|
639965
640042
|
this._unifiedMetrics = m2;
|
|
640043
|
+
const hw = m2.hardware;
|
|
640044
|
+
if (hw) {
|
|
640045
|
+
this._gpuName = hw.gpuName || "";
|
|
640046
|
+
this._vramTotal = hw.vramTotalMB || 0;
|
|
640047
|
+
this._vramUsed = hw.vramUsedMB || 0;
|
|
640048
|
+
}
|
|
639966
640049
|
if (this._remoteUnifiedMetrics) {
|
|
639967
640050
|
this._remoteUnifiedMetrics = {
|
|
639968
640051
|
...this._remoteUnifiedMetrics,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.513",
|
|
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.513",
|
|
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