open-agents-ai 0.103.56 → 0.103.58
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 +100 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33562,8 +33562,84 @@ async function handleSlashCommand(input, ctx) {
|
|
|
33562
33562
|
} else {
|
|
33563
33563
|
renderInfo("No wallet configured. Ask the agent to create one via the nexus tool.");
|
|
33564
33564
|
}
|
|
33565
|
+
} else if (sub === "restart" || sub === "disconnect" || sub === "kill") {
|
|
33566
|
+
const nexusDir = ctx.repoRoot ? __require("node:path").join(ctx.repoRoot, ".oa", "nexus") : null;
|
|
33567
|
+
if (!nexusDir) {
|
|
33568
|
+
renderError("No repo root found \u2014 cannot locate nexus daemon.");
|
|
33569
|
+
return "handled";
|
|
33570
|
+
}
|
|
33571
|
+
const { existsSync: ex, readFileSync: rf, unlinkSync: ul } = __require("node:fs");
|
|
33572
|
+
const path = __require("node:path");
|
|
33573
|
+
const pidFile = path.join(nexusDir, "daemon.pid");
|
|
33574
|
+
let killed = false;
|
|
33575
|
+
if (ex(pidFile)) {
|
|
33576
|
+
try {
|
|
33577
|
+
const pid = parseInt(rf(pidFile, "utf8").trim(), 10);
|
|
33578
|
+
if (pid > 0) {
|
|
33579
|
+
try {
|
|
33580
|
+
process.kill(pid, "SIGTERM");
|
|
33581
|
+
} catch {
|
|
33582
|
+
}
|
|
33583
|
+
await new Promise((r) => setTimeout(r, 1200));
|
|
33584
|
+
try {
|
|
33585
|
+
process.kill(pid, 0);
|
|
33586
|
+
process.kill(pid, "SIGKILL");
|
|
33587
|
+
} catch {
|
|
33588
|
+
}
|
|
33589
|
+
killed = true;
|
|
33590
|
+
process.stdout.write(` ${c2.yellow("\u25CF")} Killed daemon (pid ${pid})
|
|
33591
|
+
`);
|
|
33592
|
+
}
|
|
33593
|
+
} catch {
|
|
33594
|
+
}
|
|
33595
|
+
}
|
|
33596
|
+
for (const f of ["daemon.pid", "status.json", "cmd.json", "resp.json"]) {
|
|
33597
|
+
const fp = path.join(nexusDir, f);
|
|
33598
|
+
try {
|
|
33599
|
+
if (ex(fp))
|
|
33600
|
+
ul(fp);
|
|
33601
|
+
} catch {
|
|
33602
|
+
}
|
|
33603
|
+
}
|
|
33604
|
+
if (rest2 === "--clean" || rest2 === "-c") {
|
|
33605
|
+
const mf = path.join(nexusDir, "metering.jsonl");
|
|
33606
|
+
try {
|
|
33607
|
+
if (ex(mf))
|
|
33608
|
+
ul(mf);
|
|
33609
|
+
} catch {
|
|
33610
|
+
}
|
|
33611
|
+
process.stdout.write(` ${c2.dim("Cleared metering data")}
|
|
33612
|
+
`);
|
|
33613
|
+
}
|
|
33614
|
+
if (!killed) {
|
|
33615
|
+
process.stdout.write(` ${c2.dim("No daemon was running")}
|
|
33616
|
+
`);
|
|
33617
|
+
}
|
|
33618
|
+
if (sub === "restart") {
|
|
33619
|
+
process.stdout.write(` ${c2.dim("Reconnecting...")}
|
|
33620
|
+
`);
|
|
33621
|
+
if (ctx.nexusConnect) {
|
|
33622
|
+
try {
|
|
33623
|
+
const result = await ctx.nexusConnect();
|
|
33624
|
+
process.stdout.write(` ${c2.green("\u25CF")} ${result}
|
|
33625
|
+
`);
|
|
33626
|
+
} catch (e) {
|
|
33627
|
+
renderError(`Reconnect failed: ${e.message || e}`);
|
|
33628
|
+
}
|
|
33629
|
+
} else {
|
|
33630
|
+
renderInfo('Ask the agent to reconnect: "Connect to the nexus network"');
|
|
33631
|
+
}
|
|
33632
|
+
} else {
|
|
33633
|
+
process.stdout.write(` ${c2.dim("Use")} ${c2.cyan("/nexus restart")} ${c2.dim("to kill and reconnect in one step")}
|
|
33634
|
+
`);
|
|
33635
|
+
}
|
|
33636
|
+
process.stdout.write("\n");
|
|
33565
33637
|
} else {
|
|
33566
|
-
renderInfo("Usage: /nexus [status|connect|wallet]");
|
|
33638
|
+
renderInfo("Usage: /nexus [status|connect|restart|disconnect|kill|wallet]");
|
|
33639
|
+
renderInfo(" restart \u2014 kill daemon and reconnect");
|
|
33640
|
+
renderInfo(" restart --clean \u2014 restart + clear metering data");
|
|
33641
|
+
renderInfo(" disconnect \u2014 kill daemon only");
|
|
33642
|
+
renderInfo(" kill \u2014 same as disconnect");
|
|
33567
33643
|
}
|
|
33568
33644
|
return "handled";
|
|
33569
33645
|
}
|
|
@@ -44759,12 +44835,30 @@ var init_status_bar = __esm({
|
|
|
44759
44835
|
capability: "system_metrics",
|
|
44760
44836
|
input: queryData
|
|
44761
44837
|
}, 8e3);
|
|
44762
|
-
|
|
44763
|
-
|
|
44838
|
+
let parsed = raw;
|
|
44839
|
+
try {
|
|
44840
|
+
parsed = JSON.parse(parsed);
|
|
44841
|
+
} catch {
|
|
44842
|
+
}
|
|
44843
|
+
if (typeof parsed === "string") {
|
|
44844
|
+
try {
|
|
44845
|
+
parsed = JSON.parse(parsed);
|
|
44846
|
+
} catch {
|
|
44847
|
+
}
|
|
44848
|
+
}
|
|
44849
|
+
if (parsed && typeof parsed === "object") {
|
|
44764
44850
|
let metricsData = null;
|
|
44765
|
-
if (
|
|
44766
|
-
|
|
44767
|
-
|
|
44851
|
+
if (parsed.result) {
|
|
44852
|
+
let r = parsed.result;
|
|
44853
|
+
if (typeof r === "string") {
|
|
44854
|
+
try {
|
|
44855
|
+
r = JSON.parse(r);
|
|
44856
|
+
} catch {
|
|
44857
|
+
}
|
|
44858
|
+
}
|
|
44859
|
+
metricsData = typeof r === "object" && r?.cpu ? r : null;
|
|
44860
|
+
}
|
|
44861
|
+
if (!metricsData && parsed.cpu) {
|
|
44768
44862
|
metricsData = parsed;
|
|
44769
44863
|
}
|
|
44770
44864
|
if (metricsData?.cpu) {
|
package/package.json
CHANGED