open-agents-ai 0.103.48 → 0.103.49
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 +40 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12122,6 +12122,27 @@ if (hasX402Key) {
|
|
|
12122
12122
|
}
|
|
12123
12123
|
const nexus = new NexusClient(nexusOpts);
|
|
12124
12124
|
|
|
12125
|
+
// Monkey-patch dialPeerProtocol to convert string multiaddrs to proper Multiaddr objects.
|
|
12126
|
+
// libp2p v3 (3.1.x) requires Multiaddr objects (with .getComponents()), but
|
|
12127
|
+
// open-agents-nexus resolves multiaddrs as plain strings. This shim wraps
|
|
12128
|
+
// node.dialProtocol to auto-convert strings before they reach libp2p's getPeerAddress().
|
|
12129
|
+
if (nexus.node && typeof nexus.node.dialProtocol === 'function') {
|
|
12130
|
+
var _origDialProtocol = nexus.node.dialProtocol.bind(nexus.node);
|
|
12131
|
+
nexus.node.dialProtocol = async function patchedDialProtocol(peer, protocols, options) {
|
|
12132
|
+
// If peer is a string (multiaddr), convert to a proper Multiaddr object
|
|
12133
|
+
if (typeof peer === 'string' && peer.startsWith('/')) {
|
|
12134
|
+
try {
|
|
12135
|
+
var { multiaddr: maFromStr } = await import('@multiformats/multiaddr');
|
|
12136
|
+
peer = maFromStr(peer);
|
|
12137
|
+
} catch (convErr) {
|
|
12138
|
+
dlog('multiaddr conversion failed: ' + (convErr.message || convErr));
|
|
12139
|
+
}
|
|
12140
|
+
}
|
|
12141
|
+
return _origDialProtocol(peer, protocols, options);
|
|
12142
|
+
};
|
|
12143
|
+
dlog('patched node.dialProtocol for multiaddr string conversion');
|
|
12144
|
+
}
|
|
12145
|
+
|
|
12125
12146
|
const rooms = new Map();
|
|
12126
12147
|
let connected = false;
|
|
12127
12148
|
const blockedPeers = [];
|
|
@@ -44258,19 +44279,26 @@ var init_status_bar = __esm({
|
|
|
44258
44279
|
const raw = await sendCommand("invoke_capability", {
|
|
44259
44280
|
target_peer: peerId,
|
|
44260
44281
|
capability: "system_metrics",
|
|
44261
|
-
|
|
44282
|
+
input: queryData
|
|
44262
44283
|
}, 8e3);
|
|
44263
|
-
const
|
|
44264
|
-
if (
|
|
44265
|
-
|
|
44266
|
-
|
|
44267
|
-
|
|
44268
|
-
|
|
44269
|
-
|
|
44270
|
-
|
|
44271
|
-
|
|
44272
|
-
|
|
44273
|
-
|
|
44284
|
+
const parsed = JSON.parse(raw);
|
|
44285
|
+
if (parsed) {
|
|
44286
|
+
let metricsData = null;
|
|
44287
|
+
if (typeof parsed === "object" && parsed.result) {
|
|
44288
|
+
metricsData = typeof parsed.result === "string" ? JSON.parse(parsed.result) : parsed.result;
|
|
44289
|
+
} else if (typeof parsed === "object" && parsed.cpu) {
|
|
44290
|
+
metricsData = parsed;
|
|
44291
|
+
}
|
|
44292
|
+
if (metricsData?.cpu) {
|
|
44293
|
+
this.setRemoteMetrics({
|
|
44294
|
+
cpuUtil: metricsData.cpu?.utilization ?? 0,
|
|
44295
|
+
gpuUtil: metricsData.gpu?.available ? metricsData.gpu.utilization ?? 0 : -1,
|
|
44296
|
+
gpuName: metricsData.gpu?.name ?? "",
|
|
44297
|
+
vramUtil: metricsData.gpu?.available ? metricsData.gpu.vramUtilization ?? 0 : -1,
|
|
44298
|
+
memUtil: metricsData.memory?.utilization ?? 0
|
|
44299
|
+
});
|
|
44300
|
+
return;
|
|
44301
|
+
}
|
|
44274
44302
|
}
|
|
44275
44303
|
} catch {
|
|
44276
44304
|
}
|
package/package.json
CHANGED