open-agents-ai 0.186.29 → 0.186.31
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 +102 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49790,47 +49790,90 @@ async function handleSlashCommand(input, ctx) {
|
|
|
49790
49790
|
const rest2 = arg?.slice(sub.length).trim() ?? "";
|
|
49791
49791
|
if (!sub || sub === "status") {
|
|
49792
49792
|
const nexusDir = ctx.repoRoot ? __require("node:path").join(ctx.repoRoot, ".oa", "nexus") : null;
|
|
49793
|
-
const
|
|
49793
|
+
const statusFile = nexusDir ? __require("node:path").join(nexusDir, "status.json") : null;
|
|
49794
49794
|
const { existsSync: ex, readFileSync: rf } = __require("node:fs");
|
|
49795
|
-
if (
|
|
49795
|
+
if (statusFile && ex(statusFile)) {
|
|
49796
49796
|
try {
|
|
49797
|
-
const
|
|
49798
|
-
|
|
49797
|
+
const status = JSON.parse(rf(statusFile, "utf8"));
|
|
49798
|
+
if (status.connected && status.peerId) {
|
|
49799
|
+
process.stdout.write(`
|
|
49799
49800
|
${c2.bold("Nexus Network Status")}
|
|
49800
49801
|
|
|
49801
49802
|
`);
|
|
49802
|
-
|
|
49803
|
+
process.stdout.write(` ${c2.green("\u25CF")} Connected
|
|
49804
|
+
`);
|
|
49805
|
+
process.stdout.write(` Peer ID: ${c2.cyan(status.peerId)}
|
|
49803
49806
|
`);
|
|
49804
|
-
|
|
49807
|
+
process.stdout.write(` Agent: ${status.agentName} (${status.agentType})
|
|
49805
49808
|
`);
|
|
49806
|
-
|
|
49809
|
+
process.stdout.write(` Daemon PID: ${status.pid}
|
|
49807
49810
|
`);
|
|
49808
|
-
|
|
49811
|
+
if (status.rooms?.length)
|
|
49812
|
+
process.stdout.write(` Rooms: ${status.rooms.join(", ")}
|
|
49809
49813
|
`);
|
|
49810
|
-
|
|
49811
|
-
|
|
49812
|
-
|
|
49813
|
-
|
|
49814
|
+
const walletFile = __require("node:path").join(nexusDir, "wallet.enc");
|
|
49815
|
+
if (ex(walletFile)) {
|
|
49816
|
+
try {
|
|
49817
|
+
const w = JSON.parse(rf(walletFile, "utf8"));
|
|
49818
|
+
process.stdout.write(` Wallet: ${c2.yellow(w.address)}
|
|
49814
49819
|
`);
|
|
49820
|
+
} catch {
|
|
49821
|
+
}
|
|
49822
|
+
}
|
|
49823
|
+
process.stdout.write("\n");
|
|
49815
49824
|
} else {
|
|
49816
|
-
process.stdout.write(`
|
|
49825
|
+
process.stdout.write(`
|
|
49826
|
+
${c2.yellow("\u25CF")} Daemon running but not yet connected
|
|
49827
|
+
`);
|
|
49828
|
+
process.stdout.write(` PID: ${status.pid || "?"}
|
|
49829
|
+
|
|
49817
49830
|
`);
|
|
49818
49831
|
}
|
|
49819
|
-
process.stdout.write("\n");
|
|
49820
49832
|
} catch {
|
|
49821
|
-
|
|
49833
|
+
process.stdout.write(`
|
|
49834
|
+
${c2.dim("\u25CF")} Status file unreadable
|
|
49835
|
+
|
|
49836
|
+
`);
|
|
49822
49837
|
}
|
|
49823
49838
|
} else {
|
|
49824
49839
|
process.stdout.write(`
|
|
49825
49840
|
${c2.dim("\u25CF")} Not connected to nexus P2P network
|
|
49826
49841
|
`);
|
|
49827
|
-
process.stdout.write(` ${c2.dim("
|
|
49842
|
+
process.stdout.write(` ${c2.dim("Run")} ${c2.cyan("/nexus connect")} ${c2.dim("to start the daemon.")}
|
|
49828
49843
|
|
|
49829
49844
|
`);
|
|
49830
49845
|
}
|
|
49831
|
-
} else if (sub === "connect") {
|
|
49832
|
-
renderInfo(
|
|
49833
|
-
|
|
49846
|
+
} else if (sub === "connect" || sub === "restart") {
|
|
49847
|
+
renderInfo("Connecting to nexus P2P network...");
|
|
49848
|
+
try {
|
|
49849
|
+
const nexus = new NexusTool(ctx.repoRoot ?? process.cwd());
|
|
49850
|
+
if (sub === "restart") {
|
|
49851
|
+
try {
|
|
49852
|
+
await nexus.execute({ action: "disconnect" });
|
|
49853
|
+
} catch {
|
|
49854
|
+
}
|
|
49855
|
+
await new Promise((r) => setTimeout(r, 1e3));
|
|
49856
|
+
}
|
|
49857
|
+
const result = await nexus.execute({ action: "connect" });
|
|
49858
|
+
const out = typeof result === "object" ? result.output : String(result);
|
|
49859
|
+
if (out.includes("Connected") || out.includes("Already connected")) {
|
|
49860
|
+
renderInfo(out.split("\n").slice(0, 4).join("\n"));
|
|
49861
|
+
try {
|
|
49862
|
+
const pidFile = join60(ctx.repoRoot ?? process.cwd(), ".oa", "nexus", "daemon.pid");
|
|
49863
|
+
if (existsSync44(pidFile)) {
|
|
49864
|
+
const pid = parseInt(readFileSync33(pidFile, "utf8").trim(), 10);
|
|
49865
|
+
if (pid > 0 && !registry.daemons.has("Nexus")) {
|
|
49866
|
+
registry.register({ name: "Nexus", pid, startedAt: Date.now(), status: "running" });
|
|
49867
|
+
}
|
|
49868
|
+
}
|
|
49869
|
+
} catch {
|
|
49870
|
+
}
|
|
49871
|
+
} else {
|
|
49872
|
+
renderWarning(out.slice(0, 200));
|
|
49873
|
+
}
|
|
49874
|
+
} catch (err) {
|
|
49875
|
+
renderError(`Nexus connect failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
49876
|
+
}
|
|
49834
49877
|
} else if (sub === "wallet") {
|
|
49835
49878
|
const nexusDir = ctx.repoRoot ? __require("node:path").join(ctx.repoRoot, ".oa", "nexus") : null;
|
|
49836
49879
|
const walletFile = nexusDir ? __require("node:path").join(nexusDir, "wallet.enc") : null;
|
|
@@ -69138,7 +69181,7 @@ ${historyLines}
|
|
|
69138
69181
|
OA_RUN_USER: req._authUser || "anonymous",
|
|
69139
69182
|
OA_RUN_SCOPE: req._authScope || "admin"
|
|
69140
69183
|
};
|
|
69141
|
-
const child = spawn21(
|
|
69184
|
+
const child = spawn21(process.execPath, [oaBin, ...args], {
|
|
69142
69185
|
cwd: cwdPath,
|
|
69143
69186
|
env: runEnv,
|
|
69144
69187
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -71994,23 +72037,48 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
71994
72037
|
}
|
|
71995
72038
|
try {
|
|
71996
72039
|
const autoNexus = new NexusTool(repoRoot);
|
|
71997
|
-
|
|
71998
|
-
|
|
71999
|
-
|
|
72000
|
-
|
|
72001
|
-
const
|
|
72002
|
-
if (
|
|
72003
|
-
|
|
72004
|
-
|
|
72005
|
-
|
|
72006
|
-
|
|
72040
|
+
const _registerNexusDaemon = () => {
|
|
72041
|
+
try {
|
|
72042
|
+
const nexusPidFile = join75(repoRoot, ".oa", "nexus", "daemon.pid");
|
|
72043
|
+
if (existsSync58(nexusPidFile)) {
|
|
72044
|
+
const nPid = parseInt(readFileSync47(nexusPidFile, "utf8").trim(), 10);
|
|
72045
|
+
if (nPid > 0 && !registry.daemons.has("Nexus")) {
|
|
72046
|
+
registry.register({ name: "Nexus", pid: nPid, startedAt: Date.now(), status: "running" });
|
|
72047
|
+
statusBar.ensureMonitorTimer();
|
|
72048
|
+
}
|
|
72049
|
+
}
|
|
72050
|
+
} catch {
|
|
72051
|
+
}
|
|
72052
|
+
};
|
|
72053
|
+
const _tryNexusConnect = async (attempt) => {
|
|
72054
|
+
try {
|
|
72055
|
+
const r = await autoNexus.execute({ action: "connect" });
|
|
72056
|
+
const out = r.output || String(r);
|
|
72057
|
+
if (out.includes("Connected") || out.includes("Already connected")) {
|
|
72058
|
+
writeContent(() => renderInfo("Nexus P2P network connected."));
|
|
72059
|
+
_registerNexusDaemon();
|
|
72060
|
+
} else if (out.includes("failed") || out.includes("Error")) {
|
|
72061
|
+
if (attempt < 2) {
|
|
72062
|
+
await new Promise((r2) => setTimeout(r2, 5e3));
|
|
72063
|
+
return _tryNexusConnect(attempt + 1);
|
|
72064
|
+
}
|
|
72065
|
+
writeContent(() => renderWarning(`Nexus auto-connect failed: ${out.slice(0, 100)}`));
|
|
72066
|
+
} else if (out.includes("still connecting") || out.includes("spawned")) {
|
|
72067
|
+
for (let i = 0; i < 30; i++) {
|
|
72068
|
+
await new Promise((r2) => setTimeout(r2, 1e3));
|
|
72069
|
+
const sr = await autoNexus.execute({ action: "status" });
|
|
72070
|
+
const so = sr.output || String(sr);
|
|
72071
|
+
if (/Connected:\s*true/i.test(so)) {
|
|
72072
|
+
writeContent(() => renderInfo("Nexus P2P network connected."));
|
|
72073
|
+
_registerNexusDaemon();
|
|
72074
|
+
return;
|
|
72007
72075
|
}
|
|
72008
72076
|
}
|
|
72009
|
-
} catch {
|
|
72010
72077
|
}
|
|
72078
|
+
} catch {
|
|
72011
72079
|
}
|
|
72012
|
-
}
|
|
72013
|
-
|
|
72080
|
+
};
|
|
72081
|
+
_tryNexusConnect(1);
|
|
72014
72082
|
} catch {
|
|
72015
72083
|
}
|
|
72016
72084
|
try {
|
|
@@ -74885,7 +74953,7 @@ async function runBackground(task, config, opts) {
|
|
|
74885
74953
|
const args = [task, "--json"];
|
|
74886
74954
|
if (config.model)
|
|
74887
74955
|
args.push("--model", config.model);
|
|
74888
|
-
const child = spawn22(
|
|
74956
|
+
const child = spawn22(process.execPath, [oaBin, ...args], {
|
|
74889
74957
|
cwd: repoRoot,
|
|
74890
74958
|
env: { ...process.env, OA_JOB_ID: id },
|
|
74891
74959
|
stdio: ["ignore", "pipe", "pipe"],
|
package/package.json
CHANGED