open-agents-ai 0.184.57 → 0.184.59
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 +92 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41611,7 +41611,9 @@ function tuiSelect(opts) {
|
|
|
41611
41611
|
${selectColors.cyan("\u2190")} ${trail}`);
|
|
41612
41612
|
}
|
|
41613
41613
|
if (title) {
|
|
41614
|
-
|
|
41614
|
+
if (!hasBreadcrumbs)
|
|
41615
|
+
lines.push("");
|
|
41616
|
+
lines.push(` ${selectColors.bold(title)}`);
|
|
41615
41617
|
}
|
|
41616
41618
|
if (filter) {
|
|
41617
41619
|
const count = matchSet.size;
|
|
@@ -63288,43 +63290,93 @@ function startApiServer(options = {}) {
|
|
|
63288
63290
|
}
|
|
63289
63291
|
});
|
|
63290
63292
|
});
|
|
63293
|
+
let retried = false;
|
|
63291
63294
|
server.on("error", (err) => {
|
|
63292
|
-
if (err.code === "EADDRINUSE") {
|
|
63293
|
-
|
|
63295
|
+
if (err.code === "EADDRINUSE" && !retried) {
|
|
63296
|
+
retried = true;
|
|
63297
|
+
process.stderr.write(` Port ${port} in use \u2014 reclaiming...
|
|
63298
|
+
`);
|
|
63299
|
+
try {
|
|
63300
|
+
const { execSync: es } = __require("node:child_process");
|
|
63301
|
+
const pids = es(`lsof -ti :${port} 2>/dev/null || fuser ${port}/tcp 2>/dev/null || true`, { encoding: "utf8" }).trim().split(/[\n\s]+/).filter(Boolean);
|
|
63302
|
+
for (const pid of pids) {
|
|
63303
|
+
const numPid = parseInt(pid, 10);
|
|
63304
|
+
if (numPid && numPid !== process.pid) {
|
|
63305
|
+
try {
|
|
63306
|
+
process.kill(numPid, "SIGTERM");
|
|
63307
|
+
} catch {
|
|
63308
|
+
}
|
|
63309
|
+
setTimeout(() => {
|
|
63310
|
+
try {
|
|
63311
|
+
process.kill(numPid, "SIGKILL");
|
|
63312
|
+
} catch {
|
|
63313
|
+
}
|
|
63314
|
+
}, 500);
|
|
63315
|
+
}
|
|
63316
|
+
}
|
|
63317
|
+
} catch {
|
|
63318
|
+
}
|
|
63319
|
+
setTimeout(() => {
|
|
63320
|
+
server.listen(port, host);
|
|
63321
|
+
}, 2e3);
|
|
63322
|
+
} else if (err.code === "EADDRINUSE" && retried) {
|
|
63323
|
+
process.stderr.write(` Port ${port} still in use after reclaim attempt \u2014 API server not started.
|
|
63294
63324
|
`);
|
|
63295
63325
|
} else {
|
|
63296
63326
|
process.stderr.write(` API server error: ${err.message}
|
|
63297
63327
|
`);
|
|
63298
63328
|
}
|
|
63299
63329
|
});
|
|
63300
|
-
|
|
63301
|
-
|
|
63302
|
-
|
|
63303
|
-
|
|
63304
|
-
|
|
63330
|
+
endpointRegistry.push({
|
|
63331
|
+
label: (() => {
|
|
63332
|
+
const u = config.backendUrl;
|
|
63333
|
+
if (u.includes("127.0.0.1") || u.includes("localhost"))
|
|
63334
|
+
return "local";
|
|
63335
|
+
try {
|
|
63336
|
+
return new URL(u).hostname.split(".")[0];
|
|
63337
|
+
} catch {
|
|
63338
|
+
return "primary";
|
|
63339
|
+
}
|
|
63340
|
+
})(),
|
|
63341
|
+
url: config.backendUrl,
|
|
63342
|
+
type: config.backendType || "ollama",
|
|
63343
|
+
authKey: config.apiKey
|
|
63344
|
+
});
|
|
63345
|
+
server.listen(port, host, () => {
|
|
63346
|
+
const version = getVersion3();
|
|
63347
|
+
process.stderr.write(`
|
|
63305
63348
|
open-agents API server v${version}
|
|
63306
63349
|
`);
|
|
63307
|
-
|
|
63350
|
+
process.stderr.write(` Listening on http://${host}:${port}
|
|
63308
63351
|
`);
|
|
63309
|
-
|
|
63352
|
+
process.stderr.write(` Primary: ${config.backendUrl} (${config.backendType || "ollama"})
|
|
63310
63353
|
`);
|
|
63311
|
-
|
|
63312
|
-
|
|
63354
|
+
if (process.env["OA_API_KEYS"]) {
|
|
63355
|
+
const keyCount = process.env["OA_API_KEYS"].split(",").length;
|
|
63356
|
+
process.stderr.write(` Auth: ${keyCount} scoped key(s) (read/run/admin)
|
|
63313
63357
|
`);
|
|
63314
|
-
|
|
63315
|
-
|
|
63316
|
-
const keyCount = process.env["OA_API_KEYS"].split(",").length;
|
|
63317
|
-
process.stderr.write(` Auth: ${keyCount} scoped key(s) (read/run/admin)
|
|
63358
|
+
} else if (process.env["OA_API_KEY"]) {
|
|
63359
|
+
process.stderr.write(` Auth: single Bearer token (admin scope)
|
|
63318
63360
|
`);
|
|
63319
|
-
|
|
63320
|
-
|
|
63361
|
+
} else {
|
|
63362
|
+
process.stderr.write(` Auth: disabled (set OA_API_KEY or OA_API_KEYS to enable)
|
|
63321
63363
|
`);
|
|
63322
|
-
|
|
63323
|
-
|
|
63364
|
+
}
|
|
63365
|
+
process.stderr.write(` Discovering sponsors in background...
|
|
63366
|
+
|
|
63324
63367
|
`);
|
|
63325
|
-
|
|
63326
|
-
|
|
63368
|
+
refreshEndpointRegistry().then(() => {
|
|
63369
|
+
if (endpointRegistry.length > 1) {
|
|
63370
|
+
process.stderr.write(` Sponsors: ${endpointRegistry.length - 1} endpoint(s) discovered
|
|
63371
|
+
`);
|
|
63372
|
+
for (const ep of endpointRegistry.slice(1)) {
|
|
63373
|
+
process.stderr.write(` ${ep.label}: ${ep.url} (${ep.type})${ep.authKey ? " [auth]" : ""}
|
|
63327
63374
|
`);
|
|
63375
|
+
}
|
|
63376
|
+
process.stderr.write(`
|
|
63377
|
+
`);
|
|
63378
|
+
}
|
|
63379
|
+
}).catch(() => {
|
|
63328
63380
|
});
|
|
63329
63381
|
});
|
|
63330
63382
|
const shutdown = () => {
|
|
@@ -65251,6 +65303,15 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
65251
65303
|
statusBar.handlePointerEvent(type, col, row);
|
|
65252
65304
|
});
|
|
65253
65305
|
process.stdin.pipe(mouseFilter);
|
|
65306
|
+
process.stdin.on("error", (err) => {
|
|
65307
|
+
if (err.code === "EIO" || err.code === "ENOTTY")
|
|
65308
|
+
return;
|
|
65309
|
+
try {
|
|
65310
|
+
process.stderr.write(`stdin error: ${err.code}
|
|
65311
|
+
`);
|
|
65312
|
+
} catch {
|
|
65313
|
+
}
|
|
65314
|
+
});
|
|
65254
65315
|
const rl = readline2.createInterface({
|
|
65255
65316
|
input: mouseFilter,
|
|
65256
65317
|
output: process.stdout,
|
|
@@ -67692,10 +67753,15 @@ ${c2.dim("(Use /quit to exit)")}
|
|
|
67692
67753
|
_escapeHandler = () => {
|
|
67693
67754
|
if (!activeTask)
|
|
67694
67755
|
return;
|
|
67695
|
-
if (
|
|
67696
|
-
|
|
67697
|
-
|
|
67756
|
+
if (activeTask.runner.isPaused) {
|
|
67757
|
+
writeContent(() => process.stdout.write(` ${c2.red("\u23F9")} ${c2.dim("Stopped.")}
|
|
67758
|
+
`));
|
|
67759
|
+
activeTask.runner.abort();
|
|
67760
|
+
showPrompt();
|
|
67761
|
+
return;
|
|
67698
67762
|
}
|
|
67763
|
+
activeTask.runner.pause();
|
|
67764
|
+
statusBar.setProcessing(false);
|
|
67699
67765
|
const retracted = activeTask.runner.retractLastPendingMessage();
|
|
67700
67766
|
if (retracted) {
|
|
67701
67767
|
lastSteeringInput = retracted;
|
|
@@ -67704,14 +67770,8 @@ ${c2.dim("(Use /quit to exit)")}
|
|
|
67704
67770
|
`));
|
|
67705
67771
|
rl.line = retracted;
|
|
67706
67772
|
rl.cursor = retracted.length;
|
|
67707
|
-
} else if (lastSteeringInput) {
|
|
67708
|
-
lastSteeringRetracted = true;
|
|
67709
|
-
writeContent(() => process.stdout.write(` ${c2.yellow("\u23F8")} ${c2.dim("\x1B[9m" + lastSteeringInput.slice(0, 120) + "\x1B[29m")} ${c2.dim("\u2190 already sent, re-type below to override")}
|
|
67710
|
-
`));
|
|
67711
|
-
rl.line = lastSteeringInput;
|
|
67712
|
-
rl.cursor = lastSteeringInput.length;
|
|
67713
67773
|
} else {
|
|
67714
|
-
writeContent(() => process.stdout.write(` ${c2.yellow("\u23F8")} ${c2.dim("Paused.
|
|
67774
|
+
writeContent(() => process.stdout.write(` ${c2.yellow("\u23F8")} ${c2.dim("Paused. Press Esc again to stop, or type and press Enter to steer.")}
|
|
67715
67775
|
`));
|
|
67716
67776
|
}
|
|
67717
67777
|
showPrompt();
|
package/package.json
CHANGED