claw-subagent-service 0.0.131 → 0.0.133
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
|
@@ -56,10 +56,31 @@ function getCommandName(command) {
|
|
|
56
56
|
return names[command] || '未知命令';
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* 检测是否在 Docker 环境(无 systemd)
|
|
61
|
+
*/
|
|
62
|
+
function isDockerEnvironment() {
|
|
63
|
+
try {
|
|
64
|
+
const fs = require('fs');
|
|
65
|
+
// 检查 /proc/1/cgroup 是否包含 docker
|
|
66
|
+
const cgroup = fs.readFileSync('/proc/1/cgroup', 'utf8');
|
|
67
|
+
return cgroup.includes('docker');
|
|
68
|
+
} catch (e) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* 使用 ServiceManager 管理服务(systemd 模式)
|
|
75
|
+
* 注意:在 Docker 环境中不应该使用 ServiceManager,因为 Docker 通常没有 systemd
|
|
61
76
|
*/
|
|
62
77
|
async function manageWithServiceManager(command) {
|
|
78
|
+
// 如果在 Docker 环境中,直接返回 null,让上层回退到脚本方式
|
|
79
|
+
if (isDockerEnvironment()) {
|
|
80
|
+
console.log('[OpenClawControl] 检测到 Docker 环境,跳过 ServiceManager,使用脚本方式');
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
63
84
|
const serviceMgr = new ServiceManager('openclaw-gateway', 'OpenClaw Gateway');
|
|
64
85
|
|
|
65
86
|
try {
|