nverify-watchdog 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/index.js +4 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -9,19 +9,14 @@ class NVerifyWatchDog {
9
9
  this.isConnecting = false;
10
10
  }
11
11
 
12
- /**
13
- * @param {string} serverName - The name of THIS backend
14
- * @param {string} nverifyUrl - (Optional) Override default URL
15
- */
16
12
  connect(serverName, nverifyUrl = this.defaultUrl) {
17
- if (this.socket) return; // Prevent multiple connections
13
+ if (this.socket) return;
18
14
 
19
15
  this.serverName = serverName;
20
16
  const baseUrl = nverifyUrl.replace(/\/$/, "");
21
17
 
22
- console.log(`[NVerify Agent] Initializing connection to ${baseUrl}...`);
18
+ console.log(`[God's-Eye Agent] Initializing connection to ${baseUrl}...`);
23
19
 
24
- // Force WebSocket to avoid Railway/Proxy XHR polling issues
25
20
  this.socket = io(`${baseUrl}/admin-monitor`, {
26
21
  transports: ["websocket"],
27
22
  reconnection: true,
@@ -31,26 +26,22 @@ class NVerifyWatchDog {
31
26
 
32
27
  this.socket.on("connect", () => {
33
28
  console.log(
34
- `[NVerify Agent] SUCCESSFULLY connected to Hub as: ${this.serverName}`,
29
+ `[God's-Eye Agent] SUCCESSFULLY connected to Hub as: ${this.serverName}`,
35
30
  );
36
31
  });
37
32
 
38
33
  this.socket.on("connect_error", (err) => {
39
- // We use original console.error here (not hijacked) to avoid loops
40
34
  process.stderr.write(
41
- `[NVerify Agent] Connection Error: ${err.message}\n`,
35
+ `[God's-Eye Agent] Connection Error: ${err.message}\n`,
42
36
  );
43
37
  });
44
38
 
45
- // Start sending metrics every 2 seconds
46
39
  setInterval(() => this._sendMetrics(), 2000);
47
40
 
48
- // Hijack console.log to automatically send all logs to NVerify
49
41
  this._hijackLogs();
50
42
  }
51
43
 
52
44
  _sendMetrics() {
53
- // Only send if the socket is actually open
54
45
  if (!this.socket || !this.socket.connected) return;
55
46
 
56
47
  const totalRam = os.totalmem();
@@ -78,8 +69,6 @@ class NVerifyWatchDog {
78
69
  const originalError = console.error;
79
70
 
80
71
  const sendToHub = (level, ...args) => {
81
- // CRITICAL: Only emit if socket is connected.
82
- // If we emit during a connection error, we create an infinite loop.
83
72
  if (this.socket && this.socket.connected) {
84
73
  const message = args
85
74
  .map((a) => (typeof a === "object" ? JSON.stringify(a) : a))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nverify-watchdog",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "gods-eye server monitor agent",
5
5
  "license": "ISC",
6
6
  "author": "",