open-agents-ai 0.185.11 → 0.185.13
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 +59 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49849,7 +49849,9 @@ async function showModelPicker(ctx, local = false) {
|
|
|
49849
49849
|
try {
|
|
49850
49850
|
let models;
|
|
49851
49851
|
try {
|
|
49852
|
-
|
|
49852
|
+
const fetchPromise = fetchModels(ctx.config.backendUrl, ctx.config.apiKey);
|
|
49853
|
+
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error(`Timed out fetching models from ${ctx.config.backendUrl} (10s). The endpoint may be down. Use /endpoint to switch.`)), 1e4));
|
|
49854
|
+
models = await Promise.race([fetchPromise, timeoutPromise]);
|
|
49853
49855
|
} finally {
|
|
49854
49856
|
clearInterval(spinTimer);
|
|
49855
49857
|
process.stdout.write(`\r${" ".repeat(40)}\r`);
|
|
@@ -50745,6 +50747,36 @@ async function handleSponsoredEndpoint(ctx, local) {
|
|
|
50745
50747
|
}
|
|
50746
50748
|
sponsors.length = 0;
|
|
50747
50749
|
sponsors.push(...deduped);
|
|
50750
|
+
if (sponsors.length > 0) {
|
|
50751
|
+
process.stdout.write(` ${c2.dim("Verifying " + sponsors.length + " sponsor(s)...")}
|
|
50752
|
+
`);
|
|
50753
|
+
const probeResults = await Promise.all(sponsors.map(async (sp) => {
|
|
50754
|
+
if (!sp.url)
|
|
50755
|
+
return true;
|
|
50756
|
+
try {
|
|
50757
|
+
const base = normalizeBaseUrl(sp.url);
|
|
50758
|
+
const headers = {};
|
|
50759
|
+
if (sp.authKey)
|
|
50760
|
+
headers["Authorization"] = `Bearer ${sp.authKey}`;
|
|
50761
|
+
const resp = await fetch(`${base}/v1/models`, { headers, signal: AbortSignal.timeout(5e3) });
|
|
50762
|
+
if (!resp.ok && sp.authKey) {
|
|
50763
|
+
const noAuth = await fetch(`${base}/v1/models`, { signal: AbortSignal.timeout(3e3) });
|
|
50764
|
+
return noAuth.ok;
|
|
50765
|
+
}
|
|
50766
|
+
return resp.ok;
|
|
50767
|
+
} catch {
|
|
50768
|
+
return false;
|
|
50769
|
+
}
|
|
50770
|
+
}));
|
|
50771
|
+
const staleCount = probeResults.filter((ok) => !ok).length;
|
|
50772
|
+
const verified = sponsors.filter((_, i) => probeResults[i]);
|
|
50773
|
+
if (staleCount > 0) {
|
|
50774
|
+
process.stdout.write(` ${c2.dim(staleCount + " stale sponsor(s) hidden (unreachable)")}
|
|
50775
|
+
`);
|
|
50776
|
+
}
|
|
50777
|
+
sponsors.length = 0;
|
|
50778
|
+
sponsors.push(...verified);
|
|
50779
|
+
}
|
|
50748
50780
|
process.stdout.write("\n");
|
|
50749
50781
|
if (sponsors.length === 0) {
|
|
50750
50782
|
renderInfo("No sponsored endpoints found on the nexus mesh.");
|
|
@@ -68474,43 +68506,34 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
|
|
|
68474
68506
|
renderInfo(`Last task: ${lastTask}${lastEntry.task && lastEntry.task.length > 80 ? "..." : ""}`);
|
|
68475
68507
|
});
|
|
68476
68508
|
let countdown = 10;
|
|
68477
|
-
let
|
|
68478
|
-
const
|
|
68479
|
-
|
|
68480
|
-
|
|
68481
|
-
|
|
68482
|
-
|
|
68483
|
-
|
|
68484
|
-
|
|
68485
|
-
|
|
68486
|
-
|
|
68487
|
-
|
|
68509
|
+
let selectDone = false;
|
|
68510
|
+
const autoTimer = setInterval(() => {
|
|
68511
|
+
if (selectDone)
|
|
68512
|
+
return;
|
|
68513
|
+
countdown--;
|
|
68514
|
+
if (countdown <= 0) {
|
|
68515
|
+
selectDone = true;
|
|
68516
|
+
clearInterval(autoTimer);
|
|
68517
|
+
try {
|
|
68518
|
+
rl.feed("\x1B");
|
|
68519
|
+
} catch {
|
|
68488
68520
|
}
|
|
68489
|
-
|
|
68490
|
-
|
|
68491
|
-
|
|
68492
|
-
|
|
68493
|
-
|
|
68494
|
-
|
|
68495
|
-
|
|
68496
|
-
|
|
68497
|
-
|
|
68498
|
-
|
|
68499
|
-
|
|
68500
|
-
};
|
|
68501
|
-
const onEscape = () => {
|
|
68502
|
-
if (resolved)
|
|
68503
|
-
return;
|
|
68504
|
-
resolved = true;
|
|
68505
|
-
clearInterval(countdownTimer);
|
|
68506
|
-
rl.removeListener("line", onLine);
|
|
68507
|
-
rl.removeListener("escape", onEscape);
|
|
68508
|
-
resolve36("fresh");
|
|
68509
|
-
};
|
|
68510
|
-
rl.on("line", onLine);
|
|
68511
|
-
rl.on("escape", onEscape);
|
|
68521
|
+
}
|
|
68522
|
+
}, 1e3);
|
|
68523
|
+
const selectResult = await tuiSelect({
|
|
68524
|
+
items: [
|
|
68525
|
+
{ key: "restore", label: `Restore previous context (auto in ${countdown}s)` },
|
|
68526
|
+
{ key: "fresh", label: "Start fresh" }
|
|
68527
|
+
],
|
|
68528
|
+
activeKey: "restore",
|
|
68529
|
+
title: `Restore previous session?`,
|
|
68530
|
+
rl,
|
|
68531
|
+
availableRows: statusBar.isActive ? statusBar.availableContentRows : void 0
|
|
68512
68532
|
});
|
|
68513
|
-
|
|
68533
|
+
clearInterval(autoTimer);
|
|
68534
|
+
selectDone = true;
|
|
68535
|
+
const doRestore = selectResult.confirmed ? selectResult.key === "restore" : countdown <= 0;
|
|
68536
|
+
if (doRestore) {
|
|
68514
68537
|
const prompt = buildContextRestorePrompt(repoRoot);
|
|
68515
68538
|
if (prompt) {
|
|
68516
68539
|
restoredSessionContext = prompt;
|
package/package.json
CHANGED