claw-subagent-service 0.0.136 → 0.0.137
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
package/scripts/post-install.js
CHANGED
|
@@ -37,7 +37,45 @@ function isWindowsAdmin() {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function fixShellScriptLineEndings() {
|
|
41
|
+
if (process.platform === 'win32') return;
|
|
42
|
+
|
|
43
|
+
const fs = require('fs');
|
|
44
|
+
const path = require('path');
|
|
45
|
+
const scriptDir = path.join(__dirname, '..', 'command', 'linux');
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
if (!fs.existsSync(scriptDir)) return;
|
|
49
|
+
const files = fs.readdirSync(scriptDir);
|
|
50
|
+
let fixedCount = 0;
|
|
51
|
+
|
|
52
|
+
for (const file of files) {
|
|
53
|
+
if (!file.endsWith('.sh')) continue;
|
|
54
|
+
const filePath = path.join(scriptDir, file);
|
|
55
|
+
try {
|
|
56
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
57
|
+
if (content.includes('\r\n')) {
|
|
58
|
+
fs.writeFileSync(filePath, content.replace(/\r\n/g, '\n'));
|
|
59
|
+
fixedCount++;
|
|
60
|
+
console.log(`[postinstall] 已修复 ${file} 换行符(CRLF → LF)`);
|
|
61
|
+
}
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.warn(`[postinstall] 修复 ${file} 失败: ${e.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (fixedCount > 0) {
|
|
68
|
+
console.log(`[postinstall] 共修复 ${fixedCount} 个脚本换行符`);
|
|
69
|
+
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.warn(`[postinstall] 修复换行符失败: ${e.message}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
40
75
|
function installAndStartService() {
|
|
76
|
+
// 先修复 Linux 脚本的换行符
|
|
77
|
+
fixShellScriptLineEndings();
|
|
78
|
+
|
|
41
79
|
if (process.platform !== 'win32') {
|
|
42
80
|
console.log(`[postinstall] 跳过(非 Windows: ${process.platform})`);
|
|
43
81
|
return;
|
|
@@ -128,6 +128,12 @@ async function manageWithServiceManager(command) {
|
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
// 强制 Docker 模式:通过环境变量强制使用脚本方式(用于自动检测失败的情况)
|
|
132
|
+
if (process.env.FORCE_DOCKER_MODE === 'true' || process.env.FORCE_DOCKER_MODE === '1') {
|
|
133
|
+
console.log('[OpenClawControl] FORCE_DOCKER_MODE 已设置,跳过 ServiceManager,使用脚本方式');
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
131
137
|
const serviceMgr = new ServiceManager('openclaw-gateway', 'OpenClaw Gateway');
|
|
132
138
|
|
|
133
139
|
try {
|