open-agents-ai 0.185.1 → 0.185.2
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 +20 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64409,6 +64409,8 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
|
|
|
64409
64409
|
}
|
|
64410
64410
|
}
|
|
64411
64411
|
function startApiServer(options = {}) {
|
|
64412
|
+
const log = options.quiet ? (_msg) => {
|
|
64413
|
+
} : (msg) => process.stderr.write(msg);
|
|
64412
64414
|
let host = "127.0.0.1";
|
|
64413
64415
|
let port = 11435;
|
|
64414
64416
|
const envHost = process.env["OA_HOST"];
|
|
@@ -64446,7 +64448,7 @@ function startApiServer(options = {}) {
|
|
|
64446
64448
|
server.on("error", (err) => {
|
|
64447
64449
|
if (err.code === "EADDRINUSE" && !retried) {
|
|
64448
64450
|
retried = true;
|
|
64449
|
-
|
|
64451
|
+
log(` Port ${port} in use \u2014 reclaiming...
|
|
64450
64452
|
`);
|
|
64451
64453
|
try {
|
|
64452
64454
|
const { execSync: es } = __require("node:child_process");
|
|
@@ -64472,10 +64474,10 @@ function startApiServer(options = {}) {
|
|
|
64472
64474
|
server.listen(port, host);
|
|
64473
64475
|
}, 2e3);
|
|
64474
64476
|
} else if (err.code === "EADDRINUSE" && retried) {
|
|
64475
|
-
|
|
64477
|
+
log(` Port ${port} still in use after reclaim attempt \u2014 API server skipped (non-fatal).
|
|
64476
64478
|
`);
|
|
64477
64479
|
} else {
|
|
64478
|
-
|
|
64480
|
+
log(` API server error (non-fatal): ${err.message}
|
|
64479
64481
|
`);
|
|
64480
64482
|
}
|
|
64481
64483
|
});
|
|
@@ -64496,43 +64498,43 @@ function startApiServer(options = {}) {
|
|
|
64496
64498
|
});
|
|
64497
64499
|
server.listen(port, host, () => {
|
|
64498
64500
|
const version = getVersion3();
|
|
64499
|
-
|
|
64501
|
+
log(`
|
|
64500
64502
|
open-agents API server v${version}
|
|
64501
64503
|
`);
|
|
64502
|
-
|
|
64504
|
+
log(` Listening on http://${host}:${port}
|
|
64503
64505
|
`);
|
|
64504
|
-
|
|
64506
|
+
log(` Primary: ${config.backendUrl} (${config.backendType || "ollama"})
|
|
64505
64507
|
`);
|
|
64506
64508
|
if (process.env["OA_API_KEYS"]) {
|
|
64507
64509
|
const keyCount = process.env["OA_API_KEYS"].split(",").length;
|
|
64508
|
-
|
|
64510
|
+
log(` Auth: ${keyCount} scoped key(s) (read/run/admin)
|
|
64509
64511
|
`);
|
|
64510
64512
|
} else if (process.env["OA_API_KEY"]) {
|
|
64511
|
-
|
|
64513
|
+
log(` Auth: single Bearer token (admin scope)
|
|
64512
64514
|
`);
|
|
64513
64515
|
} else {
|
|
64514
|
-
|
|
64516
|
+
log(` Auth: disabled (set OA_API_KEY or OA_API_KEYS to enable)
|
|
64515
64517
|
`);
|
|
64516
64518
|
}
|
|
64517
|
-
|
|
64519
|
+
log(` Discovering sponsors in background...
|
|
64518
64520
|
|
|
64519
64521
|
`);
|
|
64520
64522
|
refreshEndpointRegistry().then(() => {
|
|
64521
64523
|
if (endpointRegistry.length > 1) {
|
|
64522
|
-
|
|
64524
|
+
log(` Sponsors: ${endpointRegistry.length - 1} endpoint(s) discovered
|
|
64523
64525
|
`);
|
|
64524
64526
|
for (const ep of endpointRegistry.slice(1)) {
|
|
64525
|
-
|
|
64527
|
+
log(` ${ep.label}: ${ep.url} (${ep.type})${ep.authKey ? " [auth]" : ""}
|
|
64526
64528
|
`);
|
|
64527
64529
|
}
|
|
64528
|
-
|
|
64530
|
+
log(`
|
|
64529
64531
|
`);
|
|
64530
64532
|
}
|
|
64531
64533
|
}).catch(() => {
|
|
64532
64534
|
});
|
|
64533
64535
|
});
|
|
64534
64536
|
const shutdown = () => {
|
|
64535
|
-
|
|
64537
|
+
log("\n Shutting down API server...\n");
|
|
64536
64538
|
for (const [id, child] of runningProcesses) {
|
|
64537
64539
|
if (!child.killed) {
|
|
64538
64540
|
child.kill("SIGTERM");
|
|
@@ -64540,7 +64542,7 @@ function startApiServer(options = {}) {
|
|
|
64540
64542
|
runningProcesses.delete(id);
|
|
64541
64543
|
}
|
|
64542
64544
|
server.close(() => {
|
|
64543
|
-
|
|
64545
|
+
log(" Server stopped.\n");
|
|
64544
64546
|
process.exit(0);
|
|
64545
64547
|
});
|
|
64546
64548
|
setTimeout(() => process.exit(1), 5e3).unref();
|
|
@@ -66928,7 +66930,9 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
66928
66930
|
const apiPort = parseInt(process.env["OA_PORT"] || "11435", 10);
|
|
66929
66931
|
const apiServer = startApiServer2({
|
|
66930
66932
|
port: apiPort,
|
|
66931
|
-
ollamaUrl: currentConfig.backendUrl || "http://127.0.0.1:11434"
|
|
66933
|
+
ollamaUrl: currentConfig.backendUrl || "http://127.0.0.1:11434",
|
|
66934
|
+
quiet: true
|
|
66935
|
+
// TUI mode — suppress all direct stderr/stdout output
|
|
66932
66936
|
});
|
|
66933
66937
|
apiServer.on?.("listening", () => {
|
|
66934
66938
|
setTimeout(() => {
|
package/package.json
CHANGED