open-agents-ai 0.184.36 → 0.184.37
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 +32 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -62533,6 +62533,15 @@ function startApiServer(options = {}) {
|
|
|
62533
62533
|
}
|
|
62534
62534
|
});
|
|
62535
62535
|
});
|
|
62536
|
+
server.on("error", (err) => {
|
|
62537
|
+
if (err.code === "EADDRINUSE") {
|
|
62538
|
+
process.stderr.write(` Port ${port} already in use \u2014 API server not started.
|
|
62539
|
+
`);
|
|
62540
|
+
} else {
|
|
62541
|
+
process.stderr.write(` API server error: ${err.message}
|
|
62542
|
+
`);
|
|
62543
|
+
}
|
|
62544
|
+
});
|
|
62536
62545
|
server.listen(port, host, () => {
|
|
62537
62546
|
const version = getVersion3();
|
|
62538
62547
|
process.stderr.write(`
|
|
@@ -64775,19 +64784,33 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
64775
64784
|
} catch {
|
|
64776
64785
|
}
|
|
64777
64786
|
try {
|
|
64778
|
-
const { startApiServer: startApiServer2 } = await Promise.resolve().then(() => (init_serve(), serve_exports));
|
|
64779
64787
|
const apiPort = parseInt(process.env["OA_PORT"] || "11435", 10);
|
|
64780
|
-
const
|
|
64781
|
-
|
|
64782
|
-
|
|
64788
|
+
const portFree = await new Promise((resolve36) => {
|
|
64789
|
+
const net = __require("net");
|
|
64790
|
+
const tester = net.createServer();
|
|
64791
|
+
tester.once("error", (err) => {
|
|
64792
|
+
if (err.code === "EADDRINUSE")
|
|
64793
|
+
resolve36(false);
|
|
64794
|
+
else
|
|
64795
|
+
resolve36(true);
|
|
64796
|
+
});
|
|
64797
|
+
tester.once("listening", () => {
|
|
64798
|
+
tester.close(() => resolve36(true));
|
|
64799
|
+
});
|
|
64800
|
+
tester.listen(apiPort, "127.0.0.1");
|
|
64783
64801
|
});
|
|
64784
|
-
|
|
64785
|
-
} catch (apiErr) {
|
|
64786
|
-
const msg = apiErr instanceof Error ? apiErr.message : String(apiErr);
|
|
64787
|
-
if (msg.includes("EADDRINUSE")) {
|
|
64802
|
+
if (!portFree) {
|
|
64788
64803
|
} else {
|
|
64789
|
-
|
|
64804
|
+
const { startApiServer: startApiServer2 } = await Promise.resolve().then(() => (init_serve(), serve_exports));
|
|
64805
|
+
const apiServer = startApiServer2({
|
|
64806
|
+
port: apiPort,
|
|
64807
|
+
ollamaUrl: currentConfig.backendUrl || "http://127.0.0.1:11434"
|
|
64808
|
+
});
|
|
64809
|
+
apiServer.on?.("error", () => {
|
|
64810
|
+
});
|
|
64811
|
+
writeContent(() => renderInfo(`REST API: http://localhost:${apiPort}`));
|
|
64790
64812
|
}
|
|
64813
|
+
} catch {
|
|
64791
64814
|
}
|
|
64792
64815
|
try {
|
|
64793
64816
|
const { homedir: _hd } = await import("node:os");
|
package/package.json
CHANGED