@zhin.js/process-monitor 0.0.26 → 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.26",
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.62"
42
+ "zhin.js": "1.0.64"
41
43
  },
42
44
  "devDependencies": {
43
45
  "@types/node": "^24.10.4",
44
- "typescript": "^5.9.3"
46
+ "typescript": "^6.0.0"
45
47
  },
46
48
  "peerDependencies": {
47
- "zhin.js": "^1.0.62"
49
+ "zhin.js": "^1.0.64"
48
50
  },
49
51
  "scripts": {
50
52
  "build": "tsc",
package/plugin.yml ADDED
@@ -0,0 +1,2 @@
1
+ name: process-monitor
2
+ description: 进程监控与重启通知插件,提供进程状态查看和异常通知
@@ -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
+ }
@@ -0,0 +1,7 @@
1
+ ---
2
+ name: process_status
3
+ description: 查看进程监控状态,包括 PID、运行时长、内存、重启和崩溃统计
4
+ tags: [监控, 进程]
5
+ keywords: [进程状态, 监控状态, process status]
6
+ handler: ./handler.ts
7
+ ---