open-agents-ai 0.187.322 → 0.187.324

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.
Files changed (2) hide show
  1. package/dist/index.js +78 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -299366,8 +299366,56 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
299366
299366
  } else if (arg === "start") {
299367
299367
  const ok2 = await ensureDaemon2();
299368
299368
  renderInfo2(ok2 ? "Daemon started." : "Daemon already running or failed to start.");
299369
+ } else if (arg === "takeover") {
299370
+ try {
299371
+ renderInfo2("Requesting sudo to migrate daemon to current user and restart...");
299372
+ const nodeBin = process.execPath;
299373
+ const { execSync: execSync57 } = await import("node:child_process");
299374
+ let npmRoot = "";
299375
+ try {
299376
+ npmRoot = execSync57("npm root -g", { encoding: "utf8" }).trim();
299377
+ } catch {
299378
+ }
299379
+ const launcher = npmRoot ? `${npmRoot}/open-agents-ai/dist/launcher.cjs` : "";
299380
+ const svc = [
299381
+ "[Unit]",
299382
+ "Description=Open Agents API Daemon",
299383
+ "After=default.target",
299384
+ "",
299385
+ "[Service]",
299386
+ "Type=simple",
299387
+ `ExecStart=${nodeBin} ${launcher} serve --daemon --quiet`,
299388
+ `WorkingDirectory=${process.cwd()}`,
299389
+ "Restart=always",
299390
+ "RestartSec=2",
299391
+ "Environment=OA_DAEMON=1",
299392
+ "",
299393
+ "[Install]",
299394
+ "WantedBy=default.target",
299395
+ ""
299396
+ ].join("\n").replace(/[$`]/g, "\\$&");
299397
+ const takeover = `set -e
299398
+ sudo -v
299399
+ sudo systemctl disable --now open-agents-daemon.service || true
299400
+ sudo pkill -f 'open-agents-ai.*serve' || true
299401
+ mkdir -p "$HOME/.config/systemd/user"
299402
+ printf '%s' "${svc}" > "$HOME/.config/systemd/user/open-agents-daemon.service"
299403
+ systemctl --user daemon-reload || true
299404
+ systemctl --user enable --now open-agents-daemon.service || true
299405
+ sleep 1
299406
+ `;
299407
+ const { spawn: spawn27 } = await import("node:child_process");
299408
+ await new Promise((resolve40) => {
299409
+ const child = spawn27("bash", ["-lc", takeover], { stdio: "inherit" });
299410
+ child.on("exit", () => resolve40());
299411
+ });
299412
+ renderInfo2("Daemon takeover complete.");
299413
+ } catch (e2) {
299414
+ renderError2(`Takeover failed: ${e2?.message || e2}`);
299415
+ }
299416
+ return "handled";
299369
299417
  } else {
299370
- renderInfo2("Usage: /daemon [status|start|stop|restart]");
299418
+ renderInfo2("Usage: /daemon [status|start|stop|restart|takeover]");
299371
299419
  }
299372
299420
  return "handled";
299373
299421
  }
@@ -299465,7 +299513,31 @@ The session corrections MUST become hard rules in the SKILL.md Rules section.`;
299465
299513
  }
299466
299514
  const rem = Array.isArray(j.procs_after) ? j.procs_after.length : 0;
299467
299515
  if (rem > 0) {
299468
- renderWarning2(`Remaining matched processes: ${rem}`);
299516
+ renderWarning2(`Remaining matched processes: ${rem}. Escalating with sudo...`);
299517
+ const script = `set -e
299518
+ sudo -v
299519
+ sudo bash -lc 'systemctl disable --now "oa-*".timer 2>/dev/null || true'
299520
+ sudo bash -lc 'systemctl disable --now "oa-*".service 2>/dev/null || true'
299521
+ sudo bash -lc 'crontab -l 2>/dev/null | sed "/OPEN-AGENTS-SCHEDULED/d" | crontab -' || true
299522
+ sudo pkill -f 'OPEN-AGENTS-SCHEDULED|oa-sched-|nexus|ollama' || true
299523
+ sleep 1
299524
+ `;
299525
+ try {
299526
+ const { spawn: spawn27 } = await import("node:child_process");
299527
+ await new Promise((resolve40) => {
299528
+ const c7 = spawn27("bash", ["-lc", script], { stdio: "inherit" });
299529
+ c7.on("exit", () => resolve40());
299530
+ });
299531
+ } catch {
299532
+ }
299533
+ try {
299534
+ const r22 = await doFetch("/v1/scheduled/kill", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({}) });
299535
+ const j2 = await r22.json();
299536
+ const rem2 = Array.isArray(j2.procs_after) ? j2.procs_after.length : 0;
299537
+ if (rem2 > 0) renderWarning2(`Remaining after escalation: ${rem2}`);
299538
+ else renderInfo2("No remaining matched processes after escalation.");
299539
+ } catch {
299540
+ }
299469
299541
  } else {
299470
299542
  renderInfo2("No remaining matched processes.");
299471
299543
  }
@@ -305380,6 +305452,10 @@ var init_render2 = __esm({
305380
305452
  ["/expose stop --libp2p", "Stop libp2p gateway only"],
305381
305453
  ["/access", "Show access policy and host binding"],
305382
305454
  ["/access <loopback|lan|any>", "Set access policy (OA_ACCESS) and restart daemon"],
305455
+ ["/scheduler", "Scheduled tasks control panel (list/kill/toggle)"],
305456
+ ["/scheduler menu", "Interactive scheduler menu (toggle/kill)"],
305457
+ ["/scheduler list", "List all scheduled tasks and timers"],
305458
+ ["/scheduler kill", "Kill schedulers + active runs (with escalation if needed)"],
305383
305459
  ["/host <host[:port]>", "Set bind host:port (OA_HOST) and restart daemon"],
305384
305460
  ["/network config", "Interactive network access menu"],
305385
305461
  ["/p2p start", "Join the P2P agent mesh network"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.322",
3
+ "version": "0.187.324",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",