open-agents-ai 0.103.27 → 0.103.28
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 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29809,10 +29809,10 @@ async function fetchPeerModels(peerId) {
|
|
|
29809
29809
|
} catch {
|
|
29810
29810
|
}
|
|
29811
29811
|
if (isLocalPeer) {
|
|
29812
|
-
const
|
|
29813
|
-
if (existsSync42(
|
|
29812
|
+
const pricingPath = join55(nexusDir, "pricing.json");
|
|
29813
|
+
if (existsSync42(pricingPath)) {
|
|
29814
29814
|
try {
|
|
29815
|
-
const pricing = JSON.parse(readFileSync31(
|
|
29815
|
+
const pricing = JSON.parse(readFileSync31(pricingPath, "utf8"));
|
|
29816
29816
|
const localModels = (pricing.models || []).map((m) => ({
|
|
29817
29817
|
name: m.model || "unknown",
|
|
29818
29818
|
size: m.parameterSize || "",
|
|
@@ -29826,6 +29826,25 @@ async function fetchPeerModels(peerId) {
|
|
|
29826
29826
|
}
|
|
29827
29827
|
}
|
|
29828
29828
|
}
|
|
29829
|
+
const cachePath = join55(nexusDir, "peer-models-cache.json");
|
|
29830
|
+
if (existsSync42(cachePath)) {
|
|
29831
|
+
try {
|
|
29832
|
+
const cache4 = JSON.parse(readFileSync31(cachePath, "utf8"));
|
|
29833
|
+
if (cache4.peerId === peerId && cache4.models?.length > 0) {
|
|
29834
|
+
const age = Date.now() - new Date(cache4.cachedAt).getTime();
|
|
29835
|
+
if (age < 5 * 60 * 1e3) {
|
|
29836
|
+
return cache4.models.map((m) => ({
|
|
29837
|
+
name: m.name || "unknown",
|
|
29838
|
+
size: m.size || m.parameterSize || "",
|
|
29839
|
+
modified: "",
|
|
29840
|
+
sizeBytes: 0,
|
|
29841
|
+
parameterSize: m.parameterSize || "remote"
|
|
29842
|
+
}));
|
|
29843
|
+
}
|
|
29844
|
+
}
|
|
29845
|
+
} catch {
|
|
29846
|
+
}
|
|
29847
|
+
}
|
|
29829
29848
|
const result = await nexusTool.execute({
|
|
29830
29849
|
action: "find_agent",
|
|
29831
29850
|
peer_id: peerId
|
|
@@ -29847,18 +29866,20 @@ async function fetchPeerModels(peerId) {
|
|
|
29847
29866
|
if (models.length > 0)
|
|
29848
29867
|
return models;
|
|
29849
29868
|
}
|
|
29850
|
-
|
|
29851
|
-
|
|
29852
|
-
|
|
29853
|
-
|
|
29854
|
-
|
|
29855
|
-
|
|
29856
|
-
|
|
29857
|
-
|
|
29858
|
-
|
|
29859
|
-
|
|
29860
|
-
|
|
29861
|
-
|
|
29869
|
+
if (isLocalPeer) {
|
|
29870
|
+
const pricingPath = join55(nexusDir, "pricing.json");
|
|
29871
|
+
if (existsSync42(pricingPath)) {
|
|
29872
|
+
try {
|
|
29873
|
+
const pricing = JSON.parse(readFileSync31(pricingPath, "utf8"));
|
|
29874
|
+
return (pricing.models || []).map((m) => ({
|
|
29875
|
+
name: m.model || "unknown",
|
|
29876
|
+
size: m.parameterSize || "",
|
|
29877
|
+
modified: "",
|
|
29878
|
+
sizeBytes: 0,
|
|
29879
|
+
parameterSize: m.parameterSize || "remote"
|
|
29880
|
+
}));
|
|
29881
|
+
} catch {
|
|
29882
|
+
}
|
|
29862
29883
|
}
|
|
29863
29884
|
}
|
|
29864
29885
|
return [];
|
|
@@ -34273,6 +34294,18 @@ async function handlePeerEndpoint(peerId, authKey, ctx, local) {
|
|
|
34273
34294
|
try {
|
|
34274
34295
|
const models = await fetchModels(peerUrl, authKey);
|
|
34275
34296
|
if (models.length > 0) {
|
|
34297
|
+
try {
|
|
34298
|
+
const { writeFileSync: writeFileSync19, mkdirSync: mkdirSync21 } = await import("node:fs");
|
|
34299
|
+
const { join: join55, dirname: dirname20 } = await import("node:path");
|
|
34300
|
+
const cachePath = join55(ctx.repoRoot || process.cwd(), ".oa", "nexus", "peer-models-cache.json");
|
|
34301
|
+
mkdirSync21(dirname20(cachePath), { recursive: true });
|
|
34302
|
+
writeFileSync19(cachePath, JSON.stringify({
|
|
34303
|
+
peerId,
|
|
34304
|
+
cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
34305
|
+
models: models.map((m) => ({ name: m.name, size: m.size, parameterSize: m.parameterSize }))
|
|
34306
|
+
}, null, 2));
|
|
34307
|
+
} catch {
|
|
34308
|
+
}
|
|
34276
34309
|
process.stdout.write(` ${c2.green("\u2714")} Discovered ${models.length} model(s) on peer:
|
|
34277
34310
|
`);
|
|
34278
34311
|
for (const m of models.slice(0, 10)) {
|
package/package.json
CHANGED