open-agents-ai 0.184.40 → 0.184.41
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 +10 -72
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65058,80 +65058,18 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
65058
65058
|
}
|
|
65059
65059
|
try {
|
|
65060
65060
|
const apiPort = parseInt(process.env["OA_PORT"] || "11435", 10);
|
|
65061
|
-
const
|
|
65062
|
-
const
|
|
65063
|
-
|
|
65064
|
-
|
|
65065
|
-
tester.once("error", (err) => {
|
|
65066
|
-
resolve36(err.code !== "EADDRINUSE");
|
|
65067
|
-
});
|
|
65068
|
-
tester.once("listening", () => {
|
|
65069
|
-
tester.close(() => resolve36(true));
|
|
65070
|
-
});
|
|
65071
|
-
tester.listen(apiPort, "127.0.0.1");
|
|
65072
|
-
});
|
|
65073
|
-
if (!portFree) {
|
|
65074
|
-
let isOurServer = false;
|
|
65075
|
-
try {
|
|
65076
|
-
const probe = await fetch(`http://127.0.0.1:${apiPort}/health`, { signal: AbortSignal.timeout(2e3) });
|
|
65077
|
-
if (probe.ok) {
|
|
65078
|
-
const data = await probe.json();
|
|
65079
|
-
isOurServer = data.status === "ok";
|
|
65080
|
-
}
|
|
65081
|
-
} catch {
|
|
65082
|
-
}
|
|
65083
|
-
if (isOurServer) {
|
|
65084
|
-
} else {
|
|
65085
|
-
try {
|
|
65086
|
-
const { execSync: nodeExec } = __require("child_process");
|
|
65087
|
-
if (isWin2) {
|
|
65088
|
-
const out = nodeExec(`netstat -ano | findstr :${apiPort} | findstr LISTENING`, { encoding: "utf8", timeout: 3e3 }).trim();
|
|
65089
|
-
const pid = out.split(/\s+/).pop();
|
|
65090
|
-
if (pid && parseInt(pid, 10) > 0 && parseInt(pid, 10) !== process.pid) {
|
|
65091
|
-
nodeExec(`taskkill /PID ${pid} /F`, { timeout: 3e3 });
|
|
65092
|
-
writeContent(() => renderInfo(`Killed orphaned process on port ${apiPort} (PID ${pid})`));
|
|
65093
|
-
await new Promise((r) => setTimeout(r, 1e3));
|
|
65094
|
-
}
|
|
65095
|
-
} else {
|
|
65096
|
-
try {
|
|
65097
|
-
const out = nodeExec(`lsof -ti :${apiPort} 2>/dev/null || fuser ${apiPort}/tcp 2>/dev/null`, { encoding: "utf8", timeout: 3e3 }).trim();
|
|
65098
|
-
const pids = out.split(/\s+/).map((s) => parseInt(s, 10)).filter((p) => p > 0 && p !== process.pid);
|
|
65099
|
-
for (const pid of pids) {
|
|
65100
|
-
try {
|
|
65101
|
-
process.kill(pid, "SIGTERM");
|
|
65102
|
-
} catch {
|
|
65103
|
-
}
|
|
65104
|
-
}
|
|
65105
|
-
if (pids.length > 0) {
|
|
65106
|
-
writeContent(() => renderInfo(`Killed ${pids.length} orphaned process(es) on port ${apiPort}`));
|
|
65107
|
-
await new Promise((r) => setTimeout(r, 1e3));
|
|
65108
|
-
}
|
|
65109
|
-
} catch {
|
|
65110
|
-
}
|
|
65111
|
-
}
|
|
65112
|
-
} catch {
|
|
65113
|
-
}
|
|
65114
|
-
}
|
|
65115
|
-
}
|
|
65116
|
-
const portNowFree = await new Promise((resolve36) => {
|
|
65117
|
-
const net = __require("net");
|
|
65118
|
-
const tester = net.createServer();
|
|
65119
|
-
tester.once("error", () => resolve36(false));
|
|
65120
|
-
tester.once("listening", () => {
|
|
65121
|
-
tester.close(() => resolve36(true));
|
|
65122
|
-
});
|
|
65123
|
-
tester.listen(apiPort, "127.0.0.1");
|
|
65061
|
+
const { startApiServer: startApiServer2 } = await Promise.resolve().then(() => (init_serve(), serve_exports));
|
|
65062
|
+
const apiServer = startApiServer2({
|
|
65063
|
+
port: apiPort,
|
|
65064
|
+
ollamaUrl: currentConfig.backendUrl || "http://127.0.0.1:11434"
|
|
65124
65065
|
});
|
|
65125
|
-
|
|
65126
|
-
|
|
65127
|
-
|
|
65128
|
-
port: apiPort,
|
|
65129
|
-
ollamaUrl: currentConfig.backendUrl || "http://127.0.0.1:11434"
|
|
65130
|
-
});
|
|
65131
|
-
apiServer.on?.("error", () => {
|
|
65132
|
-
});
|
|
65066
|
+
let apiStarted = false;
|
|
65067
|
+
apiServer.on?.("listening", () => {
|
|
65068
|
+
apiStarted = true;
|
|
65133
65069
|
writeContent(() => renderInfo(`REST API: http://localhost:${apiPort}`));
|
|
65134
|
-
}
|
|
65070
|
+
});
|
|
65071
|
+
apiServer.on?.("error", () => {
|
|
65072
|
+
});
|
|
65135
65073
|
} catch {
|
|
65136
65074
|
}
|
|
65137
65075
|
try {
|
package/package.json
CHANGED