@zhin.js/process-monitor 0.0.27 → 0.0.28
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": "@zhin.js/process-monitor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "进程监控与重启通知插件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
"client",
|
|
20
20
|
"dist",
|
|
21
21
|
"skills",
|
|
22
|
+
"tools",
|
|
23
|
+
"plugin.yml",
|
|
22
24
|
"README.md"
|
|
23
25
|
],
|
|
24
26
|
"keywords": [
|
|
@@ -37,14 +39,14 @@
|
|
|
37
39
|
"directory": "plugins/features/process-monitor"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"zhin.js": "1.0.
|
|
42
|
+
"zhin.js": "1.0.64"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@types/node": "^24.10.4",
|
|
44
|
-
"typescript": "^
|
|
46
|
+
"typescript": "^6.0.0"
|
|
45
47
|
},
|
|
46
48
|
"peerDependencies": {
|
|
47
|
-
"zhin.js": "^1.0.
|
|
49
|
+
"zhin.js": "^1.0.64"
|
|
48
50
|
},
|
|
49
51
|
"scripts": {
|
|
50
52
|
"build": "tsc",
|
package/plugin.yml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import { processState, startTime, formatUptime } from '../../src/index.js';
|
|
3
|
+
|
|
4
|
+
export default async function processStatus(): Promise<string> {
|
|
5
|
+
const uptime = Date.now() - startTime;
|
|
6
|
+
const memUsage = process.memoryUsage();
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
'📊 进程监控状态',
|
|
10
|
+
'',
|
|
11
|
+
`🚀 当前 PID: ${process.pid}`,
|
|
12
|
+
`⏱️ 运行时长: ${formatUptime(uptime)}`,
|
|
13
|
+
`💾 内存使用: ${Math.round(memUsage.heapUsed / 1024 / 1024)} MB`,
|
|
14
|
+
`🔄 总重启: ${processState.restartCount} 次`,
|
|
15
|
+
`💥 崩溃: ${processState.crashCount} 次`,
|
|
16
|
+
`📈 累计运行: ${formatUptime(processState.totalUptime)}`,
|
|
17
|
+
`🖥️ 主机: ${os.hostname()}`,
|
|
18
|
+
`💻 平台: ${os.platform()}-${os.arch()}`,
|
|
19
|
+
`📦 Node: ${process.version}`,
|
|
20
|
+
].join('\n');
|
|
21
|
+
}
|