open-agents-ai 0.103.57 → 0.103.59
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/dist/index.js +81 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26645,8 +26645,11 @@ function renderSlashHelp() {
|
|
|
26645
26645
|
["/telegram", "Toggle Telegram bridge on/off (uses saved key)"],
|
|
26646
26646
|
["/telegram status", "Show Telegram bridge status"],
|
|
26647
26647
|
["/telegram stop", "Disconnect Telegram bridge"],
|
|
26648
|
-
["/nexus", "Show nexus P2P network status
|
|
26648
|
+
["/nexus", "Show nexus P2P network status"],
|
|
26649
26649
|
["/nexus connect", "Connect to the agent mesh network"],
|
|
26650
|
+
["/nexus restart", "Kill daemon and reconnect (picks up new version)"],
|
|
26651
|
+
["/nexus restart --clean", "Restart + clear metering data for fresh stats"],
|
|
26652
|
+
["/nexus disconnect", "Kill daemon without reconnecting"],
|
|
26650
26653
|
["/nexus wallet", "Show wallet address and x402 payment status"],
|
|
26651
26654
|
["/expose <backend>", "Expose local inference via libp2p (default)"],
|
|
26652
26655
|
["/expose <backend> --tunnel", "Expose via cloudflared tunnel"],
|
|
@@ -33562,8 +33565,84 @@ async function handleSlashCommand(input, ctx) {
|
|
|
33562
33565
|
} else {
|
|
33563
33566
|
renderInfo("No wallet configured. Ask the agent to create one via the nexus tool.");
|
|
33564
33567
|
}
|
|
33568
|
+
} else if (sub === "restart" || sub === "disconnect" || sub === "kill") {
|
|
33569
|
+
const nexusDir = ctx.repoRoot ? __require("node:path").join(ctx.repoRoot, ".oa", "nexus") : null;
|
|
33570
|
+
if (!nexusDir) {
|
|
33571
|
+
renderError("No repo root found \u2014 cannot locate nexus daemon.");
|
|
33572
|
+
return "handled";
|
|
33573
|
+
}
|
|
33574
|
+
const { existsSync: ex, readFileSync: rf, unlinkSync: ul } = __require("node:fs");
|
|
33575
|
+
const path = __require("node:path");
|
|
33576
|
+
const pidFile = path.join(nexusDir, "daemon.pid");
|
|
33577
|
+
let killed = false;
|
|
33578
|
+
if (ex(pidFile)) {
|
|
33579
|
+
try {
|
|
33580
|
+
const pid = parseInt(rf(pidFile, "utf8").trim(), 10);
|
|
33581
|
+
if (pid > 0) {
|
|
33582
|
+
try {
|
|
33583
|
+
process.kill(pid, "SIGTERM");
|
|
33584
|
+
} catch {
|
|
33585
|
+
}
|
|
33586
|
+
await new Promise((r) => setTimeout(r, 1200));
|
|
33587
|
+
try {
|
|
33588
|
+
process.kill(pid, 0);
|
|
33589
|
+
process.kill(pid, "SIGKILL");
|
|
33590
|
+
} catch {
|
|
33591
|
+
}
|
|
33592
|
+
killed = true;
|
|
33593
|
+
process.stdout.write(` ${c2.yellow("\u25CF")} Killed daemon (pid ${pid})
|
|
33594
|
+
`);
|
|
33595
|
+
}
|
|
33596
|
+
} catch {
|
|
33597
|
+
}
|
|
33598
|
+
}
|
|
33599
|
+
for (const f of ["daemon.pid", "status.json", "cmd.json", "resp.json"]) {
|
|
33600
|
+
const fp = path.join(nexusDir, f);
|
|
33601
|
+
try {
|
|
33602
|
+
if (ex(fp))
|
|
33603
|
+
ul(fp);
|
|
33604
|
+
} catch {
|
|
33605
|
+
}
|
|
33606
|
+
}
|
|
33607
|
+
if (rest2 === "--clean" || rest2 === "-c") {
|
|
33608
|
+
const mf = path.join(nexusDir, "metering.jsonl");
|
|
33609
|
+
try {
|
|
33610
|
+
if (ex(mf))
|
|
33611
|
+
ul(mf);
|
|
33612
|
+
} catch {
|
|
33613
|
+
}
|
|
33614
|
+
process.stdout.write(` ${c2.dim("Cleared metering data")}
|
|
33615
|
+
`);
|
|
33616
|
+
}
|
|
33617
|
+
if (!killed) {
|
|
33618
|
+
process.stdout.write(` ${c2.dim("No daemon was running")}
|
|
33619
|
+
`);
|
|
33620
|
+
}
|
|
33621
|
+
if (sub === "restart") {
|
|
33622
|
+
process.stdout.write(` ${c2.dim("Reconnecting...")}
|
|
33623
|
+
`);
|
|
33624
|
+
if (ctx.nexusConnect) {
|
|
33625
|
+
try {
|
|
33626
|
+
const result = await ctx.nexusConnect();
|
|
33627
|
+
process.stdout.write(` ${c2.green("\u25CF")} ${result}
|
|
33628
|
+
`);
|
|
33629
|
+
} catch (e) {
|
|
33630
|
+
renderError(`Reconnect failed: ${e.message || e}`);
|
|
33631
|
+
}
|
|
33632
|
+
} else {
|
|
33633
|
+
renderInfo('Ask the agent to reconnect: "Connect to the nexus network"');
|
|
33634
|
+
}
|
|
33635
|
+
} else {
|
|
33636
|
+
process.stdout.write(` ${c2.dim("Use")} ${c2.cyan("/nexus restart")} ${c2.dim("to kill and reconnect in one step")}
|
|
33637
|
+
`);
|
|
33638
|
+
}
|
|
33639
|
+
process.stdout.write("\n");
|
|
33565
33640
|
} else {
|
|
33566
|
-
renderInfo("Usage: /nexus [status|connect|wallet]");
|
|
33641
|
+
renderInfo("Usage: /nexus [status|connect|restart|disconnect|kill|wallet]");
|
|
33642
|
+
renderInfo(" restart \u2014 kill daemon and reconnect");
|
|
33643
|
+
renderInfo(" restart --clean \u2014 restart + clear metering data");
|
|
33644
|
+
renderInfo(" disconnect \u2014 kill daemon only");
|
|
33645
|
+
renderInfo(" kill \u2014 same as disconnect");
|
|
33567
33646
|
}
|
|
33568
33647
|
return "handled";
|
|
33569
33648
|
}
|
package/package.json
CHANGED