open-agents-ai 0.187.86 → 0.187.87
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 +91 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -293376,6 +293376,17 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
293376
293376
|
detail: `${provider2} ${uses}${auth}`
|
|
293377
293377
|
};
|
|
293378
293378
|
});
|
|
293379
|
+
items.push({
|
|
293380
|
+
key: "__add__",
|
|
293381
|
+
label: `${c3.green("+")} Add endpoint`,
|
|
293382
|
+
detail: "Type a URL to add a new endpoint"
|
|
293383
|
+
});
|
|
293384
|
+
items.push({
|
|
293385
|
+
key: "__sponsor__",
|
|
293386
|
+
label: `${c3.cyan("\u2605")} Sponsored endpoints`,
|
|
293387
|
+
detail: "Discover free inference providers via Nexus"
|
|
293388
|
+
});
|
|
293389
|
+
let addedEndpoint = null;
|
|
293379
293390
|
const result = await tuiSelect({
|
|
293380
293391
|
items,
|
|
293381
293392
|
activeKey: ctx3.config.backendUrl,
|
|
@@ -293383,10 +293394,41 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
293383
293394
|
rl: ctx3.rl,
|
|
293384
293395
|
availableRows: ctx3.availableContentRows?.(),
|
|
293385
293396
|
onDelete: (item, done) => {
|
|
293397
|
+
if (item.key.startsWith("__")) {
|
|
293398
|
+
done(false);
|
|
293399
|
+
return;
|
|
293400
|
+
}
|
|
293386
293401
|
deleteUsageRecord("endpoint", item.key, ctx3.repoRoot);
|
|
293387
293402
|
done(true);
|
|
293403
|
+
},
|
|
293404
|
+
onEnter: (item, { getInput, resolve: resolve39 }) => {
|
|
293405
|
+
if (item.key === "__add__") {
|
|
293406
|
+
getInput("URL", "http://").then(async (url2) => {
|
|
293407
|
+
if (!url2 || !url2.trim())
|
|
293408
|
+
return;
|
|
293409
|
+
const authKey = await getInput("Auth key (optional)", "");
|
|
293410
|
+
const trimmedUrl = url2.trim();
|
|
293411
|
+
const authArg = authKey?.trim() ? ` --auth ${authKey.trim()}` : "";
|
|
293412
|
+
addedEndpoint = `${trimmedUrl}${authArg}`;
|
|
293413
|
+
resolve39({ confirmed: true, key: "__add__", index: -1 });
|
|
293414
|
+
});
|
|
293415
|
+
return true;
|
|
293416
|
+
}
|
|
293417
|
+
if (item.key === "__sponsor__") {
|
|
293418
|
+
resolve39({ confirmed: true, key: "__sponsor__", index: -1 });
|
|
293419
|
+
return true;
|
|
293420
|
+
}
|
|
293421
|
+
return false;
|
|
293388
293422
|
}
|
|
293389
293423
|
});
|
|
293424
|
+
if (result.confirmed && result.key === "__add__" && addedEndpoint) {
|
|
293425
|
+
await handleEndpoint(addedEndpoint, ctx3, local);
|
|
293426
|
+
return;
|
|
293427
|
+
}
|
|
293428
|
+
if (result.confirmed && result.key === "__sponsor__") {
|
|
293429
|
+
await handleSponsoredEndpoint(ctx3, local);
|
|
293430
|
+
return;
|
|
293431
|
+
}
|
|
293390
293432
|
if (result.confirmed && result.key) {
|
|
293391
293433
|
const selectedRecord = history.find((h) => h.value === result.key);
|
|
293392
293434
|
const savedAuth = selectedRecord?.meta?.authKey;
|
|
@@ -293398,34 +293440,55 @@ async function handleEndpoint(arg, ctx3, local = false) {
|
|
|
293398
293440
|
return;
|
|
293399
293441
|
}
|
|
293400
293442
|
const currentProvider = detectProvider(ctx3.config.backendUrl);
|
|
293401
|
-
|
|
293402
|
-
|
|
293403
|
-
|
|
293404
|
-
|
|
293405
|
-
|
|
293406
|
-
|
|
293407
|
-
|
|
293408
|
-
|
|
293409
|
-
|
|
293410
|
-
|
|
293411
|
-
|
|
293412
|
-
|
|
293413
|
-
|
|
293414
|
-
|
|
293415
|
-
|
|
293416
|
-
|
|
293417
|
-
|
|
293418
|
-
|
|
293419
|
-
|
|
293420
|
-
|
|
293421
|
-
|
|
293422
|
-
|
|
293423
|
-
|
|
293424
|
-
|
|
293425
|
-
|
|
293426
|
-
|
|
293427
|
-
|
|
293428
|
-
|
|
293443
|
+
const noHistItems = [
|
|
293444
|
+
{
|
|
293445
|
+
key: ctx3.config.backendUrl,
|
|
293446
|
+
label: `${currentProvider.label} \u2014 ${ctx3.config.backendUrl}`,
|
|
293447
|
+
detail: `${ctx3.config.backendType} ${ctx3.config.apiKey ? "Auth: Bearer token set" : "No auth"}`
|
|
293448
|
+
},
|
|
293449
|
+
{
|
|
293450
|
+
key: "__add__",
|
|
293451
|
+
label: `${c3.green("+")} Add endpoint`,
|
|
293452
|
+
detail: "Type a URL to add a new endpoint"
|
|
293453
|
+
},
|
|
293454
|
+
{
|
|
293455
|
+
key: "__sponsor__",
|
|
293456
|
+
label: `${c3.cyan("\u2605")} Sponsored endpoints`,
|
|
293457
|
+
detail: "Discover free inference providers via Nexus"
|
|
293458
|
+
}
|
|
293459
|
+
];
|
|
293460
|
+
let addedUrl = null;
|
|
293461
|
+
const noHistResult = await tuiSelect({
|
|
293462
|
+
items: noHistItems,
|
|
293463
|
+
activeKey: ctx3.config.backendUrl,
|
|
293464
|
+
title: "Select Endpoint",
|
|
293465
|
+
rl: ctx3.rl,
|
|
293466
|
+
availableRows: ctx3.availableContentRows?.(),
|
|
293467
|
+
onEnter: (item, { getInput, resolve: resolve39 }) => {
|
|
293468
|
+
if (item.key === "__add__") {
|
|
293469
|
+
getInput("URL", "http://").then(async (url2) => {
|
|
293470
|
+
if (!url2?.trim())
|
|
293471
|
+
return;
|
|
293472
|
+
const authKey = await getInput("Auth key (optional)", "");
|
|
293473
|
+
addedUrl = `${url2.trim()}${authKey?.trim() ? ` --auth ${authKey.trim()}` : ""}`;
|
|
293474
|
+
resolve39({ confirmed: true, key: "__add__", index: -1 });
|
|
293475
|
+
});
|
|
293476
|
+
return true;
|
|
293477
|
+
}
|
|
293478
|
+
if (item.key === "__sponsor__") {
|
|
293479
|
+
resolve39({ confirmed: true, key: "__sponsor__", index: -1 });
|
|
293480
|
+
return true;
|
|
293481
|
+
}
|
|
293482
|
+
return false;
|
|
293483
|
+
}
|
|
293484
|
+
});
|
|
293485
|
+
if (noHistResult.confirmed && noHistResult.key === "__add__" && addedUrl) {
|
|
293486
|
+
await handleEndpoint(addedUrl, ctx3, local);
|
|
293487
|
+
} else if (noHistResult.confirmed && noHistResult.key === "__sponsor__") {
|
|
293488
|
+
await handleSponsoredEndpoint(ctx3, local);
|
|
293489
|
+
} else if (!noHistResult.confirmed) {
|
|
293490
|
+
renderInfo("Endpoint selection cancelled.");
|
|
293491
|
+
}
|
|
293429
293492
|
return;
|
|
293430
293493
|
}
|
|
293431
293494
|
if (arg === "stop" || arg === "off" || arg.startsWith("stop ") || arg.startsWith("off ")) {
|
package/package.json
CHANGED