@openagents-org/agent-launcher 0.2.146 → 0.2.147
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/cli.js +15 -0
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -103,6 +103,19 @@ async function cmdDown(connector) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
async function cmdRestart(connector, flags) {
|
|
107
|
+
// Stop then start. stopDaemon() already SIGTERM/SIGKILLs and waits for the
|
|
108
|
+
// process to die, but poll getDaemonPid() (which checks liveness) until the
|
|
109
|
+
// pid clears so the singleton guard in cmdUp can't trip on a not-yet-gone
|
|
110
|
+
// daemon and refuse to start.
|
|
111
|
+
const stopped = connector.stopDaemon();
|
|
112
|
+
print(stopped ? 'Daemon stopped' : 'Daemon was not running');
|
|
113
|
+
for (let i = 0; i < 25 && connector.getDaemonPid(); i++) {
|
|
114
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
115
|
+
}
|
|
116
|
+
await cmdUp(connector, flags);
|
|
117
|
+
}
|
|
118
|
+
|
|
106
119
|
async function cmdStatus(connector) {
|
|
107
120
|
const pid = connector.getDaemonPid();
|
|
108
121
|
if (!pid) {
|
|
@@ -720,6 +733,7 @@ async function cmdHelp() {
|
|
|
720
733
|
Commands:
|
|
721
734
|
up [--foreground] Start daemon (background by default)
|
|
722
735
|
down Stop daemon
|
|
736
|
+
restart [--foreground] Restart daemon (down + up)
|
|
723
737
|
status Show agent status
|
|
724
738
|
list List configured agents
|
|
725
739
|
create <name> [--type T] Create a new agent
|
|
@@ -804,6 +818,7 @@ async function main() {
|
|
|
804
818
|
tui: () => { const { run } = require('./tui'); run(); },
|
|
805
819
|
up: () => cmdUp(connector, flags),
|
|
806
820
|
down: () => cmdDown(connector),
|
|
821
|
+
restart: () => cmdRestart(connector, flags),
|
|
807
822
|
status: () => cmdStatus(connector),
|
|
808
823
|
list: () => cmdList(connector),
|
|
809
824
|
create: () => cmdCreate(connector, flags, positional),
|