@rethinkingstudio/clawpilot 1.1.10 → 1.1.11
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/README.md +38 -8
- package/dist/commands/install.d.ts +0 -2
- package/dist/commands/install.js +66 -97
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/pair.d.ts +1 -0
- package/dist/commands/pair.js +12 -3
- package/dist/commands/pair.js.map +1 -1
- package/dist/commands/status.js +19 -29
- package/dist/commands/status.js.map +1 -1
- package/dist/i18n/index.js +30 -24
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/platform/service-manager.d.ts +25 -0
- package/dist/platform/service-manager.js +426 -0
- package/dist/platform/service-manager.js.map +1 -0
- package/package.json +1 -1
- package/src/commands/install.ts +73 -100
- package/src/commands/pair.ts +12 -3
- package/src/commands/status.ts +20 -30
- package/src/i18n/index.ts +30 -24
- package/src/index.ts +10 -10
- package/src/platform/service-manager.ts +464 -0
package/dist/index.js
CHANGED
|
@@ -11,13 +11,14 @@ const { version } = require("../package.json");
|
|
|
11
11
|
const program = new Command();
|
|
12
12
|
program
|
|
13
13
|
.name("clawpilot")
|
|
14
|
-
.description("ClawPilot relay client — connects
|
|
14
|
+
.description("ClawPilot relay client — connects OpenClaw gateway hosts to the cloud relay server")
|
|
15
15
|
.version(version);
|
|
16
16
|
program
|
|
17
17
|
.command("pair")
|
|
18
18
|
.description("Register with relay server and display QR code for iOS pairing")
|
|
19
19
|
.option("-s, --server <url>", "Relay server URL", "https://clawpilot.codeaddict.cn")
|
|
20
|
-
.option("-n, --name <name>", "Display name for this
|
|
20
|
+
.option("-n, --name <name>", "Display name for this host")
|
|
21
|
+
.option("--code-only", "Print only the access code and skip QR code output", false)
|
|
21
22
|
.action(async (opts) => {
|
|
22
23
|
try {
|
|
23
24
|
await pairCommand(opts);
|
|
@@ -29,7 +30,7 @@ program
|
|
|
29
30
|
});
|
|
30
31
|
program
|
|
31
32
|
.command("run")
|
|
32
|
-
.description("Run relay client in foreground (used by
|
|
33
|
+
.description("Run relay client in foreground (used by the background service manager)")
|
|
33
34
|
.action(async () => {
|
|
34
35
|
try {
|
|
35
36
|
await runCommand();
|
|
@@ -41,31 +42,31 @@ program
|
|
|
41
42
|
});
|
|
42
43
|
program
|
|
43
44
|
.command("stop")
|
|
44
|
-
.description("Stop relay client
|
|
45
|
+
.description("Stop relay client background service")
|
|
45
46
|
.action(() => {
|
|
46
47
|
stopCommand();
|
|
47
48
|
});
|
|
48
49
|
program
|
|
49
50
|
.command("status")
|
|
50
|
-
.description("Show pairing config, gateway URL, and
|
|
51
|
+
.description("Show pairing config, gateway URL, and background service status")
|
|
51
52
|
.action(() => {
|
|
52
53
|
statusCommand();
|
|
53
54
|
});
|
|
54
55
|
program
|
|
55
56
|
.command("install")
|
|
56
|
-
.description("Register as a
|
|
57
|
+
.description("Register as a background service (launchd on macOS, systemd --user on Linux)")
|
|
57
58
|
.action(() => {
|
|
58
59
|
installCommand();
|
|
59
60
|
});
|
|
60
61
|
program
|
|
61
62
|
.command("restart")
|
|
62
|
-
.description("Restart the relay
|
|
63
|
+
.description("Restart the relay background service")
|
|
63
64
|
.action(() => {
|
|
64
65
|
restartCommand();
|
|
65
66
|
});
|
|
66
67
|
program
|
|
67
68
|
.command("uninstall")
|
|
68
|
-
.description("Remove
|
|
69
|
+
.description("Remove background service")
|
|
69
70
|
.action(() => {
|
|
70
71
|
uninstallCommand();
|
|
71
72
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM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25 @@
|
|
|
1
|
+
export type ServicePlatform = "macos" | "linux" | "unsupported";
|
|
2
|
+
export interface ServiceStatus {
|
|
3
|
+
platform: ServicePlatform;
|
|
4
|
+
installed: boolean;
|
|
5
|
+
running: boolean;
|
|
6
|
+
serviceName: string;
|
|
7
|
+
manager: string;
|
|
8
|
+
servicePath?: string;
|
|
9
|
+
logPath: string;
|
|
10
|
+
startHint?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getServicePlatform(): ServicePlatform;
|
|
13
|
+
export declare function installService(): boolean;
|
|
14
|
+
export declare function restartService(): boolean;
|
|
15
|
+
export declare function stopService(): boolean;
|
|
16
|
+
export declare function uninstallService(): boolean;
|
|
17
|
+
export declare function getServiceStatus(): ServiceStatus;
|
|
18
|
+
export declare const servicePaths: {
|
|
19
|
+
logPath: string;
|
|
20
|
+
errorLogPath: string;
|
|
21
|
+
macPlistPath: string;
|
|
22
|
+
linuxServicePath: string;
|
|
23
|
+
linuxNohupPidPath: string;
|
|
24
|
+
linuxNohupStartScriptPath: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "fs";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { homedir } from "os";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
const MAC_LABEL = "com.rethinkingstudio.clawpilot";
|
|
6
|
+
const MAC_LABEL_OLD = "com.rethinkingstudio.clawai";
|
|
7
|
+
const MAC_PLIST_DIR = join(homedir(), "Library", "LaunchAgents");
|
|
8
|
+
const MAC_PLIST_PATH = join(MAC_PLIST_DIR, `${MAC_LABEL}.plist`);
|
|
9
|
+
const MAC_PLIST_PATH_OLD = join(MAC_PLIST_DIR, `${MAC_LABEL_OLD}.plist`);
|
|
10
|
+
const LINUX_SERVICE_NAME = "clawpilot.service";
|
|
11
|
+
const LINUX_SYSTEMD_USER_DIR = join(homedir(), ".config", "systemd", "user");
|
|
12
|
+
const LINUX_SERVICE_PATH = join(LINUX_SYSTEMD_USER_DIR, LINUX_SERVICE_NAME);
|
|
13
|
+
const LOG_DIR = join(homedir(), ".clawai");
|
|
14
|
+
const LOG_PATH = join(LOG_DIR, "clawpilot.log");
|
|
15
|
+
const ERROR_LOG_PATH = join(LOG_DIR, "clawpilot-error.log");
|
|
16
|
+
const LINUX_NOHUP_PID_PATH = join(LOG_DIR, "clawpilot.pid");
|
|
17
|
+
const LINUX_NOHUP_START_SCRIPT_PATH = join(LOG_DIR, "clawpilot-start.sh");
|
|
18
|
+
function detectPlatform() {
|
|
19
|
+
if (process.platform === "darwin")
|
|
20
|
+
return "macos";
|
|
21
|
+
if (process.platform === "linux")
|
|
22
|
+
return "linux";
|
|
23
|
+
return "unsupported";
|
|
24
|
+
}
|
|
25
|
+
function shellEscape(arg) {
|
|
26
|
+
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
27
|
+
}
|
|
28
|
+
function run(command, stdio = "pipe") {
|
|
29
|
+
execSync(command, { stdio });
|
|
30
|
+
}
|
|
31
|
+
function commandExists(command) {
|
|
32
|
+
try {
|
|
33
|
+
run(`command -v ${command}`, "pipe");
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function getProgramArgs() {
|
|
41
|
+
const nodeBin = process.execPath;
|
|
42
|
+
const scriptPath = process.argv[1];
|
|
43
|
+
return nodeBin === scriptPath ? [scriptPath, "run"] : [nodeBin, scriptPath, "run"];
|
|
44
|
+
}
|
|
45
|
+
function ensureLogDir() {
|
|
46
|
+
mkdirSync(LOG_DIR, { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
function canUseSystemdUser() {
|
|
49
|
+
if (!commandExists("systemctl"))
|
|
50
|
+
return false;
|
|
51
|
+
try {
|
|
52
|
+
run("systemctl --user show-environment", "pipe");
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function isPidRunning(pid) {
|
|
60
|
+
try {
|
|
61
|
+
process.kill(pid, 0);
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function readNohupPid() {
|
|
69
|
+
if (!existsSync(LINUX_NOHUP_PID_PATH))
|
|
70
|
+
return null;
|
|
71
|
+
try {
|
|
72
|
+
const raw = readFileSync(LINUX_NOHUP_PID_PATH, "utf-8").trim();
|
|
73
|
+
const pid = Number(raw);
|
|
74
|
+
return Number.isInteger(pid) && pid > 0 ? pid : null;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function removeNohupPidFile() {
|
|
81
|
+
if (existsSync(LINUX_NOHUP_PID_PATH)) {
|
|
82
|
+
unlinkSync(LINUX_NOHUP_PID_PATH);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function getNohupStartCommand() {
|
|
86
|
+
return `bash ${shellEscape(LINUX_NOHUP_START_SCRIPT_PATH)}`;
|
|
87
|
+
}
|
|
88
|
+
function writeLinuxNohupStartScript() {
|
|
89
|
+
const args = getProgramArgs().map(shellEscape).join(" ");
|
|
90
|
+
const script = `#!/usr/bin/env bash
|
|
91
|
+
set -euo pipefail
|
|
92
|
+
|
|
93
|
+
mkdir -p ${shellEscape(LOG_DIR)}
|
|
94
|
+
if [ -f ${shellEscape(LINUX_NOHUP_PID_PATH)} ]; then
|
|
95
|
+
pid="$(cat ${shellEscape(LINUX_NOHUP_PID_PATH)} 2>/dev/null || true)"
|
|
96
|
+
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then
|
|
97
|
+
echo "clawpilot is already running (pid=$pid)"
|
|
98
|
+
exit 0
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
nohup ${args} >> ${shellEscape(LOG_PATH)} 2>> ${shellEscape(ERROR_LOG_PATH)} < /dev/null &
|
|
103
|
+
echo $! > ${shellEscape(LINUX_NOHUP_PID_PATH)}
|
|
104
|
+
echo "clawpilot started in nohup mode (pid=$(cat ${shellEscape(LINUX_NOHUP_PID_PATH)}))"
|
|
105
|
+
`;
|
|
106
|
+
writeFileSync(LINUX_NOHUP_START_SCRIPT_PATH, script, { encoding: "utf-8", mode: 0o755 });
|
|
107
|
+
}
|
|
108
|
+
function installMacService() {
|
|
109
|
+
const argsXml = getProgramArgs().map((arg) => ` <string>${arg}</string>`).join("\n");
|
|
110
|
+
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
111
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
|
112
|
+
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
113
|
+
<plist version="1.0">
|
|
114
|
+
<dict>
|
|
115
|
+
<key>Label</key>
|
|
116
|
+
<string>${MAC_LABEL}</string>
|
|
117
|
+
<key>ProgramArguments</key>
|
|
118
|
+
<array>
|
|
119
|
+
${argsXml}
|
|
120
|
+
</array>
|
|
121
|
+
<key>RunAtLoad</key>
|
|
122
|
+
<true/>
|
|
123
|
+
<key>KeepAlive</key>
|
|
124
|
+
<true/>
|
|
125
|
+
<key>StandardOutPath</key>
|
|
126
|
+
<string>${LOG_PATH}</string>
|
|
127
|
+
<key>StandardErrorPath</key>
|
|
128
|
+
<string>${ERROR_LOG_PATH}</string>
|
|
129
|
+
</dict>
|
|
130
|
+
</plist>`;
|
|
131
|
+
mkdirSync(MAC_PLIST_DIR, { recursive: true });
|
|
132
|
+
ensureLogDir();
|
|
133
|
+
try {
|
|
134
|
+
run(`launchctl unload -w "${MAC_PLIST_PATH}"`);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Ignore if not loaded.
|
|
138
|
+
}
|
|
139
|
+
writeFileSync(MAC_PLIST_PATH, plistContent, "utf-8");
|
|
140
|
+
try {
|
|
141
|
+
run(`launchctl load -w "${MAC_PLIST_PATH}"`, "inherit");
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function installLinuxServiceSystemd() {
|
|
149
|
+
mkdirSync(LINUX_SYSTEMD_USER_DIR, { recursive: true });
|
|
150
|
+
ensureLogDir();
|
|
151
|
+
const args = getProgramArgs().map(shellEscape).join(" ");
|
|
152
|
+
const serviceContent = `[Unit]
|
|
153
|
+
Description=ClawPilot relay client
|
|
154
|
+
After=network-online.target
|
|
155
|
+
Wants=network-online.target
|
|
156
|
+
|
|
157
|
+
[Service]
|
|
158
|
+
Type=simple
|
|
159
|
+
ExecStart=${args}
|
|
160
|
+
Restart=always
|
|
161
|
+
RestartSec=5
|
|
162
|
+
WorkingDirectory=${shellEscape(process.cwd())}
|
|
163
|
+
StandardOutput=append:${LOG_PATH}
|
|
164
|
+
StandardError=append:${ERROR_LOG_PATH}
|
|
165
|
+
|
|
166
|
+
[Install]
|
|
167
|
+
WantedBy=default.target
|
|
168
|
+
`;
|
|
169
|
+
writeFileSync(LINUX_SERVICE_PATH, serviceContent, "utf-8");
|
|
170
|
+
run("systemctl --user daemon-reload", "inherit");
|
|
171
|
+
run(`systemctl --user enable --now ${LINUX_SERVICE_NAME}`, "inherit");
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
function installLinuxServiceNohup() {
|
|
175
|
+
ensureLogDir();
|
|
176
|
+
writeLinuxNohupStartScript();
|
|
177
|
+
run(`sh -lc ${shellEscape(getNohupStartCommand())}`, "inherit");
|
|
178
|
+
const pid = readNohupPid();
|
|
179
|
+
return pid != null && isPidRunning(pid);
|
|
180
|
+
}
|
|
181
|
+
function installLinuxService() {
|
|
182
|
+
if (canUseSystemdUser()) {
|
|
183
|
+
try {
|
|
184
|
+
return installLinuxServiceSystemd();
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
// Fall back to nohup below.
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return installLinuxServiceNohup();
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function uninstallMacArtifacts() {
|
|
198
|
+
let changed = false;
|
|
199
|
+
try {
|
|
200
|
+
run(`launchctl unload -w "${MAC_PLIST_PATH}"`);
|
|
201
|
+
changed = true;
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// ignore
|
|
205
|
+
}
|
|
206
|
+
if (existsSync(MAC_PLIST_PATH)) {
|
|
207
|
+
unlinkSync(MAC_PLIST_PATH);
|
|
208
|
+
changed = true;
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
run(`launchctl unload -w "${MAC_PLIST_PATH_OLD}"`);
|
|
212
|
+
changed = true;
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// ignore
|
|
216
|
+
}
|
|
217
|
+
if (existsSync(MAC_PLIST_PATH_OLD)) {
|
|
218
|
+
unlinkSync(MAC_PLIST_PATH_OLD);
|
|
219
|
+
changed = true;
|
|
220
|
+
}
|
|
221
|
+
return changed;
|
|
222
|
+
}
|
|
223
|
+
function uninstallLinuxArtifacts(removeFile) {
|
|
224
|
+
let changed = false;
|
|
225
|
+
if (canUseSystemdUser()) {
|
|
226
|
+
try {
|
|
227
|
+
run(`systemctl --user stop ${LINUX_SERVICE_NAME}`);
|
|
228
|
+
changed = true;
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
// ignore
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
run(`systemctl --user disable ${LINUX_SERVICE_NAME}`);
|
|
235
|
+
changed = true;
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
// ignore
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
run("systemctl --user daemon-reload");
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// ignore
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const nohupPid = readNohupPid();
|
|
248
|
+
if (nohupPid != null) {
|
|
249
|
+
try {
|
|
250
|
+
process.kill(nohupPid, "SIGTERM");
|
|
251
|
+
changed = true;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
// ignore
|
|
255
|
+
}
|
|
256
|
+
removeNohupPidFile();
|
|
257
|
+
changed = true;
|
|
258
|
+
}
|
|
259
|
+
if (removeFile && existsSync(LINUX_SERVICE_PATH)) {
|
|
260
|
+
unlinkSync(LINUX_SERVICE_PATH);
|
|
261
|
+
changed = true;
|
|
262
|
+
}
|
|
263
|
+
if (removeFile && existsSync(LINUX_NOHUP_START_SCRIPT_PATH)) {
|
|
264
|
+
unlinkSync(LINUX_NOHUP_START_SCRIPT_PATH);
|
|
265
|
+
changed = true;
|
|
266
|
+
}
|
|
267
|
+
return changed;
|
|
268
|
+
}
|
|
269
|
+
function restartMacService() {
|
|
270
|
+
return installMacService();
|
|
271
|
+
}
|
|
272
|
+
function restartLinuxService() {
|
|
273
|
+
if (canUseSystemdUser() && existsSync(LINUX_SERVICE_PATH)) {
|
|
274
|
+
try {
|
|
275
|
+
run("systemctl --user daemon-reload", "inherit");
|
|
276
|
+
run(`systemctl --user restart ${LINUX_SERVICE_NAME}`, "inherit");
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
// Fall back to nohup restart below.
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
uninstallLinuxArtifacts(false);
|
|
284
|
+
try {
|
|
285
|
+
return installLinuxServiceNohup();
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
export function getServicePlatform() {
|
|
292
|
+
return detectPlatform();
|
|
293
|
+
}
|
|
294
|
+
export function installService() {
|
|
295
|
+
switch (detectPlatform()) {
|
|
296
|
+
case "macos":
|
|
297
|
+
return installMacService();
|
|
298
|
+
case "linux":
|
|
299
|
+
return installLinuxService();
|
|
300
|
+
default:
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
export function restartService() {
|
|
305
|
+
switch (detectPlatform()) {
|
|
306
|
+
case "macos":
|
|
307
|
+
return restartMacService();
|
|
308
|
+
case "linux":
|
|
309
|
+
return restartLinuxService();
|
|
310
|
+
default:
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export function stopService() {
|
|
315
|
+
switch (detectPlatform()) {
|
|
316
|
+
case "macos":
|
|
317
|
+
return uninstallMacArtifacts();
|
|
318
|
+
case "linux":
|
|
319
|
+
return uninstallLinuxArtifacts(false);
|
|
320
|
+
default:
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
export function uninstallService() {
|
|
325
|
+
switch (detectPlatform()) {
|
|
326
|
+
case "macos":
|
|
327
|
+
return uninstallMacArtifacts();
|
|
328
|
+
case "linux":
|
|
329
|
+
return uninstallLinuxArtifacts(true);
|
|
330
|
+
default:
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
export function getServiceStatus() {
|
|
335
|
+
const platform = detectPlatform();
|
|
336
|
+
if (platform === "macos") {
|
|
337
|
+
let running = false;
|
|
338
|
+
try {
|
|
339
|
+
run(`launchctl list ${MAC_LABEL}`);
|
|
340
|
+
running = true;
|
|
341
|
+
}
|
|
342
|
+
catch {
|
|
343
|
+
running = false;
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
platform,
|
|
347
|
+
installed: existsSync(MAC_PLIST_PATH),
|
|
348
|
+
running,
|
|
349
|
+
serviceName: MAC_LABEL,
|
|
350
|
+
manager: "launchd",
|
|
351
|
+
servicePath: MAC_PLIST_PATH,
|
|
352
|
+
logPath: LOG_PATH,
|
|
353
|
+
startHint: `launchctl start ${MAC_LABEL}`,
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
if (platform === "linux") {
|
|
357
|
+
const pid = readNohupPid();
|
|
358
|
+
const hasNohupArtifacts = pid != null || existsSync(LINUX_NOHUP_START_SCRIPT_PATH);
|
|
359
|
+
const running = pid != null && isPidRunning(pid);
|
|
360
|
+
if (!running && pid != null) {
|
|
361
|
+
removeNohupPidFile();
|
|
362
|
+
}
|
|
363
|
+
if (running || (hasNohupArtifacts && !canUseSystemdUser())) {
|
|
364
|
+
return {
|
|
365
|
+
platform,
|
|
366
|
+
installed: hasNohupArtifacts,
|
|
367
|
+
running,
|
|
368
|
+
serviceName: "clawpilot (nohup)",
|
|
369
|
+
manager: "nohup",
|
|
370
|
+
servicePath: existsSync(LINUX_NOHUP_START_SCRIPT_PATH) ? LINUX_NOHUP_START_SCRIPT_PATH : undefined,
|
|
371
|
+
logPath: LOG_PATH,
|
|
372
|
+
startHint: getNohupStartCommand(),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const hasSystemdServiceFile = existsSync(LINUX_SERVICE_PATH);
|
|
376
|
+
if (hasSystemdServiceFile) {
|
|
377
|
+
let systemdRunning = false;
|
|
378
|
+
if (canUseSystemdUser()) {
|
|
379
|
+
try {
|
|
380
|
+
run(`systemctl --user is-active --quiet ${LINUX_SERVICE_NAME}`);
|
|
381
|
+
systemdRunning = true;
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
systemdRunning = false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
platform,
|
|
389
|
+
installed: true,
|
|
390
|
+
running: systemdRunning,
|
|
391
|
+
serviceName: LINUX_SERVICE_NAME,
|
|
392
|
+
manager: "systemd",
|
|
393
|
+
servicePath: LINUX_SERVICE_PATH,
|
|
394
|
+
logPath: LOG_PATH,
|
|
395
|
+
startHint: `systemctl --user start ${LINUX_SERVICE_NAME}`,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
return {
|
|
399
|
+
platform,
|
|
400
|
+
installed: hasNohupArtifacts,
|
|
401
|
+
running,
|
|
402
|
+
serviceName: "clawpilot (nohup)",
|
|
403
|
+
manager: "nohup",
|
|
404
|
+
servicePath: existsSync(LINUX_NOHUP_START_SCRIPT_PATH) ? LINUX_NOHUP_START_SCRIPT_PATH : undefined,
|
|
405
|
+
logPath: LOG_PATH,
|
|
406
|
+
startHint: getNohupStartCommand(),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
platform,
|
|
411
|
+
installed: false,
|
|
412
|
+
running: false,
|
|
413
|
+
serviceName: "",
|
|
414
|
+
manager: "unsupported",
|
|
415
|
+
logPath: LOG_PATH,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
export const servicePaths = {
|
|
419
|
+
logPath: LOG_PATH,
|
|
420
|
+
errorLogPath: ERROR_LOG_PATH,
|
|
421
|
+
macPlistPath: MAC_PLIST_PATH,
|
|
422
|
+
linuxServicePath: LINUX_SERVICE_PATH,
|
|
423
|
+
linuxNohupPidPath: LINUX_NOHUP_PID_PATH,
|
|
424
|
+
linuxNohupStartScriptPath: LINUX_NOHUP_START_SCRIPT_PATH,
|
|
425
|
+
};
|
|
426
|
+
//# sourceMappingURL=service-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-manager.js","sourceRoot":"","sources":["../../src/platform/service-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAe5B,MAAM,SAAS,GAAG,gCAAgC,CAAC;AACnD,MAAM,aAAa,GAAG,6BAA6B,CA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