@radaros/edge 0.3.40 → 0.3.41
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.cjs +22 -3
- package/dist/index.js +22 -3
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5096,8 +5096,20 @@ function getDiskUsage() {
|
|
|
5096
5096
|
usedPercent: total > 0 ? Math.round(used / total * 1e3) / 10 : 0
|
|
5097
5097
|
};
|
|
5098
5098
|
}
|
|
5099
|
+
function safeUptime() {
|
|
5100
|
+
try {
|
|
5101
|
+
return os.uptime();
|
|
5102
|
+
} catch {
|
|
5103
|
+
return 0;
|
|
5104
|
+
}
|
|
5105
|
+
}
|
|
5099
5106
|
function getNetworkInfo() {
|
|
5100
|
-
|
|
5107
|
+
let nets;
|
|
5108
|
+
try {
|
|
5109
|
+
nets = os.networkInterfaces();
|
|
5110
|
+
} catch {
|
|
5111
|
+
return [];
|
|
5112
|
+
}
|
|
5101
5113
|
const results = [];
|
|
5102
5114
|
for (const [name, addrs] of Object.entries(nets)) {
|
|
5103
5115
|
if (!addrs) continue;
|
|
@@ -5130,7 +5142,7 @@ var SystemToolkit = class extends import_core6.Toolkit {
|
|
|
5130
5142
|
platform: os.platform(),
|
|
5131
5143
|
arch: os.arch(),
|
|
5132
5144
|
hostname: os.hostname(),
|
|
5133
|
-
uptime_seconds:
|
|
5145
|
+
uptime_seconds: safeUptime(),
|
|
5134
5146
|
cpu: {
|
|
5135
5147
|
model: os.cpus()[0]?.model ?? "unknown",
|
|
5136
5148
|
cores: os.cpus().length,
|
|
@@ -5432,6 +5444,13 @@ var http = __toESM(require("http"), 1);
|
|
|
5432
5444
|
var import_node_events = require("events");
|
|
5433
5445
|
var fs3 = __toESM(require("fs"), 1);
|
|
5434
5446
|
var os2 = __toESM(require("os"), 1);
|
|
5447
|
+
function safeUptime2() {
|
|
5448
|
+
try {
|
|
5449
|
+
return os2.uptime();
|
|
5450
|
+
} catch {
|
|
5451
|
+
return 0;
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5435
5454
|
var DEFAULT_THRESHOLDS = {
|
|
5436
5455
|
thermalThrottleC: 75,
|
|
5437
5456
|
memoryThreshold: 0.85,
|
|
@@ -5522,7 +5541,7 @@ var ResourceMonitor = class extends import_node_events.EventEmitter {
|
|
|
5522
5541
|
free_bytes: disk.free,
|
|
5523
5542
|
usage_percent: disk.usedPercent
|
|
5524
5543
|
},
|
|
5525
|
-
uptime_seconds:
|
|
5544
|
+
uptime_seconds: safeUptime2()
|
|
5526
5545
|
};
|
|
5527
5546
|
this._lastSnapshot = snap;
|
|
5528
5547
|
return snap;
|
package/dist/index.js
CHANGED
|
@@ -5048,8 +5048,20 @@ function getDiskUsage() {
|
|
|
5048
5048
|
usedPercent: total > 0 ? Math.round(used / total * 1e3) / 10 : 0
|
|
5049
5049
|
};
|
|
5050
5050
|
}
|
|
5051
|
+
function safeUptime() {
|
|
5052
|
+
try {
|
|
5053
|
+
return os.uptime();
|
|
5054
|
+
} catch {
|
|
5055
|
+
return 0;
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5051
5058
|
function getNetworkInfo() {
|
|
5052
|
-
|
|
5059
|
+
let nets;
|
|
5060
|
+
try {
|
|
5061
|
+
nets = os.networkInterfaces();
|
|
5062
|
+
} catch {
|
|
5063
|
+
return [];
|
|
5064
|
+
}
|
|
5053
5065
|
const results = [];
|
|
5054
5066
|
for (const [name, addrs] of Object.entries(nets)) {
|
|
5055
5067
|
if (!addrs) continue;
|
|
@@ -5082,7 +5094,7 @@ var SystemToolkit = class extends Toolkit6 {
|
|
|
5082
5094
|
platform: os.platform(),
|
|
5083
5095
|
arch: os.arch(),
|
|
5084
5096
|
hostname: os.hostname(),
|
|
5085
|
-
uptime_seconds:
|
|
5097
|
+
uptime_seconds: safeUptime(),
|
|
5086
5098
|
cpu: {
|
|
5087
5099
|
model: os.cpus()[0]?.model ?? "unknown",
|
|
5088
5100
|
cores: os.cpus().length,
|
|
@@ -5384,6 +5396,13 @@ import * as http from "http";
|
|
|
5384
5396
|
import { EventEmitter } from "events";
|
|
5385
5397
|
import * as fs3 from "fs";
|
|
5386
5398
|
import * as os2 from "os";
|
|
5399
|
+
function safeUptime2() {
|
|
5400
|
+
try {
|
|
5401
|
+
return os2.uptime();
|
|
5402
|
+
} catch {
|
|
5403
|
+
return 0;
|
|
5404
|
+
}
|
|
5405
|
+
}
|
|
5387
5406
|
var DEFAULT_THRESHOLDS = {
|
|
5388
5407
|
thermalThrottleC: 75,
|
|
5389
5408
|
memoryThreshold: 0.85,
|
|
@@ -5474,7 +5493,7 @@ var ResourceMonitor = class extends EventEmitter {
|
|
|
5474
5493
|
free_bytes: disk.free,
|
|
5475
5494
|
usage_percent: disk.usedPercent
|
|
5476
5495
|
},
|
|
5477
|
-
uptime_seconds:
|
|
5496
|
+
uptime_seconds: safeUptime2()
|
|
5478
5497
|
};
|
|
5479
5498
|
this._lastSnapshot = snap;
|
|
5480
5499
|
return snap;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radaros/edge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.41",
|
|
4
4
|
"description": "Edge deployment for RadarOS — IoT toolkits (GPIO, sensors, camera, BLE), edge runtime, and Ollama helpers for Raspberry Pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "^5.6.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@radaros/core": "^0.3.
|
|
47
|
+
"@radaros/core": "^0.3.41",
|
|
48
48
|
"node-libgpiod": ">=0.4.0",
|
|
49
49
|
"i2c-bus": ">=5.0.0",
|
|
50
50
|
"@stoprocent/noble": ">=2.0.0"
|