claw-subagent-service 0.0.91 → 0.0.92
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
|
@@ -129,10 +129,13 @@ function checkProcessExists() {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
async function getOpenClawStatus(port = 18789) {
|
|
132
|
+
// 核心判断:只有端口在监听才算是真正运行
|
|
133
|
+
// openclaw gateway 的核心功能就是监听端口提供服务
|
|
134
|
+
|
|
132
135
|
// 方法1: 通过 net.Socket 检查端口
|
|
133
136
|
const isListening = await checkPortOnAllInterfaces(port);
|
|
134
137
|
if (isListening) {
|
|
135
|
-
console.log(`[PortChecker] 端口 ${port}
|
|
138
|
+
console.log(`[PortChecker] 端口 ${port} 检测为运行中`);
|
|
136
139
|
return 1;
|
|
137
140
|
}
|
|
138
141
|
|
|
@@ -143,12 +146,10 @@ async function getOpenClawStatus(port = 18789) {
|
|
|
143
146
|
return 1;
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
// 方法3:
|
|
149
|
+
// 方法3: 检查进程是否存在(仅用于日志,不改变判断结果)
|
|
147
150
|
const processExists = checkProcessExists();
|
|
148
151
|
if (processExists) {
|
|
149
|
-
console.warn(`[PortChecker] 警告: openclaw 进程存在,但端口 ${port}
|
|
150
|
-
// 进程存在但端口未监听,返回特殊状态 2
|
|
151
|
-
return 2;
|
|
152
|
+
console.warn(`[PortChecker] 警告: openclaw 进程存在,但端口 ${port} 未监听。服务可能未正确启动或已崩溃。`);
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
console.log(`[PortChecker] 端口 ${port} 检测为未运行`);
|
|
@@ -327,18 +327,11 @@ class RongyunMessageHandler {
|
|
|
327
327
|
const openClawStatus = await getOpenClawStatus();
|
|
328
328
|
|
|
329
329
|
// 构建状态数据
|
|
330
|
-
// openClawStatus: 1
|
|
331
|
-
|
|
332
|
-
if (openClawStatus === 1) {
|
|
333
|
-
statusMessage = '运行中';
|
|
334
|
-
} else if (openClawStatus === 2) {
|
|
335
|
-
statusMessage = '运行中(端口异常)';
|
|
336
|
-
} else {
|
|
337
|
-
statusMessage = '未运行';
|
|
338
|
-
}
|
|
330
|
+
// openClawStatus: 1=端口监听正常(服务可用), 0=未运行(端口未监听)
|
|
331
|
+
const statusMessage = openClawStatus === 1 ? '运行中' : '未运行';
|
|
339
332
|
|
|
340
333
|
const statusData = {
|
|
341
|
-
open_claw_status: openClawStatus, // 1=运行中,
|
|
334
|
+
open_claw_status: openClawStatus, // 1=运行中, 0=未运行
|
|
342
335
|
status_message: statusMessage,
|
|
343
336
|
mac_address: getMacAddress(),
|
|
344
337
|
version: '0.0.20',
|