@openagents-org/agent-launcher 0.2.15 → 0.2.17
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 +1 -1
- package/src/daemon.js +14 -8
package/package.json
CHANGED
package/src/daemon.js
CHANGED
|
@@ -209,14 +209,13 @@ class Daemon {
|
|
|
209
209
|
}
|
|
210
210
|
} catch {}
|
|
211
211
|
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// Busy-wait 500ms (sync, used only in CLI stop command)
|
|
212
|
+
// Always clean up PID and status files after kill attempt
|
|
213
|
+
try { fs.unlinkSync(pidFile); } catch {}
|
|
214
|
+
try { fs.unlinkSync(statusFile); } catch {}
|
|
215
|
+
|
|
216
|
+
// Wait briefly for process to die
|
|
217
|
+
for (let i = 0; i < 5; i++) {
|
|
218
|
+
if (!Daemon._isAlive(pid)) return true;
|
|
220
219
|
execSync(IS_WINDOWS ? 'ping -n 2 127.0.0.1 >nul' : 'sleep 0.5', {
|
|
221
220
|
stdio: 'ignore', timeout: 5000,
|
|
222
221
|
});
|
|
@@ -570,11 +569,18 @@ class Daemon {
|
|
|
570
569
|
const cmd = line.trim();
|
|
571
570
|
if (cmd.startsWith('stop:')) {
|
|
572
571
|
const agentName = cmd.slice(5).trim();
|
|
572
|
+
this._log(`Command: stop ${agentName}`);
|
|
573
573
|
this.stopAgent(agentName);
|
|
574
|
+
} else if (cmd.startsWith('start:')) {
|
|
575
|
+
const agentName = cmd.slice(6).trim();
|
|
576
|
+
this._log(`Command: start ${agentName}`);
|
|
577
|
+
this.restartAgent(agentName);
|
|
574
578
|
} else if (cmd.startsWith('restart:')) {
|
|
575
579
|
const agentName = cmd.slice(8).trim();
|
|
580
|
+
this._log(`Command: restart ${agentName}`);
|
|
576
581
|
this.restartAgent(agentName);
|
|
577
582
|
} else if (cmd === 'reload') {
|
|
583
|
+
this._log('Command: reload');
|
|
578
584
|
this._reload();
|
|
579
585
|
}
|
|
580
586
|
}
|