open-agents-ai 0.103.25 → 0.103.27
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 +48 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26272,25 +26272,6 @@ function renderSlashHelp() {
|
|
|
26272
26272
|
`);
|
|
26273
26273
|
process.stdout.write("\n");
|
|
26274
26274
|
}
|
|
26275
|
-
function renderModelList(models, current) {
|
|
26276
|
-
process.stdout.write(`
|
|
26277
|
-
${c2.bold("Available models:")}
|
|
26278
|
-
|
|
26279
|
-
`);
|
|
26280
|
-
for (const m of models) {
|
|
26281
|
-
const isCurrent = m.name === current;
|
|
26282
|
-
const marker = isCurrent ? c2.green("\u25CF") : c2.dim("\u25CB");
|
|
26283
|
-
const name = isCurrent ? c2.bold(c2.green(m.name)) : m.name;
|
|
26284
|
-
const size = c2.dim(m.size);
|
|
26285
|
-
const modified = c2.dim(m.modified);
|
|
26286
|
-
process.stdout.write(` ${marker} ${name.padEnd(50)} ${size.padEnd(12)} ${modified}
|
|
26287
|
-
`);
|
|
26288
|
-
}
|
|
26289
|
-
process.stdout.write(`
|
|
26290
|
-
${c2.dim("Use /model <name> to switch models.")}
|
|
26291
|
-
|
|
26292
|
-
`);
|
|
26293
|
-
}
|
|
26294
26275
|
function renderModelSwitch(oldModel, newModel) {
|
|
26295
26276
|
process.stdout.write(`
|
|
26296
26277
|
${c2.green("\u2714")} Switched model: ${c2.dim(oldModel)} \u2192 ${c2.bold(c2.green(newModel))}
|
|
@@ -29816,20 +29797,33 @@ async function fetchPeerModels(peerId) {
|
|
|
29816
29797
|
const { join: join55 } = await import("node:path");
|
|
29817
29798
|
const cwd4 = process.cwd();
|
|
29818
29799
|
const nexusTool = new NexusTool2(cwd4);
|
|
29819
|
-
const
|
|
29820
|
-
|
|
29821
|
-
|
|
29822
|
-
|
|
29823
|
-
|
|
29824
|
-
|
|
29825
|
-
|
|
29826
|
-
|
|
29827
|
-
|
|
29828
|
-
|
|
29829
|
-
|
|
29830
|
-
|
|
29831
|
-
|
|
29832
|
-
|
|
29800
|
+
const nexusDir = nexusTool.getNexusDir();
|
|
29801
|
+
let isLocalPeer = false;
|
|
29802
|
+
try {
|
|
29803
|
+
const statusPath = join55(nexusDir, "status.json");
|
|
29804
|
+
if (existsSync42(statusPath)) {
|
|
29805
|
+
const status = JSON.parse(readFileSync31(statusPath, "utf8"));
|
|
29806
|
+
if (status.peerId === peerId)
|
|
29807
|
+
isLocalPeer = true;
|
|
29808
|
+
}
|
|
29809
|
+
} catch {
|
|
29810
|
+
}
|
|
29811
|
+
if (isLocalPeer) {
|
|
29812
|
+
const pricingPath2 = join55(nexusDir, "pricing.json");
|
|
29813
|
+
if (existsSync42(pricingPath2)) {
|
|
29814
|
+
try {
|
|
29815
|
+
const pricing = JSON.parse(readFileSync31(pricingPath2, "utf8"));
|
|
29816
|
+
const localModels = (pricing.models || []).map((m) => ({
|
|
29817
|
+
name: m.model || "unknown",
|
|
29818
|
+
size: m.parameterSize || "",
|
|
29819
|
+
modified: "",
|
|
29820
|
+
sizeBytes: 0,
|
|
29821
|
+
parameterSize: m.parameterSize || "remote"
|
|
29822
|
+
}));
|
|
29823
|
+
if (localModels.length > 0)
|
|
29824
|
+
return localModels;
|
|
29825
|
+
} catch {
|
|
29826
|
+
}
|
|
29833
29827
|
}
|
|
29834
29828
|
}
|
|
29835
29829
|
const result = await nexusTool.execute({
|
|
@@ -29853,6 +29847,20 @@ async function fetchPeerModels(peerId) {
|
|
|
29853
29847
|
if (models.length > 0)
|
|
29854
29848
|
return models;
|
|
29855
29849
|
}
|
|
29850
|
+
const pricingPath = join55(nexusDir, "pricing.json");
|
|
29851
|
+
if (existsSync42(pricingPath)) {
|
|
29852
|
+
try {
|
|
29853
|
+
const pricing = JSON.parse(readFileSync31(pricingPath, "utf8"));
|
|
29854
|
+
return (pricing.models || []).map((m) => ({
|
|
29855
|
+
name: m.model || "unknown",
|
|
29856
|
+
size: m.parameterSize || "",
|
|
29857
|
+
modified: "",
|
|
29858
|
+
sizeBytes: 0,
|
|
29859
|
+
parameterSize: m.parameterSize || "remote"
|
|
29860
|
+
}));
|
|
29861
|
+
} catch {
|
|
29862
|
+
}
|
|
29863
|
+
}
|
|
29856
29864
|
return [];
|
|
29857
29865
|
} catch {
|
|
29858
29866
|
return [];
|
|
@@ -33019,7 +33027,7 @@ async function handleSlashCommand(input, ctx) {
|
|
|
33019
33027
|
}
|
|
33020
33028
|
return "handled";
|
|
33021
33029
|
case "models":
|
|
33022
|
-
await
|
|
33030
|
+
await showModelPicker(ctx, hasLocal);
|
|
33023
33031
|
return "handled";
|
|
33024
33032
|
case "endpoint":
|
|
33025
33033
|
case "ep":
|
|
@@ -33919,14 +33927,6 @@ function applyConfigChanges(ctx, changes) {
|
|
|
33919
33927
|
if (changes.commandsMode !== void 0)
|
|
33920
33928
|
ctx.setCommandsMode?.(changes.commandsMode);
|
|
33921
33929
|
}
|
|
33922
|
-
async function listModels(ctx) {
|
|
33923
|
-
try {
|
|
33924
|
-
const models = await fetchModels(ctx.config.backendUrl, ctx.config.apiKey);
|
|
33925
|
-
renderModelList(models.map((m) => ({ name: m.name, size: m.size, modified: m.modified })), ctx.config.model);
|
|
33926
|
-
} catch (err) {
|
|
33927
|
-
renderError(`Failed to fetch models: ${err instanceof Error ? err.message : String(err)}`);
|
|
33928
|
-
}
|
|
33929
|
-
}
|
|
33930
33930
|
async function showModelPicker(ctx, local = false) {
|
|
33931
33931
|
try {
|
|
33932
33932
|
const models = await fetchModels(ctx.config.backendUrl, ctx.config.apiKey);
|
|
@@ -34068,12 +34068,15 @@ async function handleEndpoint(arg, ctx, local = false) {
|
|
|
34068
34068
|
}
|
|
34069
34069
|
return;
|
|
34070
34070
|
}
|
|
34071
|
-
const
|
|
34071
|
+
const normalizedArg = arg.replace(/\u2014/g, "--").replace(/\u2013/g, "--");
|
|
34072
|
+
const parts = normalizedArg.split(/\s+/);
|
|
34072
34073
|
const url = parts[0];
|
|
34073
34074
|
let apiKey;
|
|
34074
34075
|
const authIdx = parts.indexOf("--auth");
|
|
34075
|
-
|
|
34076
|
-
|
|
34076
|
+
const authIdx2 = authIdx === -1 ? parts.indexOf("-auth") : authIdx;
|
|
34077
|
+
const effectiveAuthIdx = authIdx !== -1 ? authIdx : authIdx2;
|
|
34078
|
+
if (effectiveAuthIdx !== -1 && parts[effectiveAuthIdx + 1]) {
|
|
34079
|
+
apiKey = parts[effectiveAuthIdx + 1];
|
|
34077
34080
|
}
|
|
34078
34081
|
if (url.startsWith("12D3KooW") && url.length > 40 && !url.includes("://")) {
|
|
34079
34082
|
await handlePeerEndpoint(url, apiKey, ctx, local);
|
package/package.json
CHANGED