comisai 1.0.7 → 1.0.9
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/node_modules/@comis/agent/package.json +1 -1
- package/node_modules/@comis/channels/package.json +1 -1
- package/node_modules/@comis/cli/dist/commands/daemon.js +31 -6
- package/node_modules/@comis/cli/dist/wizard/steps/11-daemon-start.js +21 -1
- package/node_modules/@comis/cli/package.json +1 -1
- package/node_modules/@comis/core/package.json +1 -1
- package/node_modules/@comis/daemon/package.json +1 -1
- package/node_modules/@comis/gateway/package.json +1 -1
- package/node_modules/@comis/infra/package.json +1 -1
- package/node_modules/@comis/memory/package.json +1 -1
- package/node_modules/@comis/scheduler/package.json +1 -1
- package/node_modules/@comis/shared/package.json +1 -1
- package/node_modules/@comis/skills/package.json +1 -1
- package/package.json +12 -12
|
@@ -190,7 +190,7 @@ async function execSystemctl(manager, ...args) {
|
|
|
190
190
|
// System-scope systemd requires root; escalate via sudo if we're not root
|
|
191
191
|
// eslint-disable-next-line no-restricted-syntax -- CLI bootstrap before SecretManager
|
|
192
192
|
if (manager === "systemd" && process.getuid?.() !== 0) {
|
|
193
|
-
return exec("sudo", ["systemctl", ...fullArgs], { timeout: 15_000 });
|
|
193
|
+
return exec("sudo", ["-n", "systemctl", ...fullArgs], { timeout: 15_000 });
|
|
194
194
|
}
|
|
195
195
|
return exec("systemctl", fullArgs, { timeout: 15_000 });
|
|
196
196
|
}
|
|
@@ -264,13 +264,32 @@ async function handleDaemonStart() {
|
|
|
264
264
|
case "systemd":
|
|
265
265
|
case "systemd-user": {
|
|
266
266
|
if (await isSystemdActive(manager)) {
|
|
267
|
-
|
|
267
|
+
// Verify the CLI can actually talk to the daemon
|
|
268
|
+
try {
|
|
269
|
+
await withClient(async (client) => client.call("system.ping", {}));
|
|
270
|
+
success("Daemon is already running (systemd)");
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
warn("Daemon is running (systemd) but CLI cannot connect");
|
|
274
|
+
if (!existsSync(safePath(os.homedir(), ".comis", "config.yaml"))) {
|
|
275
|
+
info("Run 'comis init' to configure the daemon");
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
info("Try restarting: sudo systemctl restart comis");
|
|
279
|
+
}
|
|
280
|
+
}
|
|
268
281
|
return;
|
|
269
282
|
}
|
|
270
283
|
const scope = manager === "systemd-user" ? "systemd (user scope)" : "systemd";
|
|
271
284
|
info(`Starting daemon via ${scope}...`);
|
|
272
|
-
|
|
273
|
-
|
|
285
|
+
try {
|
|
286
|
+
await execSystemctl(manager, "start", "comis");
|
|
287
|
+
success("Daemon started");
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
error("Cannot start daemon: insufficient permissions");
|
|
291
|
+
info("Run as root: sudo systemctl start comis");
|
|
292
|
+
}
|
|
274
293
|
return;
|
|
275
294
|
}
|
|
276
295
|
case "pm2": {
|
|
@@ -304,8 +323,14 @@ async function handleDaemonStop() {
|
|
|
304
323
|
}
|
|
305
324
|
const scope = manager === "systemd-user" ? "systemd (user scope)" : "systemd";
|
|
306
325
|
info(`Stopping daemon via ${scope}...`);
|
|
307
|
-
|
|
308
|
-
|
|
326
|
+
try {
|
|
327
|
+
await execSystemctl(manager, "stop", "comis");
|
|
328
|
+
success("Daemon stopped");
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
error("Cannot stop daemon: insufficient permissions");
|
|
332
|
+
info("Run as root: sudo systemctl stop comis");
|
|
333
|
+
}
|
|
309
334
|
return;
|
|
310
335
|
}
|
|
311
336
|
case "pm2": {
|
|
@@ -218,7 +218,6 @@ async function restartViaSystemd(manager) {
|
|
|
218
218
|
const args = manager === "systemd-user"
|
|
219
219
|
? ["--user", "restart", "comis"]
|
|
220
220
|
: ["restart", "comis"];
|
|
221
|
-
// System-scope requires root; try sudo for non-root users
|
|
222
221
|
if (manager === "systemd" && process.getuid?.() !== 0) {
|
|
223
222
|
await exec("sudo", ["systemctl", ...args], { timeout: 15_000 });
|
|
224
223
|
}
|
|
@@ -227,6 +226,27 @@ async function restartViaSystemd(manager) {
|
|
|
227
226
|
}
|
|
228
227
|
return true;
|
|
229
228
|
}
|
|
229
|
+
catch {
|
|
230
|
+
// sudo failed (comis user has no sudo) — fall back to SIGUSR2.
|
|
231
|
+
// The daemon traps SIGUSR2 and exits with code 42; systemd respawns
|
|
232
|
+
// it via RestartForceExitStatus=42, picking up the new config.
|
|
233
|
+
return restartViaSigusr2(manager);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
async function restartViaSigusr2(manager) {
|
|
237
|
+
try {
|
|
238
|
+
const pidArgs = manager === "systemd-user"
|
|
239
|
+
? ["--user", "show", "comis", "--property=MainPID", "--value"]
|
|
240
|
+
: ["show", "comis", "--property=MainPID", "--value"];
|
|
241
|
+
const { stdout } = await exec("systemctl", pidArgs, { timeout: 5_000 });
|
|
242
|
+
const pid = Number(stdout.trim());
|
|
243
|
+
if (isNaN(pid) || pid <= 0)
|
|
244
|
+
return false;
|
|
245
|
+
process.kill(pid, "SIGUSR2");
|
|
246
|
+
// Wait for systemd to respawn the process
|
|
247
|
+
await new Promise((r) => setTimeout(r, 3000));
|
|
248
|
+
return true;
|
|
249
|
+
}
|
|
230
250
|
catch {
|
|
231
251
|
return false;
|
|
232
252
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comisai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"author": "Moshe Anconina",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Security-first AI agent platform — connects AI agents to Discord, Telegram, Slack, WhatsApp, and more",
|
|
@@ -115,17 +115,17 @@
|
|
|
115
115
|
"@comis/daemon"
|
|
116
116
|
],
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@comis/shared": "1.0.
|
|
119
|
-
"@comis/core": "1.0.
|
|
120
|
-
"@comis/infra": "1.0.
|
|
121
|
-
"@comis/memory": "1.0.
|
|
122
|
-
"@comis/gateway": "1.0.
|
|
123
|
-
"@comis/skills": "1.0.
|
|
124
|
-
"@comis/scheduler": "1.0.
|
|
125
|
-
"@comis/agent": "1.0.
|
|
126
|
-
"@comis/channels": "1.0.
|
|
127
|
-
"@comis/cli": "1.0.
|
|
128
|
-
"@comis/daemon": "1.0.
|
|
118
|
+
"@comis/shared": "1.0.9",
|
|
119
|
+
"@comis/core": "1.0.9",
|
|
120
|
+
"@comis/infra": "1.0.9",
|
|
121
|
+
"@comis/memory": "1.0.9",
|
|
122
|
+
"@comis/gateway": "1.0.9",
|
|
123
|
+
"@comis/skills": "1.0.9",
|
|
124
|
+
"@comis/scheduler": "1.0.9",
|
|
125
|
+
"@comis/agent": "1.0.9",
|
|
126
|
+
"@comis/channels": "1.0.9",
|
|
127
|
+
"@comis/cli": "1.0.9",
|
|
128
|
+
"@comis/daemon": "1.0.9",
|
|
129
129
|
"@agentclientprotocol/sdk": "^0.15.0",
|
|
130
130
|
"@clack/core": "^1.1.0",
|
|
131
131
|
"@clack/prompts": "^1.1.0",
|